To delete a Tanzu Kubernetes Grid management cluster, run the tkg delete management-cluster command.

When you run tkg delete management-cluster, Tanzu Kubernetes Grid creates a temporary kind cleanup cluster on your bootstrap environment to manage the deletion process. The kind cluster is removed when the deletion process completes.

  1. To list all of the management clusters are running, run the tkg get management-cluster command.

    tkg get management-cluster
    

    The management cluster context that is the current focus of the Tanzu Kubernetes Grid CLI and kubectl is marked with an asterisk (*). By default, the management cluster that you deployed most recently is the focus of the Tanzu Kubernetes Grid CLI.

    +-------------------------+-------------------------------------------+
    | MANAGEMENT CLUSTER NAME | CONTEXT NAME                              |
    +-------------------------+-------------------------------------------+
    | my-cluster *            | my-cluster-admin@my-cluster               |
    | my-other-cluster        | my-other-cluster-admin@my-other-cluster   |    
    +-------------------------+-------------------------------------------+
    
  2. If there are management clusters that you no longer require, run tkg delete management-cluster.

    IMPORTANT: The tkg delete management-cluster command deletes the management cluster that is the current focus of the Tanzu Kubernetes Grid CLI. Make sure that you are connected to the correct management cluster by running tkg set management-cluster <cluster-name> before you run tkg delete management-cluster.

    tkg delete management-cluster
    

    To skip the yes/no verification step when you run tkg delete management-cluster, specify the --yes option.

    tkg delete management-cluster --yes
    
  3. If there are Tanzu Kubernetes clusters running in the management cluster, the delete operation is not performed.

    In this case, you can delete the management cluster in two ways:

    • Run tkg delete cluster to delete all of the running clusters and then run tkg delete management-cluster again.
    • Run tkg delete management-cluster with the --force option.
    tkg delete management-cluster --force
    

IMPORTANT: Do not change context or edit the kubeconfig file while Tanzu Kubernetes Grid operations are running.

check-circle-line exclamation-circle-line close-line
Scroll to top icon