Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restart VMs in scale set in AKS Node Pool

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?

like image 592
Batman22 Avatar asked Nov 30 '25 08:11

Batman22


1 Answers

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.

like image 57
Charles Xu Avatar answered Dec 01 '25 20:12

Charles Xu