k8s 强制删除命名空间terminating状态

命名空间terminating状态

强制删除

 kubectl get namespace <terminating-namespace> -o json >tmp.json
 apiVersion: v1
 kind: Namespace
 metadata:
   creationTimestamp: 2018-11-19T18:48:30Z
   deletionTimestamp: 2018-11-19T18:59:36Z
   name: <terminating-namespace>
   resourceVersion: "1385077"
   selfLink: /api/v1/namespaces/<terminating-namespace>
   uid: b50c9ea4-ec2b-11e8-a0be-fa163eeb47a5
 spec:
   finalizers:
   - "kubernetes"   # 删除
 status:
   phase: Terminating

把本机服务暴露在本地端口的8001端口上

kubectl proxy

Starting to serve on 127.0.0.1:8001

curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces/<terminating-namespace>/finalize

验证

kubectl get ns

此时命名空间已经删除

# k8s 

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×