其他分享
首页 > 其他分享> > kubernetes的namespaces总是Terminating

kubernetes的namespaces总是Terminating

作者:互联网

#kubectl delete ns jenkins
Error from server (Conflict): Operation cannot be fulfilled on namespaces “jenkins”: The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.

1.尝试强制删除不行
删除时带上–force --grace-period=0参数 ,无法删除;
kubectl delete namespace jenkins --force --grace-period=0

#删除POD
kubectl delete pod PODNAME --force --grace-period=0

#删除NAMESPACE
kubectl delete namespace NAMESPACENAME --force --grace-period=0

2.kubectl get namespace monitoring -o json > tmp.json
然后打开tmp.json,删除其中的spec字段,即删除清空大括号里面数据,因为这边的K8s集群是带认证的,

3.又新开了窗口运行kubectl proxy跑一个API代理在本地的8081端口。
kubectl proxy --port=8081

4.curl -k -H “Content-Type: application/json” -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces/monitoring/finalize

网络飞鸥 发布了33 篇原创文章 · 获赞 0 · 访问量 3853 私信 关注

标签:kubectl,force,删除,kubernetes,namespace,period,json,Terminating,namespaces
来源: https://blog.csdn.net/erhaiou2008/article/details/104262642