I have a kubernetes cluster with node pools and as a part of Chaos Engineering Initiative,I need to restart the VM. Is there any code for the same using azure resource graph?
When the AKS nodes is a scale set. Then you need to find the node resource group, the scale set name, and the instance-id that you want to restart. And then restart the instance. Here are the CLI commands:
# get the AKS node resource group name
az aks show -g groupName -n aksName --query nodeResourceGroup
# get the scale set info and all the instance id
az vmss list -g nodeGroupName --query [].name
az vmss list-instances -g nodeGroupName -n vmssName -o table
# restart the instance with the instance Id
az vmss restart -g nodeGroupName -n vmssName --instance-ids n
If you do it in the Azure portal, the same steps but it's easier to achieve.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With