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 ]

Where:

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 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
kubectl delete crd secretexports.secretgen.carvel.dev
kubectl delete crd secretimports.secretgen.carvel.dev
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 packageinstalls.packaging.carvel.dev -n tanzu-fluxcd-packageinstalls kustomize-controller
kubectl delete packageinstalls.packaging.carvel.dev -n tanzu-fluxcd-packageinstalls source-controller
kubectl delete ns tanzu-fluxcd-packageinstalls
kubectl delete ns tanzu-continuousdelivery-resources