k8s刪除pod一直處于terminating狀態(tài),無(wú)法被刪除
刪除pod的時(shí)候發(fā)現(xiàn) pod 一直處于 terminating 狀態(tài),而且使用 delete 命令刪除的時(shí)候一直會(huì)卡的沒(méi)反應(yīng)。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-512963.html
- 可以使用強(qiáng)制刪除的方法解決:
# 強(qiáng)制刪除POD
kubectl delete pod [pod name] --force --grace-period=0 -n [namespace]
# 強(qiáng)制刪除名稱空間
kubectl delete namespace NAMESPACENAME --force --grace-period=0
- 篩選出集群中狀態(tài)是
Terminating
的 pod,隨后進(jìn)行刪除
kubectl get pods | grep "Terminating"| awk '{print $1}'
kubectl delete pod $(kubectl get pods | grep "Terminating"| awk '{print $1}') --force --grace-period=0 -n default
- 如果依舊無(wú)法解決,可以從ETCD中刪除源數(shù)據(jù)
# 刪除 namespace下的pod名為pod-to-be-deleted-0
export ETCDCTL_API=3
etcdctl del /registry/pods/default/pod-to-be-deleted-0
# 刪除需要?jiǎng)h除的
etcdctl del /registry/namespaces/NAMESPACENAME
#或者刪除
kubectl get ns istio-system -o json >tmp.json
修改tmp.json 刪除其中的spec字段
kubectl proxy --port=8081
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8081/api/v1/namespaces/istio-system/finalize
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-512963.html
到了這里,關(guān)于k8s中強(qiáng)制刪除pod方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!