强制删除Namespace
2019-12-03 本文已影响0人
王勇1024
今天想尝试通过prometheus-operator安装prometheus,安装的过程出了一些问题,我就想卸载后重新安装,卸载使用的命令是kubectl delete -f ~/kube-prometheus/manifests/setup。但一直安装不上去,报出下面的错误:
Error from server (Conflict): Operation cannot be fulfilled on namespaces "monitoring": The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.
通过排除,发现卸载的时候同时也执行了删除monitoring命名空间的操作,但monitoring下还有其他对象,导致命名空间删除失败,一直处于Terminating状态。
namespace terminating
解决方案:
可以通过下面的方式强制删除命名空间:
yum install jq culr -y
git clone https://github.com/ctron/kill-kube-ns.git
cd kill-kube-ns && ./kill-kube-ns {要删除的namespace}