dgkanatsios / azuregameserversscalingkubernetes

Scaling Dedicated Game Servers on Azure Kubernetes Service
MIT License
39 stars 16 forks source link

Work with Scheduled Events for Azure Linux VMs #62

Open dgkanatsios opened 5 years ago

dgkanatsios commented 5 years ago

Azure provides an API to see if a VM will reboot for maintenance. Details for this API are listed here. You can try it this way:

kubectl run busybox --image=busybox --rm --restart=Never -it -- /bin/sh
wget -O- --header=Metadata:true http://169.254.169.254/metadata/scheduledevents?api-version=2017-08-01 # first call takes some time, it will probably return 200 and empty body
# go to the portal, manually click “reboot” on a VM
# after a while …
wget -O- --header=Metadata:true http://169.254.169.254/metadata/scheduledevents?api-version=2017-08-01
Connecting to 169.254.169.254 (169.254.169.254:80)
{"DocumentIncarnation":1,"Events":[{"EventId":"8A506C35-679A-4F78-9D76-C16DBE65EE6F","EventStatus":"Scheduled","EventType":"Reboot","ResourceType":"VirtualMachine","Resources":["aks-nodepool1-34166363-1"],"NotBefore":"Mon, 26 Nov 2018 10:52:34 GMT"}]}

Proposed design: