kubernetes 中的强制删除 pods 是否存在任何问题

Is there any issues with Force Deletion pods in kubernetes

我正在尝试完全清除我的 kube env,但有时当我 运行 helm delete --purge 一些 pods 不删除(有时)。

使用 kubectl delete pods --grace-period=0 --force 有什么问题吗 或者反复使用这个命令会导致我的集群或节点出现任何问题吗?

根据 K8S 文档here。根据应用程序,它可能会导致数据损坏或不一致,因为 pods 的重复,直到节点检测到并杀死其中一个 pod。

Force deleting pods does not wait for confirmation that the pod's processes have been terminated, which can leave those processes running until the node detects the deletion and completes graceful deletion. If your processes use shared storage or talk to a remote API and depend on the name of the pod to identify themselves, force deleting those pods may result in multiple processes running on different machines using the same identification which may lead to data corruption or inconsistency. Only force delete pods when you are sure the pod is terminated, or if your application can tolerate multiple copies of the same pod running at once. Also, if you force delete pods the scheduler may place new pods on those nodes before the node has released those resources and causing those pods to be evicted immediately.

因此,这取决于 pods 是否正在使用任何共享资源。