Kubernetes Namespace Stuck in status Terminating

公司的DEV kubernetes環境需要重新搭建,在搭建的過程中,發現了一個有趣的現象,在嘗試kubectl delete ns XX的時候, namespace一直卡在了Terminating的狀態上.

在嘗試了諸多方式後,只有直接調用ApiService的API纔可行,具體方法:

kubectl get secrets
kubectl describe secrets xxx (anyone is good enough)
export TOKEN=(you get from above)
curl https://your-cluster-ip:6443/api/v1/namespaces --header "Authorization: Bearer $TOKEN" --insecure
curl -X PUT --data-binary @tmp.json https://your-cluster-ip:6443/api/v1/namespaces/the-namespace-you-wanto-delete/finalize -H "Content-Type: application/json" --header "Authorization: Bearer $TOKEN" --insecure

在取token的時候,任何一個secret都可以,只要可以訪問apiservice即可.

附上references:
https://success.docker.com/article/kubernetes-namespace-stuck-in-terminating
https://github.com/kubernetes/kubernetes/issues/60807
https://github.com/kubernetes/kubectl/issues/151
https://medium.com/@newtondev/how-to-fix-kubernetes-namespace-deleting-stuck-in-terminating-state-5ed75792647e

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章