Kubernetes - 解决删除namespace一直Terminating的问题
2019-12-28 / 1 min read
在删除命名空间时,一直卡在Terminating状态,使用--force参数依然无法删除,报错
Error from server (Conflict): Operation cannot be fulfilled on namespaces "test": The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.
可以使用以下方式删除
kubectl get namespace <annoying-namespace-to-delete> -o json > tmp.json
- 编辑tmp.json文件,删除其中spec字段的finalize字段,如果namespace的meta指令了finalizer也需要删除这信息
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces/<namspace-to-delete>/finalize