記錄一次namespace 處於Terminating狀態的處理方法


現象:

[root@master kube-prometheus]# kubectl get namespaces -o wide
NAME                STATUS        AGE
cattle-logging      Active        174m
cattle-prometheus   Active        12h
cattle-system       Active        15h
default             Active        8d
kube-node-lease     Active        8d
kube-public         Active        8d
kube-system         Active        8d
monitoring          Terminating   11m

解決:

[root@master kube-prometheus]# kubectl delete namespace monitoring  --force --grace-period=0
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
Error from server (Conflict): Operation cannot be fulfilled on namespaces "monitoring": The system is ensuring all content is removed from this namespace.  Upon completion, this namespace will automatically be purged by the system.
[root@master kube-prometheus]# NAMESPACE=monitoring
[root@master kube-prometheus]# kubectl proxy &
[1] 973
[root@master kube-prometheus]# Starting to serve on 127.0.0.1:8001

新開一個鏈接:

[root@master helm]# kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
[root@master helm]# curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
[root@master helm]# kubectl get ns
NAME                STATUS   AGE
cattle-logging      Active   178m
cattle-prometheus   Active   12h
cattle-system       Active   15h
default             Active   8d
kube-node-lease     Active   8d
kube-public         Active   8d
kube-system         Active   8d
[root@master helm]# kubectl get ns
NAME                STATUS   AGE
cattle-logging      Active   178m
cattle-prometheus   Active   12h
cattle-system       Active   15h
default             Active   8d
kube-node-lease     Active   8d
kube-public         Active   8d
kube-system         Active   8d

發現已經解決了


免責聲明!

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



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