Start and stop an Azure Kubernetes Service (AKS) node pool (Preview)

Your AKS workloads may not need to run continuously, for example a development cluster that has node pools running specific workloads. To optimize your costs, you can completely turn off (stop) your node pools in your AKS cluster, allowing you to save on compute costs.

Before you begin

This article assumes that you have an existing AKS cluster. If you need an AKS cluster, see the AKS quickstart using the Azure CLI, using Azure PowerShell, or using the Azure portal.

Install aks-preview CLI extension

Important

AKS preview features are available on a self-service, opt-in basis. Previews are provided "as is" and "as available," and they're excluded from the service-level agreements and limited warranty. AKS previews are partially covered by customer support on a best-effort basis. As such, these features aren't meant for production use. For more information, see the following support articles:

You also need the aks-preview Azure CLI extension. Install the aks-preview Azure CLI extension by using the az extension add command. Or install any available updates by using the az extension update command.

# Install the aks-preview extension
az extension add --name aks-preview

# Update the extension to make sure you have the latest version installed
az extension update --name aks-preview

Register the PreviewStartStopAgentPool preview feature

To use the feature, you must also enable the PreviewStartStopAgentPool feature flag on your subscription.

Register the PreviewStartStopAgentPool feature flag by using the az feature register command, as shown in the following example:

az feature register --namespace "Microsoft.ContainerService" --name "PreviewStartStopAgentPool"

It takes a few minutes for the status to show Registered. Verify the registration status by using the az feature list command:

az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/PreviewStartStopAgentPool')].{Name:name,State:properties.state}"

When ready, refresh the registration of the Microsoft.ContainerService resource provider by using the az provider register command:

az provider register --namespace Microsoft.ContainerService

Stop an AKS node pool

Important

When using node pool start/stop, the following is expected behavior:

  • You can't stop system pools.
  • Spot node pools are supported.
  • Stopped node pools can be upgraded.
  • The cluster and node pool must be running.

Use az aks nodepool stop to stop a running AKS node pool. The following example stops the testnodepool node pool:

az aks nodepool stop --nodepool-name testnodepool --resource-group myResourceGroup --cluster-name myAKSCluster

You can verify when your node pool is stopped by using the az aks show command and confirming the powerState shows as Stopped as on the below output:

{
[...]
 "osType": "Linux",
    "podSubnetId": null,
    "powerState": {
        "code": "Stopped"
        },
    "provisioningState": "Succeeded",
    "proximityPlacementGroupId": null,
[...]
}

Note

If the provisioningState shows Stopping, your node pool hasn't fully stopped yet.

Start a stopped AKS node pool

Use az aks nodepool start to start a stopped AKS node pool. The following example starts the stopped node pool named testnodepool:

az aks nodepool start --nodepool-name testnodepool --resource-group myResourceGroup --cluster-name myAKSCluster

You can verify your node pool has started using az aks show and confirming the powerState shows Running. For example:

{
[...]
 "osType": "Linux",
    "podSubnetId": null,
    "powerState": {
        "code": "Running"
        },
    "provisioningState": "Succeeded",
    "proximityPlacementGroupId": null,
[...]
}

Note

If the provisioningState shows Starting, your node pool hasn't fully started yet.


Next steps