Delete a cluster

This page explains how to delete a node pool, a cluster, and an AzureClient resource.

Delete a node pool

To delete a cluster, you must first delete all of its node pools.

Console

  1. In the Google Cloud console, go to the Google Kubernetes Engine clusters overview page.

    Go to GKE clusters

  2. Select the Google Cloud project that the cluster is in.

  3. In the cluster list, select the name of the cluster, and then select View details in the side panel.

  4. Select the Nodes tab to see a list of all the node pools.

  5. Select a node pool from the list.

  6. Near the top of the window, click Delete.

gcloud

  1. Get a list of your node pools:

    gcloud container azure node-pools list \
      --cluster CLUSTER_NAME \
      --location GOOGLE_CLOUD_LOCATION
    

    Replace the following:

    • CLUSTER_NAME: the name of the cluster that the node pool is attached to
    • GOOGLE_CLOUD_LOCATION: the Google Cloud location hosting the node pool
  2. For each of your node pools, delete it with the following command:

    gcloud container azure node-pools delete NODE_POOL_NAME \
      --cluster CLUSTER_NAME \
      --location GOOGLE_CLOUD_LOCATION
    

    Replace the following:

    • NODE_POOL_NAME: the name of the node pool to delete
    • CLUSTER_NAME
    • GOOGLE_CLOUD_LOCATION

How GKE on Azure protects workloads during node pool deletion

During node pool deletion, GKE on Azure performs graceful shut down on each node without honoring PodDisruptionBudget. It takes the following steps:

  1. Disable cluster autoscaler if it was enabled.
  2. Set up a deadline for the draining process. After this deadline, even if there are still Pod objects existing, GKE on Azure stops draining and proceeds to deleting underlying virtual machines. The default deadline is 5 minutes. For every 10 more nodes, 5 more minutes is added.
  3. Cordon all the nodes in the node pool.
  4. Before deadline is met, delete Pod objects in the node pool with best efforts.
  5. Delete all the underlying compute resources.

Delete a cluster

Before deleting a cluster, make sure that you have deleted all of its node pools.

Console

  1. In the Google Cloud console, go to the Google Kubernetes Engine clusters overview page.

    Go to GKE clusters

  2. Select the Google Cloud project that the cluster is in.

  3. In the cluster list, select the name of the cluster, and then select View details in the side panel.

  4. Near the top of the window, click Delete.

gcloud

To delete a cluster, run the following command:

gcloud container azure clusters delete CLUSTER_NAME \
    --location GOOGLE_CLOUD_LOCATION

Replace the following:

  • CLUSTER_NAME: the name of the cluster to delete
  • GOOGLE_CLOUD_LOCATION: the Google Cloud location hosting this cluster

Delete an AzureClient resource

You should delete an AzureClient in the following cases:

  • You have removed all GKE on Azure and you don't need the AzureClient any more.
  • You have updated the cluster's Authentication from AzureClient to workload identity federation.

Note that before deleting an AzureClient, you need to have deleted all the clusters that use the AzureClient.

To delete an AzureClient resource, run the following command:

gcloud container azure clients delete CLIENT_NAME \
    --location=GOOGLE_CLOUD_LOCATION

Replace the following:

  • CLIENT_NAME: the name of the AzureClient to delete
  • GOOGLE_CLOUD_LOCATION: the Google Cloud location where the client is located

After deleting the AzureClient resource, remove the certificate at Azure AD that you uploaded when you created the client.

What's next