Managed resources and catalog-related Kubernetes resources are not removed when you detach a cluster.

Managed Resources

Managed resources are retained after a normal or forced cluster detach. These resources include managed namespaces, policies, and any workloads running within those namespaces. You can use the following CLI commands to list and choose which managed resources to maintain after a cluster detach.

Use the following command to list all the managed resources that were left behind by the detach operation.

tmc cluster managed-resources list
Use this command to retain specified managed resources:
tmc cluster managed-resources retain < resource-type > [ resource-name ]


resource-type is a mandatory argument which specifies the type of resource being retained such as pods, deployment.apps, StatefulSet, etc.

resource-name is an optional argument which specifies the name of the resource being retained. If resource-name is absent, all the k8s resources belonging to the specified resource-type will be retained.

Once all of the managed resources are retained, remaining resources can be cleaned up using the kubectl command.

CRDs and CRs should not be deleted before retaining the necessary k8s resources.

Catalog-related Kubernetes Resources

The detach process does not remove the catalog-related Kubernetes resources installed on your cluster, as that would impact any workloads you have deployed using the catalog. If you want to remove these resources, run the following kubectl commands:

kubectl delete crd
kubectl delete crd
kubectl delete crd
kubectl delete crd
kubectl delete crd
kubectl delete APIService
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
kubectl delete crd
kubectl delete crd
kubectl delete psp tanzu-system-secretgen-ctrl-restricted
Additionally, if you have enabled continuous delivery on your cluster prior to detaching it, you can remove the Flux-related resources using the following kubectl commands:
kubectl delete -n tanzu-fluxcd-packageinstalls kustomize-controller
kubectl delete -n tanzu-fluxcd-packageinstalls source-controller
kubectl delete ns tanzu-fluxcd-packageinstalls
kubectl delete ns tanzu-continuousdelivery-resources