k8s刪除Terminating的名稱空間
阿新 • • 發佈:2022-03-26
# 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