Delete a Kubernetes cluster

Kubernetes cluster deletion unregisters the cluster from the Google Distributed Cloud (GDC) air-gapped instance and deletes the workloads, node pools, control plane nodes, and corresponding resources.

Before you begin

To get the permissions needed to delete a Kubernetes cluster, ask your Organization IAM Admin to grant you the User Cluster Admin role (user-cluster-admin). This role is not bound to a namespace.

Delete a Kubernetes cluster and its resources

Complete the following steps to delete a Kubernetes cluster and its resources:

Console

  1. In the navigation menu, select Kubernetes Engine > Clusters.

  2. In the cluster list, click the cluster that you want to delete.

  3. Click delete Delete Cluster.

  4. When prompted, type the given confirmation phrase and click Delete to delete the cluster.

API

  • To delete a Kubernetes cluster, remove the Cluster custom resource from the GDC instance:

    kubectl delete clusters.cluster.gdc.goog/KUBERNETES_CLUSTER_NAME -n platform \
        --kubeconfig MANAGEMENT_API_SERVER
    

    Replace the following:

    • KUBERNETES_CLUSTER_NAME: The name of the cluster to delete.
    • MANAGEMENT_API_SERVER: The zonal API server's kubeconfig path where the Kubernetes cluster is hosted. If you have not yet generated a kubeconfig file for the API server in your targeted zone, see Sign in for details.

Terraform

  • To delete a Kubernetes cluster using Terraform, run:

    terraform destroy -target kubernetes_manifest.cluster-create