Skip to content

Commit a577e21

Browse files
authored
Merge pull request #177553 from qpetraroia/start-stop-nodepools
node pool start/stop docs
2 parents 76e6c28 + 60c3f87 commit a577e21

File tree

2 files changed

+143
-0
lines changed

2 files changed

+143
-0
lines changed

articles/aks/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@
192192
href: use-system-pools.md
193193
- name: Use WebAssembly System Interface (WASI) node pools
194194
href: use-wasi-node-pools.md
195+
- name: Start/stop node pools (preview)
196+
href: start-stop-nodepools.md
195197
- name: Deploy AKS with Terraform
196198
href: /azure/developer/terraform/create-k8s-cluster-with-tf-and-aks
197199
maintainContext: true

articles/aks/start-stop-nodepools.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
title: Start and stop a node pool on Azure Kubernetes Service (AKS) (Preview)
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 (Preview)
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+
[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)]
22+
23+
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.
24+
25+
```azurecli-interactive
26+
# Install the aks-preview extension
27+
az extension add --name aks-preview
28+
29+
# Update the extension to make sure you have the latest version installed
30+
az extension update --name aks-preview
31+
```
32+
33+
### Register the `PreviewStartStopAgentPool` preview feature
34+
35+
To use the feature, you must also enable the `PreviewStartStopAgentPool` feature flag on your subscription.
36+
37+
Register the `PreviewStartStopAgentPool` feature flag by using the [az feature register][az-feature-register] command, as shown in the following example:
38+
39+
```azurecli-interactive
40+
az feature register --namespace "Microsoft.ContainerService" --name "PreviewStartStopAgentPool"
41+
```
42+
43+
It takes a few minutes for the status to show *Registered*. Verify the registration status by using the [az feature list][az-feature-list] command:
44+
45+
```azurecli-interactive
46+
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/PreviewStartStopAgentPool')].{Name:name,State:properties.state}"
47+
```
48+
49+
When ready, refresh the registration of the *Microsoft.ContainerService* resource provider by using the [az provider register][az-provider-register] command:
50+
51+
```azurecli-interactive
52+
az provider register --namespace Microsoft.ContainerService
53+
```
54+
55+
## Stop an AKS node pool
56+
57+
> [!IMPORTANT]
58+
> When using node pool start/stop, the following is expected behavior:
59+
>
60+
> * You can't stop system pools.
61+
> * Spot node pools are supported.
62+
> * Stopped node pools can be upgraded.
63+
> * The cluster and node pool must be running.
64+
65+
Use `az aks nodepool stop` to stop a running AKS node pool. The following example stops the *testnodepool* node pool:
66+
67+
```azurecli-interactive
68+
az aks nodepool stop --nodepool-name testnodepool --resource-group myResourceGroup --cluster-name myAKSCluster
69+
```
70+
71+
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:
72+
73+
```json
74+
{
75+
[...]
76+
"osType": "Linux",
77+
"podSubnetId": null,
78+
"powerState": {
79+
"code": "Stopped"
80+
},
81+
"provisioningState": "Succeeded",
82+
"proximityPlacementGroupId": null,
83+
[...]
84+
}
85+
```
86+
87+
> [!NOTE]
88+
> If the `provisioningState` shows `Stopping`, your node pool hasn't fully stopped yet.
89+
90+
## Start a stopped AKS node pool
91+
92+
Use `az aks nodepool start` to start a stopped AKS node pool. The following example starts the stopped node pool named *testnodepool*:
93+
94+
```azurecli-interactive
95+
az aks nodepool start --nodepool-name testnodepool --resource-group myResourceGroup --cluster-name myAKSCluster
96+
```
97+
98+
You can verify your node pool has started using [az aks show][az-aks-show] and confirming the `powerState` shows `Running`. For example:
99+
100+
```json
101+
{
102+
[...]
103+
"osType": "Linux",
104+
"podSubnetId": null,
105+
"powerState": {
106+
"code": "Running"
107+
},
108+
"provisioningState": "Succeeded",
109+
"proximityPlacementGroupId": null,
110+
[...]
111+
}
112+
```
113+
114+
> [!NOTE]
115+
> If the `provisioningState` shows `Starting`, your node pool hasn't fully started yet.
116+
117+
---
118+
119+
## Next steps
120+
121+
- To learn how to scale `User` pools to 0, see [Scale `User` pools to 0](scale-cluster.md#scale-user-node-pools-to-0).
122+
- To learn how to stop your cluster, see [Cluster start/stop](start-stop-cluster.md).
123+
- To learn how to save costs using Spot instances, see [Add a spot node pool to AKS](spot-node-pool.md).
124+
- To learn more about the AKS support policies, see [AKS support policies](support-policies.md).
125+
126+
<!-- LINKS - external -->
127+
128+
<!-- LINKS - internal -->
129+
[aks-quickstart-cli]: kubernetes-walkthrough.md
130+
[aks-quickstart-portal]: kubernetes-walkthrough-portal.md
131+
[install-azure-cli]: /cli/azure/install-azure-cli
132+
[az-extension-add]: /cli/azure/extension#az_extension_add
133+
[az-extension-update]: /cli/azure/extension#az_extension_update
134+
[az-feature-register]: /cli/azure/feature#az_feature_register
135+
[az-feature-list]: /cli/azure/feature#az_feature_list
136+
[az-provider-register]: /cli/azure/provider#az_provider_register
137+
[az-aks-show]: /cli/azure/aks#az_aks_show
138+
[kubernetes-walkthrough-powershell]: kubernetes-walkthrough-powershell.md
139+
[stop-azakscluster]: /powershell/module/az.aks/stop-azakscluster
140+
[get-azakscluster]: /powershell/module/az.aks/get-azakscluster
141+
[start-azakscluster]: /powershell/module/az.aks/start-azakscluster

0 commit comments

Comments
 (0)