|
| 1 | +--- |
| 2 | +title: Start and Stop a node pool on Azure Kubernetes Service (AKS) |
| 3 | +description: Learn how to start or stop a node pool on Azure Kubernetes Service (AKS). |
| 4 | +services: container-service |
| 5 | +ms.topic: article |
| 6 | +ms.date: 10/25/2021 |
| 7 | +author: qpetraroia |
| 8 | +ms.author: qpetraroia |
| 9 | +--- |
| 10 | + |
| 11 | +# Start and Stop an Azure Kubernetes Service (AKS) node pool |
| 12 | + |
| 13 | +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. |
| 14 | + |
| 15 | +## Before you begin |
| 16 | + |
| 17 | +This article assumes that you have an existing AKS cluster. If you need an AKS cluster, see the AKS quickstart [using the Azure CLI][aks-quickstart-cli], [using Azure PowerShell][kubernetes-walkthrough-powershell], or [using the Azure portal][aks-quickstart-portal]. |
| 18 | + |
| 19 | +### Install aks-preview CLI extension |
| 20 | + |
| 21 | +You also need the *aks-preview* Azure CLI extension. Install the *aks-preview* Azure CLI extension by using the [az extension add][az-extension-add] command. Or install any available updates by using the [az extension update][az-extension-update] command. |
| 22 | + |
| 23 | +```azurecli-interactive |
| 24 | +# Install the aks-preview extension |
| 25 | +az extension add --name aks-preview |
| 26 | +
|
| 27 | +# Update the extension to make sure you have the latest version installed |
| 28 | +az extension update --name aks-preview |
| 29 | +
|
| 30 | +# Register `node pool start/stop` for use |
| 31 | +az feature register --namespace "Microsoft.ContainerService" --name "PreviewStartStopAgentPool" |
| 32 | +``` |
| 33 | + |
| 34 | +> [!NOTE] |
| 35 | +> When using node pool start/stop, the following is expected behavior: |
| 36 | +> |
| 37 | +> * You can not stop system pools. |
| 38 | +> * spot node pools are supported. |
| 39 | +> * Stopped node pools can be upgraded. |
| 40 | +
|
| 41 | +## Stop an AKS node pool |
| 42 | + |
| 43 | +### [Azure CLI](#tab/azure-cli) |
| 44 | + |
| 45 | +You can use the `az aks nodepool stop` command to stop a running AKS node pool. To properly stop a node pool, you must make sure that the cluster is currently running and you are not stopping a system pool. The following example stops a cluster named *testnodepool*: |
| 46 | + |
| 47 | +```azurecli-interactive |
| 48 | +az aks nodepool stop --nodepool-name testnodepool -resource-group myResourceGroup --cluster-name myAKSCluster |
| 49 | +``` |
| 50 | + |
| 51 | +You can verify when your node pool is stopped by using the [az aks show][az-aks-show] command and confirming the `powerState` shows as `Stopped` as on the below output: |
| 52 | + |
| 53 | +```json |
| 54 | +{ |
| 55 | +[...] |
| 56 | + "osType": "Linux", |
| 57 | + "podSubnetId": null, |
| 58 | + "powerState": { |
| 59 | + "code": "Stopped" |
| 60 | + }, |
| 61 | + "provisioningState": "Succeeded", |
| 62 | + "proximityPlacementGroupId": null, |
| 63 | +[...] |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +If the `provisioningState` shows `Stopping` that means your node pool hasn't fully stopped yet. |
| 68 | + |
| 69 | +## Start an AKS node pool |
| 70 | + |
| 71 | +### [Azure CLI](#tab/azure-cli) |
| 72 | + |
| 73 | +You can use the `az aks nodepool start` command to start a stopped AKS node pool. The following example starts a node pool named *testnodepool*: |
| 74 | + |
| 75 | +```azurecli-interactive |
| 76 | +az aks nodepool start --nodepool-name testnodepool -resource-group myResourceGroup --cluster-name myAKSCluster |
| 77 | +``` |
| 78 | + |
| 79 | +You can verify when your node pool has started by using the [az aks show][az-aks-show] command and confirming the `powerState` shows `Running` as on the below output: |
| 80 | + |
| 81 | +```json |
| 82 | +{ |
| 83 | +[...] |
| 84 | + "osType": "Linux", |
| 85 | + "podSubnetId": null, |
| 86 | + "powerState": { |
| 87 | + "code": "Running" |
| 88 | + }, |
| 89 | + "provisioningState": "Succeeded", |
| 90 | + "proximityPlacementGroupId": null, |
| 91 | +[...] |
| 92 | +} |
| 93 | +``` |
| 94 | + |
| 95 | +If the `provisioningState` shows `Starting` that means your node pool hasn't fully started yet. |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## Next steps |
| 100 | + |
| 101 | +- To learn how to scale `User` pools to 0, see [Scale `User` pools to 0](scale-cluster.md#scale-user-node-pools-to-0). |
| 102 | +- To learn how to stop your cluster, see [Cluster start/stop](start-stop-cluster.md). |
| 103 | +- To learn how to save costs using Spot instances, see [Add a spot node pool to AKS](spot-node-pool.md). |
| 104 | +- To learn more about the AKS support policies, see [AKS support policies](support-policies.md). |
| 105 | + |
| 106 | +<!-- LINKS - external --> |
| 107 | + |
| 108 | +<!-- LINKS - internal --> |
| 109 | +[aks-quickstart-cli]: kubernetes-walkthrough.md |
| 110 | +[aks-quickstart-portal]: kubernetes-walkthrough-portal.md |
| 111 | +[install-azure-cli]: /cli/azure/install-azure-cli |
| 112 | +[az-extension-add]: /cli/azure/extension#az_extension_add |
| 113 | +[az-extension-update]: /cli/azure/extension#az_extension_update |
| 114 | +[az-feature-register]: /cli/azure/feature#az_feature_register |
| 115 | +[az-feature-list]: /cli/azure/feature#az_feature_list |
| 116 | +[az-provider-register]: /cli/azure/provider#az_provider_register |
| 117 | +[az-aks-show]: /cli/azure/aks#az_aks_show |
| 118 | +[kubernetes-walkthrough-powershell]: kubernetes-walkthrough-powershell.md |
| 119 | +[stop-azakscluster]: /powershell/module/az.aks/stop-azakscluster |
| 120 | +[get-azakscluster]: /powershell/module/az.aks/get-azakscluster |
| 121 | +[start-azakscluster]: /powershell/module/az.aks/start-azakscluster |
0 commit comments