Detach a managed cluster

Remove a self-managed cluster that you no longer want to manage with Tanzu Platform for Kubernetes.

Before you begin

This procedure assumes that you have added a self-managed cluster.

Make sure you have the appropriate permissions to detach a cluster.

Depending on your chosen approach, make sure you have done one of the following:

Detach a self-managed cluster

You can remove a self-managed cluster from Tanzu Platform using either the hub or the Tanzu CLI.

Tanzu Platform hub
Perform the following steps in Tanzu Platform hub:
  1. In Tanzu Platform hub, select the project that contains the cluster you want to remove.
  2. In the left navigation pane, click to expand Infrastructure, and then click Kubernetes Clusters.
  3. On the Cluster Groups tab of the Kubernetes Clusters page, click the cluster group that contains the cluster you want to remove.
  4. In the list of clusters on the cluster group detail page, locate the cluster you want to remove.
  5. Click to select the cluster, and then click Detach.
  6. In the confirmation dialog, select the method you want to use for removing the cluster.

    • Select Detach and remove agent to remove the cluster from management and let Tanzu Platform delete the cluster agent extensions from the cluster.
    • Select Manual agent removal to remove the cluster from management and leave the cluster agent extensions on the cluster. For information about removing the cluster agent extensions manually, see Remove cluster agent extensions. This method can be useful if your cluster has stopped communicating with Tanzu Platform.
  7. Click Detach.

Tanzu CLI
Run the following commands in a command window:

To detach a self-managed cluster using the tanzu CLI:

  1. Make sure your context is set appropriately.
  2. Run the following command, replacing <my-cluster> with the name of your cluster:

    tanzu operations cluster delete <my-cluster> --cluster-type attached
    
  3. To detach a self-managed cluster from Tanzu Platform without removing the cluster agent extensions, add the --force flag, for example:

    tanzu operations cluster delete <my-cluster> --cluster-type attached --force
    

Remove cluster agent extensions

If you have removed a cluster from Tanzu Platform management without cleaning up the cluster agent extensions from the cluster, you can use this procedure to remove the residual resources from the cluster and still retain the cluster.

The following steps remove the Tanzu-related resources on your cluster.

  1. Open a command window and connect to your cluster with kubectl.
  2. Use the following kubectl commands to remove the namespace, CRDs, clusterroles/clusterrolebindings, and other resources installed by Tanzu Platform.

    kubectl delete namespace vmware-system-tmc
    kubectl delete crd extensions.clusters.tmc.cloud.vmware.com
    kubectl delete crd agents.clusters.tmc.cloud.vmware.com
    kubectl delete crd extensionresourceowners.clusters.tmc.cloud.vmware.com
    kubectl delete crd extensionintegrations.clusters.tmc.cloud.vmware.com
    kubectl delete crd extensionconfigs.intents.tmc.cloud.vmware.com
    kubectl delete clusterrole extension-updater-clusterrole extension-manager-role agent-updater-role vmware-system-tmc-psp-agent-restricted
    kubectl delete clusterrolebinding extension-updater-clusterrolebinding extension-manager-rolebinding agent-updater-rolebinding vmware-system-tmc-psp-agent-restricted
    kubectl delete psp vmware-system-tmc-agent-restricted
    
  3. Use the following kubectl commands to remove the catalog-related Kubernetes resources installed by Tanzu Platform.

    Note

    Removing these resources impacts any workloads that you have deployed using the catalog.

    kubectl delete crd packageinstalls.packaging.carvel.dev
    kubectl delete crd packagerepositories.packaging.carvel.dev
    kubectl delete crd internalpackagemetadatas.internal.packaging.carvel.dev
    kubectl delete crd internalpackages.internal.packaging.carvel.dev
    kubectl delete crd apps.kappctrl.k14s.io
    kubectl delete APIService v1alpha1.data.packaging.carvel.dev
    kubectl delete ns tanzu-system
    kubectl delete ns tanzu-package-repo-global
    kubectl delete tanzupackage-install-admin-role kapp-controller-cluster-role
    kubectl delete clusterrolebinding kapp-controller-cluster-role-binding pkg-apiserver:system:auth-delegator
    kubectl delete psp tanzu-system-kapp-ctrl-restricted
    kubectl delete rolebinding pkgserver-auth-reader -n kube-system
    
check-circle-line exclamation-circle-line close-line
Scroll to top icon