天天看點

删除 KubeSphere 中一直卡在 Terminating 的 Namespace

問題

最近一直在玩 KubeSphere 。使用kubesphere-delete.sh删除KubeSphere ,執行一段時間後發面ns删除不了

删除 KubeSphere 中一直卡在 Terminating 的 Namespace

使用強制指令還是無法删除

$ kubectl delete ns kubesphere-monitoring-system  --force --grace-period=0      

過了半個小時,再次檢視删除進度還是無法删除

删除 KubeSphere 中一直卡在 Terminating 的 Namespace

終于我在這個 issue 中找到了答案:https://github.com/kubernetes/kubernetes/issues/60807#issuecomment-663853215

如何徹底删除 namespace

擷取 namespace 的詳情資訊并轉為 json

$ kubectl get namespace kubesphere-monitoring-system -o json >      

如沒有JSON需要yum install jq

​vi kubesphere-monitoring-system.json,​

​把 spec下的值 finalizers 下的 kubernetes 删除。

删除 KubeSphere 中一直卡在 Terminating 的 Namespace

執行清理指令

kubectl replace --raw "/api/v1/namespaces/kubesphere-monitoring-system/finalize"      
删除 KubeSphere 中一直卡在 Terminating 的 Namespace

删除成功

删除 KubeSphere 中一直卡在 Terminating 的 Namespace

關于 KubeSphere