我们有一个Rancher Kubernetes集群,当我们尝试删除相应的部署时,有时pod陷入terminating
状态,如下所示。
$ kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
...
storage-manager-deployment 1 0 0 0 1d
...
$ kubectl delete deployments storage-manager-deployment
kubectl delete deployments storage-manager-deployment
deployment.extensions "storage-manager-deployment" deleted
C-c C-c^C
$ kubectl get po
NAME READY STATUS RESTARTS AGE
...
storage-manager-deployment-6d56967cdd-7bgv5 0/1 Terminating 0 23h
...
$ kubectl delete pods storage-manager-deployment-6d56967cdd-7bgv5 --grace-period=0 --force
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.
pod "storage-manager-deployment-6d56967cdd-7bgv5" force deleted
C-c C-c^C
两个删除命令(用于deployment
和pod
)都被卡住,需要手动停止。
我们都尝试过
kubectl delete pod NAME --grace-period=0 --force
和
kubectl delete pod NAME --now
没有任何运气。
我们还设置了fs.may_detach_mounts=1
,所以看来StackOverflow上已经存在的所有类似问题都不适用于我们的问题。
如果我们检查在其中运行了该Pod的节点,则该节点不会出现在docker ps
列表中。
有什么建议吗?
谢谢
答案 0 :(得分:3)
检查Pod规范中的数组:“ finalizers”
finalizers:
- cattle-system
如果存在,请将其删除,吊舱将终止。