k8s刪除namespace失敗,狀態Terminating解決方案


 

 

k8s 刪除namespace失敗(強制刪除也是出現報錯),狀態Terminating,如下:

kubectl delete namespace k8s-springboot
Error from server (Conflict): Operation cannot be fulfilled on namespaces "k8s-springboot": The system is ensuring all content is removed from this namespace.  Upon completion, this namespace will automatically be purged by the system.

 

解決方案,刪除其中的spec字段,因為k8s集群是攜帶認證的:

1,導出信息

kubectl get namespace k8s-springboot  -o json > tmp.json

2,刪除spec

3,執行

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

結果:

{
  "kind": "Namespace",
  "apiVersion": "v1",
  "metadata": {
    "name": "k8s-springboot",
    "selfLink": "/api/v1/namespaces/k8s-springboot/finalize",
    "uid": "44f3c5b5-709e-11ea-963c-025000000001",
    "resourceVersion": "3213373",
    "creationTimestamp": "2020-03-28T02:46:05Z",
    "deletionTimestamp": "2020-03-28T04:29:55Z"
  },
  "spec": {
    
  },
  "status": {
    "phase": "Terminating"
  }
}

 

刪除成功

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM