强制删除crd
remove the customresourcecleanup.apiextensions.k8s.io finalizer from the CRD, then recreate it and go about removing the finalizers from the custom resources# remove the CRD finalizer blocking on cust
·
remove the customresourcecleanup.apiextensions.k8s.io finalizer from the CRD, then recreate it and go about removing the finalizers from the custom resources
# remove the CRD finalizer blocking on custom resource cleanup
kubectl patch crd/crontabs.stable.example.com -p '{"metadata":{"finalizers":[]}}' --type=merge
# now the CRD can be deleted (orphaning custom resources in etcd)
kubectl delete -f crd.yaml
customresourcedefinition.apiextensions.k8s.io "crontabs.stable.example.com" deleted
Error from server (NotFound): error when deleting "crd.yaml": the server could not find the requested resource (delete crontabs.stable.example.com my-new-cron-object)
# when the CRD is recreated, it resurfaces the existing custom resources
kubectl create -f crd.yaml
customresourcedefinition.apiextensions.k8s.io "crontabs.stable.example.com" created
Error from server (AlreadyExists): error when creating "crd.yaml": object is being deleted: crontabs.stable.example.com "my-new-cron-object" already exists
# the custom resources can now be edited to remove finalizers
kubectl patch crontab/my-new-cron-object -p '{"metadata":{"finalizers":[]}}' --type=merge
crontab.stable.example.com "my-new-cron-object" patched
# and now both custom resource and CRD can be deleted
kubectl delete -f crd.yaml
customresourcedefinition.apiextensions.k8s.io "crontabs.stable.example.com" deleted
Error from server (NotFound): error when deleting "crd.yaml": crontabs.stable.example.com "my-new-cron-object" not found
更多推荐
已为社区贡献1条内容
所有评论(0)