Tanzu Community Edition


Delete Workload Clusters

To delete a workload cluster, run the tanzu cluster delete command.

  1. To list all of the workload clusters that a management cluster is managing, run the tanzu cluster list command.

    tanzu cluster list
  2. (Optional) Depending on the cluster contents and cloud infrastructure, you may need to delete in-cluster volumes and services before you delete the workload cluster. For more information, see the following sections below:

    Delete in-cluster volumes and services

    Delete Service Type LoadBalancer

    Delete Persistent Volume Claims and Persistent Volumes

  3. To delete a workload cluster, run:

    tanzu cluster delete <WORKLOAD-CLUSTER>

    If the cluster is running in a namespace other than the default namespace, you must specify the --namespace option to delete that cluster.

    tanzu cluster delete my-cluster --namespace=my-namespace

Delete in-cluster volumes and services

If the cluster you want to delete contains persistent volumes or services such as load balancers and databases, you may need to manually delete them before you delete the cluster itself. What you need to pre-delete depends on your cloud infrastructure:

Delete Service Type LoadBalancer

To delete Service type LoadBalancer (Service) in a cluster:

  1. Set kubectl to the cluster’s context.

    kubectl config set-context my-cluster@user
  2. Retrieve the cluster’s list of services.

    kubectl get service
  3. Delete each Service type LoadBalancer.

    kubectl delete service <my-svc>

Delete Persistent Volume (PV) and Persistent Volume Claim (PVC) objects in a cluster

  1. Run kubectl config set-context my-cluster@user to set kubectl to the cluster’s context.

  2. Run kubectl get pvc to retrieve the cluster’s Persistent Volume Claims (PVCs).

  3. For each PVC:

    1. To identify the PV it is bound to, run the following command, the PV is listed in the command output as Volume, after Status: Bound:

      kubectl describe pvc <my-pvc>
    2. To determine if its bound PV Reclaim Policy is Retain or Delete, run.

      kubectl describe pv <my-pv>
    3. To delete the PVC, run:

      kubectl delete pvc <my-pvc>
    4. If the PV reclaim policy is Retain, run the following command and then log into your cloud portal and delete the PV object there:

      kubectl delete pv <my-pvc>

IMPORTANT: Do not change context or edit the .kube-tkg/config file while Tanzu operations are running.

Join us!

Our open community welcomes all users and contributors