Stop all compute in AKS (Azure Managed Kubernetes)

Dan O'Leary picture Dan O'Leary · Jan 21, 2018 · Viewed 13.7k times · Source

I have created a managed Kubernetes cluster in Azure, but it's only for learning purposes and so I only want to pay for the compute whilst I'm actually using it.

Is there a easy way to gracefully shut down and start up the VMs, availablity sets and load balancers?

Answer

officer picture officer · Aug 31, 2018

You could use Azure CLI to stop the virtual machines via Powershell:

az vm deallocate --ids $(az vm list -g MC_my_resourcegroup_westeurope --query "[].id" -o tsv)

Replace MC_my_resourcegroup_westeurope with the name of your resource group that contains the VM(s).

When you want to start the VM(s) again, run:

az vm start --ids $(az vm list -g MC_my_resourcegroup_westeurope --query "[].id" -o tsv)