Clean Up Kubernetes Cluster¶
This guide will walk you through purging an existing Kubernetes cluster.
Note
If you have already cleaned up your Kubernetes cluster, you may proceed to the Verify section.
Note
By following these instructions you will lose all Rok volumes residing on these nodes. However, you can restore them from the most recent Rok snapshots later on. See the Scale In Kubernetes Cluster section for more information.
Overview
What You'll Need¶
- A configured management environment.
- An existing Kubernetes cluster.
Procedure¶
Choose one of the following options, based on your cloud provider.
Delete the node groups of your cluster:
root@rok-tools:~# aws eks list-nodegroups --cluster-name ${EKS_CLUSTER?} | \ > jq -r '.nodegroups[]' | \ > xargs -r -n1 aws eks delete-nodegroup --cluster-name ${EKS_CLUSTER?} --nod
Delete the Kubernetes cluster:
root@rok-tools:~# aws eks delete-cluster --name ${EKS_CLUSTER?}
List the user node pools of your AKS cluster:
root@rok-tools:~# az aks nodepool list --cluster-name ${AKS_CLUSTER?} \ > --resource-group ${AZ_RESOURCE_GROUP?} \ > --query "[?mode=='User'].{name:name}" \ > --output tsv The behavior of this command has been altered by the following extension: aks-preview workers
Delete all node pools in the list above. To do that, repeat the following steps for each one of the node pools in the list.
Pick a node pool from the list:
root@rok-tools:~# export NODEPOOL=<NODEPOOL>
Delete the node pool:
root@rok-tools:~# az aks nodepool delete \ > --resource-group ${AZ_RESOURCE_GROUP?} \ > --cluster-name ${AKS_CLUSTER?} \ > --name ${NODEPOOL?}
Go back to step 1, and repeat the steps for the remaining node pools.
Delete the AKS cluster:
root@rok-tools:~# az aks delete --name ${AKS_CLUSTER?} \ > --resource-group ${AZ_RESOURCE_GROUP?} --yes
Verify¶
Choose one of the following options, based on your cloud provider.
Attempt to retrieve your cluster and verify it does not exist:
root@rok-tools:~# aws eks describe-cluster --name ${EKS_CLUSTER?} An error occurred (ResourceNotFoundException) when calling the DescribeCluster operation: No cluster found for name: arrikto-cluster.
Attempt to retrieve your AKS cluster and verify it does not exist:
root@rok-tools:~# az aks show --resource-group ${AZ_RESOURCE_GROUP?} \ > --name ${AKS_CLUSTER?} The behavior of this command has been altered by the following extension: aks-preview (ResourceNotFound) The Resource 'Microsoft.ContainerService/managedClusters/arrikto-cluster' under resource group 'arrikto' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Summary¶
You have successfully deleted your Kubernetes cluster.