root@hello:~# kubectl get ns
NAME STATUS AGE
auth Terminating 34m
default Active 23h
kube-node-lease Active 23h
kube-public Active 23h
kube-system Active 23h
新开命令行窗口打开proxy
root@hello:~# kubectl proxy
Starting to serve on 127.0.0.1:8001
回到刚才窗口 将 terminating 状态的命名空间信息导出到 json 文件:
root@hello:~# kubectl get namespace auth -o json >tmp.json
修改json文件中的 finalizers,将其设置为空
root@hello:~# vi tmp.json
root@hello:~# cat tmp.json | grep finalizers
"finalizers": []
在 temp.json 文件所在位置调下面的接口
root@hello:~# curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces/auth/finalize
*auth 改为需要删除的 terminating 状态的命名空间的名字
验证
root@hello:~# kubectl get ns
NAME STATUS AGE
default Active 23h
kube-node-lease Active 23h
kube-public Active 23h
kube-system Active 23h
root@hello:~#
space.bilibili.com/352476552/a…
cloud.tencent.com/developer/c…
CSDN、GitHub、知乎、开源中国、思否、掘金、简书、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客、全网可搜《小陈运维》