Skip to content

Commit 420fe4d

Browse files
authored
Merge pull request #230716 from schaffererin/start-stop-cluster
Freshness pass and addressing associated GH issues
2 parents ad909d7 + 9d8017b commit 420fe4d

File tree

1 file changed

+109
-94
lines changed

1 file changed

+109
-94
lines changed

articles/aks/start-stop-cluster.md

Lines changed: 109 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,161 @@
11
---
2-
title: Start and Stop an Azure Kubernetes Service (AKS)
3-
description: Learn how to stop or start an Azure Kubernetes Service (AKS) cluster.
2+
title: Stop and start an Azure Kubernetes Service (AKS) cluster
3+
description: Learn how to stop and start an Azure Kubernetes Service (AKS) cluster.
44
ms.topic: article
5-
ms.date: 08/09/2021
5+
ms.date: 03/14/2023
66
author: palma21
77
---
88

9-
# Stop and Start an Azure Kubernetes Service (AKS) cluster
9+
# Stop and start an Azure Kubernetes Service (AKS) cluster
1010

11-
Your AKS workloads may not need to run continuously, for example a development cluster that is used only during business hours. This leads to times where your Azure Kubernetes Service (AKS) cluster might be idle, running no more than the system components. You can reduce the cluster footprint by [scaling all the `User` node pools to 0](scale-cluster.md#scale-user-node-pools-to-0), but your [`System` pool](use-system-pools.md) is still required to run the system components while the cluster is running.
12-
To optimize your costs further during these periods, you can completely turn off (stop) your cluster. This action will stop your control plane and agent nodes altogether, allowing you to save on all the compute costs, while maintaining all your objects (except standalone pods) and cluster state stored for when you start it again. You can then pick up right where you left of after a weekend or to have your cluster running only while you run your batch jobs.
11+
You may not need to continuously run your Azure Kubernetes Service (AKS) workloads. For example, you may have a development cluster that you only use during business hours. This means there are times where your cluster might be idle, running nothing more than the system components. You can reduce the cluster footprint by [scaling all `User` node pools to 0](scale-cluster.md#scale-user-node-pools-to-0), but your [`System` pool](use-system-pools.md) is still required to run the system components while the cluster is running.
12+
13+
To better optimize your costs during these periods, you can turn off, or stop, your cluster. This action stops your control plane and agent nodes, allowing you to save on all the compute costs, while maintaining all objects except standalone pods. The cluster state is stored for when you start it again, allowing you to pick up where you left off.
1314

1415
## Before you begin
1516

16-
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][aks-quickstart-powershell], or [using the Azure portal][aks-quickstart-portal].
17+
This article assumes you have an existing AKS cluster. If you need an AKS cluster, you can create one using [Azure CLI][aks-quickstart-cli], [Azure PowerShell][aks-quickstart-powershell], or the [Azure portal][aks-quickstart-portal].
1718

18-
### Limitations
19+
### About the cluster stop/start feature
1920

20-
When using the cluster start/stop feature, the following restrictions apply:
21+
When using the cluster stop/start feature, the following conditions apply:
2122

22-
- This feature is only supported for Virtual Machine Scale Sets backed clusters.
23-
- The cluster state of a stopped AKS cluster is preserved for up to 12 months. If your cluster is stopped for more than 12 months, the cluster state cannot be recovered. For more information, see the [AKS Support Policies](support-policies.md).
24-
- You can only start or delete a stopped AKS cluster. To perform any operation like scale or upgrade, start your cluster first.
25-
- The customer provisioned PrivateEndpoints linked to private cluster need to be deleted and recreated again when you start a stopped AKS cluster.
23+
- This feature is only supported for Virtual Machine Scale Set backed clusters.
24+
- The cluster state of a stopped AKS cluster is preserved for up to 12 months. If your cluster is stopped for more than 12 months, you can't recover the state. For more information, see the [AKS support policies](support-policies.md).
25+
- You can only start or delete a stopped AKS cluster. To perform other operations, like scaling or upgrading, you need to start your cluster first.
26+
- If you provisioned PrivateEndpoints linked to private clusters, they need to be deleted and recreated again when starting a stopped AKS cluster.
2627
- Because the stop process drains all nodes, any standalone pods (i.e. pods not managed by a Deployment, StatefulSet, DaemonSet, Job, etc.) will be deleted.
28+
- When you start your cluster back up, the following behavior is expected:
29+
- The IP address of your API server may change.
30+
- If you're using cluster autoscaler, when you start your cluster, your current node count may not be between the min and max range values you set. The cluster starts with the number of nodes it needs to run its workloads, which isn't impacted by your autoscaler settings. When your cluster performs scaling operations, the min and max values will impact your current node count, and your cluster will eventually enter and remain in that desired range until you stop your cluster.
2731

28-
## Stop an AKS Cluster
32+
## Stop an AKS cluster
2933

3034
### [Azure CLI](#tab/azure-cli)
3135

32-
You can use the `az aks stop` command to stop a running AKS cluster's nodes and control plane. The following example stops a cluster named *myAKSCluster*:
36+
1. Use the [`az aks stop`][az-aks-stop] command to stop a running AKS cluster, including the nodes and control plane. The following example stops a cluster named *myAKSCluster*:
37+
38+
```azurecli-interactive
39+
az aks stop --name myAKSCluster --resource-group myResourceGroup
40+
```
41+
42+
2. Verify your cluster has stopped using the [`az aks show`][az-aks-show] command and confirming the `powerState` shows as `Stopped`.
3343
34-
```azurecli-interactive
35-
az aks stop --name myAKSCluster --resource-group myResourceGroup
36-
```
44+
```azurecli-interactive
45+
az aks show --name myAKSCluster --resource-group myResourceGroup
46+
```
3747
38-
You can verify when your cluster is stopped by using the [az aks show][az-aks-show] command and confirming the `powerState` shows as `Stopped` as on the below output:
48+
Your output should look similar to the following condensed example output:
3949
40-
```json
41-
{
42-
[...]
43-
"nodeResourceGroup": "MC_myResourceGroup_myAKSCluster_westus2",
44-
"powerState":{
45-
"code":"Stopped"
46-
},
47-
"privateFqdn": null,
48-
"provisioningState": "Succeeded",
49-
"resourceGroup": "myResourceGroup",
50-
[...]
51-
}
52-
```
50+
```json
51+
{
52+
[...]
53+
"nodeResourceGroup": "MC_myResourceGroup_myAKSCluster_westus2",
54+
"powerState":{
55+
"code":"Stopped"
56+
},
57+
"privateFqdn": null,
58+
"provisioningState": "Succeeded",
59+
"resourceGroup": "myResourceGroup",
60+
[...]
61+
}
62+
```
5363
54-
If the `provisioningState` shows `Stopping` that means your cluster hasn't fully stopped yet.
64+
If the `provisioningState` shows `Stopping`, your cluster hasn't fully stopped yet.
5565
5666
### [Azure PowerShell](#tab/azure-powershell)
5767
58-
You can use the [Stop-AzAksCluster][stop-azakscluster] cmdlet to stop a running AKS cluster's nodes and control plane. The following example stops a cluster named *myAKSCluster*:
68+
1. Use the [`Stop-AzAksCluster`][stop-azakscluster] cmdlet to stop a running AKS cluster, including the nodes and control plane. The following example stops a cluster named *myAKSCluster*:
69+
70+
```azurepowershell-interactive
71+
Stop-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup
72+
```
73+
74+
2. Verify your cluster has stopped using the [`Get-AzAksCluster`][get-azakscluster] cmdlet and confirming the `ProvisioningState` shows as `Succeeded`.
5975
60-
```azurepowershell-interactive
61-
Stop-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup
62-
```
76+
```azurepowershell-interactive
77+
Get-AzAKSCluster -Name myAKSCluster -ResourceGroupName myResourceGroup
78+
```
6379
64-
You can verify your cluster is stopped using the [Get-AzAksCluster][get-azakscluster] cmdlet and confirming the `ProvisioningState` shows as `Succeeded` as shown in the following output:
80+
Your output should look similar to the following condensed example output:
6581
66-
```Output
67-
ProvisioningState : Succeeded
68-
MaxAgentPools : 100
69-
KubernetesVersion : 1.20.7
70-
...
71-
```
82+
```Output
83+
ProvisioningState : Succeeded
84+
MaxAgentPools : 100
85+
KubernetesVersion : 1.20.7
86+
...
87+
```
7288
73-
If the `ProvisioningState` shows `Stopping` that means your cluster hasn't fully stopped yet.
89+
If the `ProvisioningState` shows `Stopping`, your cluster hasn't fully stopped yet.
7490
7591
---
7692
7793
> [!IMPORTANT]
78-
> If you are using [Pod Disruption Budgets](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/) the stop operation can take longer as the drain process will take more time to complete.
94+
> If you're using [pod disruption budgets](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/), the stop operation can take longer, as the drain process will take more time to complete.
7995
80-
## Start an AKS Cluster
96+
## Start an AKS cluster
8197
8298
> [!CAUTION]
83-
> It is important that you don't repeatedly start/stop your cluster. Repeatedly starting/stopping your cluster may result in errors. Once your cluster is stopped, you should wait 15-30 minutes before starting it up again.
99+
> Don't repeatedly stop and start your clusters. This can result in errors. Once your cluster is stopped, you should wait at least 15-30 minutes before starting it again.
84100
85101
### [Azure CLI](#tab/azure-cli)
86102
87-
You can use the `az aks start` command to start a stopped AKS cluster's nodes and control plane. The cluster is restarted with the previous control plane state and number of agent nodes.
88-
The following example starts a cluster named *myAKSCluster*:
103+
1. Use the [`az aks start`][az-aks-start] command to start a stopped AKS cluster. The cluster restarts with the previous control plane state and number of agent nodes. The following example starts a cluster named *myAKSCluster*:
89104
90-
```azurecli-interactive
91-
az aks start --name myAKSCluster --resource-group myResourceGroup
92-
```
105+
```azurecli-interactive
106+
az aks start --name myAKSCluster --resource-group myResourceGroup
107+
```
93108
94-
You can verify when your cluster has started by using the [az aks show][az-aks-show] command and confirming the `powerState` shows `Running` as on the below output:
109+
2. Verify your cluster has started using the [`az aks show`][az-aks-show] command and confirming the `powerState` shows `Running`.
95110
96-
```json
97-
{
98-
[...]
99-
"nodeResourceGroup": "MC_myResourceGroup_myAKSCluster_westus2",
100-
"powerState":{
101-
"code":"Running"
102-
},
103-
"privateFqdn": null,
104-
"provisioningState": "Succeeded",
105-
"resourceGroup": "myResourceGroup",
106-
[...]
107-
}
108-
```
111+
```azurecli-interactive
112+
az aks show --name myAKSCluster --resource-group myResourceGroup
113+
```
109114
110-
If the `provisioningState` shows `Starting` that means your cluster hasn't fully started yet.
115+
Your output should look similar to the following condensed example output:
116+
117+
```json
118+
{
119+
[...]
120+
"nodeResourceGroup": "MC_myResourceGroup_myAKSCluster_westus2",
121+
"powerState":{
122+
"code":"Running"
123+
},
124+
"privateFqdn": null,
125+
"provisioningState": "Succeeded",
126+
"resourceGroup": "myResourceGroup",
127+
[...]
128+
}
129+
```
130+
131+
If the `provisioningState` shows `Starting`, your cluster hasn't fully started yet.
111132
112133
### [Azure PowerShell](#tab/azure-powershell)
113134
114-
You can use the [Start-AzAksCluster][start-azakscluster] cmdlet to start a stopped AKS cluster's nodes and control plane. The cluster is restarted with the previous control plane state and number of agent nodes.
115-
The following example starts a cluster named *myAKSCluster*:
135+
1. Use the [`Start-AzAksCluster`][start-azakscluster] cmdlet to start a stopped AKS cluster. The cluster restarts with the previous control plane state and number of agent nodes. The following example starts a cluster named *myAKSCluster*:
116136
117-
```azurepowershell-interactive
118-
Start-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup
119-
```
137+
```azurepowershell-interactive
138+
Start-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup
139+
```
120140
121-
You can verify when your cluster has started using the [Get-AzAksCluster][get-azakscluster] cmdlet and confirming the `ProvisioningState` shows `Succeeded` as shown in the following output:
141+
2. Verify your cluster has started using the [`Get-AzAksCluster`][get-azakscluster] cmdlet and confirming the `ProvisioningState` shows `Succeeded`.
122142
123-
```Output
124-
ProvisioningState : Succeeded
125-
MaxAgentPools : 100
126-
KubernetesVersion : 1.20.7
127-
...
128-
```
143+
```azurepowershell-interactive
144+
Get-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup
145+
```
129146
130-
If the `ProvisioningState` shows `Starting` that means your cluster hasn't fully started yet.
147+
Your output should look similar to the following condensed example output:
131148
132-
---
149+
```Output
150+
ProvisioningState : Succeeded
151+
MaxAgentPools : 100
152+
KubernetesVersion : 1.20.7
153+
...
154+
```
133155
134-
> [!NOTE]
135-
> When you start your cluster back up, the following is expected behavior:
136-
>
137-
> * The IP address of your API server may change.
138-
> * If you are using cluster autoscaler, when you start your cluster back up your current node count may not be between the min and max range values you set. The cluster starts with the number of nodes it needs to run its workloads, which isn't impacted by your autoscaler settings. When your cluster performs scaling operations, the min and max values will impact your current node count and your cluster will eventually enter and remain in that desired range until you stop your cluster.
156+
If the `ProvisioningState` shows `Starting`, your cluster hasn't fully started yet.
157+
158+
---
139159
140160
## Next steps
141161
@@ -149,14 +169,9 @@ If the `ProvisioningState` shows `Starting` that means your cluster hasn't fully
149169
[aks-quickstart-cli]: ./learn/quick-kubernetes-deploy-cli.md
150170
[aks-quickstart-portal]: ./learn/quick-kubernetes-deploy-portal.md
151171
[aks-quickstart-powershell]: ./learn/quick-kubernetes-deploy-powershell.md
152-
[install-azure-cli]: /cli/azure/install-azure-cli
153-
[az-extension-add]: /cli/azure/extension#az_extension_add
154-
[az-extension-update]: /cli/azure/extension#az_extension_update
155-
[az-feature-register]: /cli/azure/feature#az_feature_register
156-
[az-feature-list]: /cli/azure/feature#az_feature_list
157-
[az-provider-register]: /cli/azure/provider#az_provider_register
158172
[az-aks-show]: /cli/azure/aks#az_aks_show
159-
[kubernetes-walkthrough-powershell]: kubernetes-walkthrough-powershell.md
160173
[stop-azakscluster]: /powershell/module/az.aks/stop-azakscluster
161174
[get-azakscluster]: /powershell/module/az.aks/get-azakscluster
162175
[start-azakscluster]: /powershell/module/az.aks/start-azakscluster
176+
[az-aks-stop]: /cli/azure/aks#az_aks_stop
177+
[az-aks-start]: /cli/azure/aks#az_aks_start

0 commit comments

Comments
 (0)