kubernetes强制删除namespace

1.执行命令删除namespace后一直显示Terminating,无法删除namespace

[root@10-21-20-71 kubesphere]# kubectl get ns
NAME                              STATUS        AGE
default                           Active        13d
dev                               Active        21h
istio-system                      Active        12d
kube-node-lease                   Active        13d
kube-public                       Active        13d
kube-system                       Active        13d
kubesphere-controls-system        Active        4d15h
kubesphere-devops-system          Active        18h
kubesphere-monitoring-federated   Active        4d10h
kubesphere-monitoring-system      Active        4d10h
kubesphere-system                 Terminating   4d9h

2.获取需要强制删除的NameSpace信息,并将图中所示的部分删除

[root@10-21-20-71 kubesphere]# kubectl get namespace kubesphere-system -o json > kubesphere-system.json 
1630385257922.jpg

3.运行kube-proxy

[root@10-21-20-71 kubesphere]# kubectl proxy --port=8081
Starting to serve on 127.0.0.1:8081

4.重新打开一个窗口通过API强制删除namespace

curl -k -H "Content-Type: application/json" -X PUT --data-binary @kubesphere-system.json http://127.0.0.1:8081/api/v1/namespaces/kubesphere-system/finalize
[root@10-21-20-71 kubesphere]# 
[root@10-21-20-71 kubesphere]# kubectl get ns
NAME                              STATUS   AGE
default                           Active   13d
dev                               Active   21h
istio-system                      Active   12d
kube-node-lease                   Active   13d
kube-public                       Active   13d
kube-system                       Active   13d
kubesphere-controls-system        Active   4d16h
kubesphere-devops-system          Active   19h
kubesphere-monitoring-federated   Active   4d10h
kubesphere-monitoring-system      Active   4d10h
[root@10-21-20-71 kubesphere]# 
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容