k8s删除Terminating的命名空间
作者:互联网
# kubectl get ns
NAME STATUS AGE
cloudzone Active 23h
default Active 7d23h
edgemesh Active 25h
edgezone Active 22h
kube-node-lease Active 7d23h
kube-public Active 7d23h
kube-system Active 7d23h
kubeedge Terminating 2d22h
删除不掉
# kubectl delete ns kubeedge
namespace "kubeedge" deleted
^C
解决
查看其ns描述
kubectl get ns kubeedge -o json > kubeedge.json
编辑json文件,删除spec字段,因为k8s集群时需要认证的
vim kubeedge.json
删除spec字段
新开一个窗口运行kubectl proxy跑一个API代理在本地的8081端口
回到原窗口执行curl,进行删除
curl -k -H "Content-Type:application/json" -X PUT --data-binary @kubeedge.json http://127.0.0.1:8081/api/v1/namespaces/kubeedge/finalize
成功
[root@xiongzaixiang-dev ~]# kubectl get ns
NAME STATUS AGE
cloudzone Active 23h
default Active 7d23h
edgemesh Active 25h
edgezone Active 22h
kube-node-lease Active 7d23h
标签:kubectl,ns,kubeedge,删除,7d23h,json,Terminating,Active,k8s 来源: https://www.cnblogs.com/ltaodream/p/16059238.html