Skip to content

Instantly share code, notes, and snippets.

@cllovatto
Created July 20, 2022 16:58
Show Gist options
  • Save cllovatto/bb81044a70d0cb93b92b937026f16154 to your computer and use it in GitHub Desktop.
Save cllovatto/bb81044a70d0cb93b92b937026f16154 to your computer and use it in GitHub Desktop.
Remove leftovers from deleted cluster on Rancher 2.6.x
Sometimes when you delete a cluster from Rancher, it still appears in the Home dashboard and also on the left menu.
This is not only cosmetic, but if you try to import a new cluster under the same name, it does not work.
To definitely remove it, login to Rancher cluster and type the following:
kubectl get clusters.management.cattle.io # find the cluster you want to delete
kubectl describe clusters.management.cattle.io <cluster-id from previous command> # Find the Display name for the cluster and confirm it is the one you want
export CLUSTERID="c-xxxxxxxxx"
kubectl patch clusters.management.cattle.io $CLUSTERID -p '{"metadata":{"finalizers":[]}}' --type=merge
kubectl delete clusters.management.cattle.io $CLUSTERID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment