|
| 1 | +--- |
| 2 | +title: Delete an Azure Kubernetes Service (AKS) cluster |
| 3 | +description: Learn about deleting a cluster in Azure Kubernetes Service (AKS). |
| 4 | +ms.topic: overview |
| 5 | +ms.author: schaffererin |
| 6 | +author: schaffererin |
| 7 | +ms.date: 04/16/2024 |
| 8 | +--- |
| 9 | + |
| 10 | +# Delete an Azure Kubernetes Service (AKS) cluster |
| 11 | + |
| 12 | +This article outlines cluster deletion in Azure Kubernetes Service (AKS), including what happens when you delete a cluster, alternatives to deleting a cluster, and how to delete a cluster. |
| 13 | + |
| 14 | +## What happens when you delete a cluster? |
| 15 | + |
| 16 | +When you delete a cluster, the following resources are deleted: |
| 17 | + |
| 18 | +* The [node resource group][node-resource-group] and its resources, including: |
| 19 | + * The virtual machine scale sets and virtual machines (VMs) for each node in the cluster |
| 20 | + * The virtual network and its subnets for the cluster |
| 21 | + * The storage for the cluster |
| 22 | +* The control plane and its resources |
| 23 | +* Any node instances in the cluster along with any pods running on those nodes |
| 24 | + |
| 25 | +## Alternatives to deleting a cluster |
| 26 | + |
| 27 | +Before you delete a cluster, consider **stopping the cluster**. Stopping an AKS cluster stops the control plane and agent nodes, allowing you to save on compute costs while maintaining all objects except standalone pods. When you stop a cluster, its state is saved and you can restart the cluster at any time. For more information, see [Stop an AKS cluster][stop-cluster]. |
| 28 | + |
| 29 | +If you want to delete a cluster to change its configuration, you can instead use the [AKS cluster upgrade][upgrade-cluster] feature to upgrade the cluster to a different Kubernetes version or change the node pool configuration. For more information, see [Upgrade an AKS cluster][upgrade-cluster]. |
| 30 | + |
| 31 | +## Delete a cluster |
| 32 | + |
| 33 | +> [!IMPORTANT] |
| 34 | +> **You can't recover a cluster after it's deleted**. If you need to recover a cluster, you need to create a new cluster and redeploy your applications. |
| 35 | +### [Azure CLI](#tab/azure-cli) |
| 36 | + |
| 37 | +Delete a cluster using the [`az aks delete`][az-aks-delete] command. The following example deletes the `myAKSCluster` cluster in the `myResourceGroup` resource group: |
| 38 | + |
| 39 | +```azurecli-interactive |
| 40 | +az aks delete --name myAKSCluster --resource-group myResourceGroup |
| 41 | +``` |
| 42 | + |
| 43 | +### [Azure PowerShell](#tab/azure-powershell) |
| 44 | + |
| 45 | +Delete a cluster using the [`Remove-AzAks`][remove-azaks] command. The following example deletes the `myAKSCluster` cluster in the `myResourceGroup` resource group: |
| 46 | + |
| 47 | +```azurepowershell-interactive |
| 48 | +Remove-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup |
| 49 | +``` |
| 50 | + |
| 51 | +### [Azure portal](#tab/azure-portal) |
| 52 | + |
| 53 | +You can delete a cluster using the Azure portal. To delete a cluster, navigate to the **Overview** page for the cluster and select **Delete**. You can also delete a cluster from the **Resource group** page by selecting the cluster and then selecting **Delete**. |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## Next steps |
| 58 | + |
| 59 | +For more information about AKS, see [Core Kubernetes concepts for AKS][core-concepts]. |
| 60 | + |
| 61 | +<!-- LINKS --> |
| 62 | +[node-resource-group]: ./concepts-clusters-workloads.md#node-resource-group |
| 63 | +[stop-cluster]: ./start-stop-cluster.md |
| 64 | +[upgrade-cluster]: ./upgrade-cluster.md |
| 65 | +[az-aks-delete]: /cli/azure/aks#az_aks_delete |
| 66 | +[remove-azaks]: /powershell/module/az.aks/remove-azakscluster |
| 67 | +[core-concepts]: ./concepts-clusters-workloads.md |
0 commit comments