In this article, we will learn how to stop and start Azure Kubernetes Service(AKS) clusters. You can stop your entire Azure Kubernetes Service cluster to save costs. To follow along, you will need an existing Azure Kubernetes service that is running.
To use start and stop for AKS, we need the AKS preview extension for the Azure CLI. It can be installed using the below command:
extension add --name aks-preview
Let’s make sure that we have the latest version of that using the below command:
az extension update --name aks-preview
Next, we need to register the start/stop preview feature using the below command:
az feature register --namespace "Microsoft.ContainereService" --name "StartStopPreview"
This can take a while. After a couple of minutes, check if the feature is registered with the below command:
az feature list -o table --query
Now we need to refresh the container resource provider using the below command:
az provider register --namespace Microsoft.ContainerService
That’s all the preview stuff out of the way. Now, it could be that you don’t need to do all of this when this feature is generally available.
Let’s stop our AKS cluster with the below command:
az aks stop --name YOUR_CLUSTE_NAME --resource-group YOUR_RESOURCE_GROUP
It’s as simple as that. This will result in something like below if we use the below command:
az aks show
The power state is stopped, so the cluster is stopped.
We can just as easily start it up again using the below command:
az aks start --name YOUR_CLUSTE_NAME --resource-group YOUR_RESOURCE_GROUP
We’ll use AKS show to check if it is running as shown below:
Stopping an Azure Kubernetes Service cluster is a great way to save money. You can easily start and stop AKS with an Azure CLI command, which you can, for instance, automate to stop when this surface isn’t used and start during business hours.
Share your thoughts in the comments
Please Login to comment...