This topic describes how to delete a Kubernetes cluster deployed by VMware Tanzu Kubernetes Grid Integrated Edition (TKGI).



Overview

Run the tkgi delete-cluster command to delete a TKGI-provisioned Kubernetes cluster and all cluster objects.

To delete a cluster:

  1. Delete Cluster.
  2. Verify Cluster Deletion.

If you are using TKGI with NSX, see vSphere with NSX-T Cluster Objects for a list of vSphere and NSX objects that will be deleted as part of the cluster deletion process.



Delete Cluster

You can delete a cluster using the TKGI CLI.

To avoid an incomplete deletion, prepare the cluster for deletion before deleting it:

  1. If the cluster is configured with a PodDisruptionBudget (PDB), remove the PDB from the cluster.
  2. Remove all static and dynamic PVCs from the cluster.
  3. Remove all PVs with a reclaimPolicy of Retain from the cluster.
  4. If you are deleting a cluster that uses a public cloud CSI driver, see Limitations on Using a Public Cloud CSI Driver in Release Notes for additional requirements.

    Note: Before deleting a cluster, remove the PVs and PVCs from the cluster to avoid making orphan disks of the cluster’s attached disks.


To delete a cluster:

  1. On the command line, run the following command to log in:

    tkgi login -a TKGI-API -u USERNAME -k
    

    Where:

    • TKGI-API is the domain name for the TKGI API that you entered in Ops Manager > Tanzu Kubernetes Grid Integrated Edition > TKGI API > API Hostname (FQDN). For example, api.tkgi.example.com.
    • USERNAME is your user name.

      See Logging in to Tanzu Kubernetes Grid Integrated Edition for more information about the tkgi login command.

      Note: If your operator has configured Tanzu Kubernetes Grid Integrated Edition to use a SAML identity provider, you must include an additional SSO flag to use the above command. For information about the SSO flags, see the section for the above command in TKGI CLI. For information about configuring SAML, see Connecting Tanzu Kubernetes Grid Integrated Edition to a SAML Identity Provider

  2. Run tkgi delete-cluster CLUSTER-NAME to delete a cluster. Replace CLUSTER-NAME with the unique name for your cluster.

    For example:

    $ tkgi delete-cluster my-cluster
    
  3. Confirm cluster deletion by entering y, or cancel cluster deletion by entering n.

    For example:

    Are you sure you want to delete cluster my-cluster? (y/n)
    



Verify Cluster Deletion

To verify cluster deletion using the TKGI CLI:

  1. To verify cluster deletion, run tkgi cluster CLUSTER-NAME. Replace CLUSTER-NAME with the unique name for your cluster.

    For example:

    $ tkgi cluster my-cluster  
    Name:                     my-cluster  
    Plan Name:                small  
    UUID:                     106aabc7-5ecb-4c54-a800-a32eef57a593  
    Last Action:              DELETE  
    Last Action State:        in progress  
    Last Action Description:  Instance deletion in progress  
    Kubernetes Master Host:   my-cluster.tkgi.local  
    Kubernetes Master Port:   8443  
    Worker Nodes:             3  
    Kubernetes Master IP(s):  10.196.219.88  
    Network Profile Name:  
    

    While Tanzu Kubernetes Grid Integrated Edition is deleting the cluster, the value for Last Action Description is Instance deletion in progress.

  2. Continue running the tkgi cluster CLUSTER-NAME command to track cluster deletion. The cluster is deleted when the CLI returns Error: Cluster CLUSTER-NAME not found.

  3. Run tkgi clusters. Confirm the cluster you deleted is not included in the list of Tanzu Kubernetes Grid Integrated Edition clusters.

    Note: If the cluster is not deleted, see Cluster Deletion Fails in Troubleshooting.



Delete Cluster without Prompt

If you do not want the TKGI CLI to prompt you to confirm cluster deletion, use the --non-interactive flag.

For example:

$ tkgi delete-cluster my-cluster --non-interactive

Note: If you use the –non-interactive flag to delete multiple clusters, delete each cluster one by one. Do not create a script that deletes multiple clusters using the –non-interactive flag. If you do, the BOSH Director might hang and become unusable until you log in to BOSH and cancel each deletion task.

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