"Ghost" kubernetes pod 卡在终止状态

"Ghost" kubernetes pod stuck in terminating

情况

我有一个 kubernetes pod 卡在 "Terminating" 状态,无法删除 pod

NAME                             READY STATUS       RESTARTS   AGE
...
funny-turtle-myservice-xxx-yyy   1/1   Terminating  1          11d
...

其中 funny-turtle 是已删除的 helm 版本的名称。

我试过的

尝试删除 pod。

输出:pod "funny-turtle-myservice-xxx-yyy" deleted 结果:它仍然以相同的状态出现。 - 也尝试过 --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.

尝试读取日志(kubectl 日志...)。

结果:Error from server (NotFound): nodes "ip-xxx.yyy.compute.internal" not found

尝试删除 kubernetes 部署。

但它不存在。

所以我假设这个 pod 以某种方式从 aws API 中获得了 "disconnected",从 kubectl logs 打印的错误消息中推断出来。

我会接受任何建议或指导来解释这里发生的事情以及如何摆脱它。

编辑 1

试图查看 "ghost" 节点是否仍然存在 (kubectl delete node ip-xxx.yyy.compute.internal) 但它不存在。

尝试从 pod 中删除终结器:

kubectl patch pod funny-turtle-myservice-xxx-yyy -p '{"metadata":{"finalizers":null}}'

在我的情况下,接受的答案提出的解决方案没有用,一直卡在"Terminating"状态。对我来说有什么诀窍是:

kubectl delete pods <pod> --grace-period=0 --force

在我的情况下,没有任何效果,没有日志,没有删除,绝对没有。我不得不重新启动所有节点,然后情况就清楚了,不再有 Terminating pods.