You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
4
ms.topic: article
5
-
ms.date: 08/09/2021
5
+
ms.date: 03/14/2023
6
6
author: palma21
7
7
---
8
8
9
-
# Stop and Start an Azure Kubernetes Service (AKS) cluster
9
+
# Stop and start an Azure Kubernetes Service (AKS) cluster
10
10
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.
13
14
14
15
## Before you begin
15
16
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].
17
18
18
-
### Limitations
19
+
### About the cluster stop/start feature
19
20
20
-
When using the cluster start/stop feature, the following restrictions apply:
21
+
When using the cluster stop/start feature, the following conditions apply:
21
22
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.
26
27
- 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.
27
31
28
-
## Stop an AKS Cluster
32
+
## Stop an AKS cluster
29
33
30
34
### [Azure CLI](#tab/azure-cli)
31
35
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`.
33
43
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
+
```
37
47
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:
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.
55
65
56
66
### [Azure PowerShell](#tab/azure-powershell)
57
67
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*:
2. Verify your cluster has stopped using the [`Get-AzAksCluster`][get-azakscluster] cmdlet and confirming the `ProvisioningState` shows as `Succeeded`.
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:
65
81
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
+
```
72
88
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.
74
90
75
91
---
76
92
77
93
> [!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.
79
95
80
-
## Start an AKS Cluster
96
+
## Start an AKS cluster
81
97
82
98
> [!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.
84
100
85
101
### [Azure CLI](#tab/azure-cli)
86
102
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*:
89
104
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
+
```
93
108
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`.
If the `provisioningState` shows `Starting`, your cluster hasn't fully started yet.
111
132
112
133
### [Azure PowerShell](#tab/azure-powershell)
113
134
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*:
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`.
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:
131
148
132
-
---
149
+
```Output
150
+
ProvisioningState : Succeeded
151
+
MaxAgentPools : 100
152
+
KubernetesVersion : 1.20.7
153
+
...
154
+
```
133
155
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
+
---
139
159
140
160
## Next steps
141
161
@@ -149,14 +169,9 @@ If the `ProvisioningState` shows `Starting` that means your cluster hasn't fully
0 commit comments