4
K8S如何强制删除namespace
source link: https://blog.51cto.com/sleep666/5994537
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
K8S如何强制删除namespace
精选 原创我们有时候会遇到 namespace 无法删除的情况是因为 finalizers 属性的原因
1.将cert-mamaner导出为json文件
kubectl get ns cert-manager -o json > cert.json
2.编辑cert.json文件,将spec内的内容全部删除,然后保存退出
# 修改前
"spec": {
"finalizers": [
"kubernetes"
]
},
# 修改后
"spec": {
},
"spec": {
"finalizers": [
"kubernetes"
]
},
# 修改后
"spec": {
},
3.开启 proxy
kubectl proxy --port=8081
4.调用 api 进行删除
curl -k -H "Content-Type: application/json" -X PUT --data-binary @cert.json http://127.0.0.1:8081/api/v1/namespaces/cert-system/finalize
5.执行完命令后运行
kubectl get ns
default Active 244d
kube-system Active 244d
kube-public Active 244d
kube-node-lease Active 244d
default Active 244d
kube-system Active 244d
kube-public Active 244d
kube-node-lease Active 244d
发现已经成功删除了
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK