Skip to content

Instantly share code, notes, and snippets.



Last active Mar 18, 2021
What would you like to do?
Remove Rancher from Cluster - Force Delete CRDs
# Manually remove finalizers
kubectl edit -n cattle-system secret tls-rancher
kubectl patch secret tls-rancher -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
kubectl patch namespace cattle-system -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
kubectl delete namespace cattle-system --grace-period=0 --force
kubectl patch namespace cattle-global-data -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
kubectl delete namespace cattle-global-data --grace-period=0 --force
kubectl patch namespace local -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
kubectl get customresourcedefinitions |grep |awk '{print $1}' |xargs kubectl patch -p '{"metadata":{"finalizers":[]}}' --type=merge crd
# Delete CRDs
kubectl get customresourcedefinitions |grep |awk '{print $1}' |xargs kubectl delete customresourcedefinitions --force --grace-period=0
kubectl delete namespace local --grace-period=0 --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment