Force delete pods
Kubernetes: how to force-delete stuck pods and remove finalizers using kubectl.
When pods are stuck in a Terminating state, you can force-delete them by setting --grace-period=0 --force. If the pods still do not terminate (for example, due to finalizers), you can patch the pod metadata to remove all finalizers, which allows Kubernetes to complete the deletion.
1
2
3
kubectl delete pod drillcluster1-drillbit-0 zk-0 --grace-period=0 --force
kubectl patch pod drillcluster1-drillbit-0 zk-0 -p '{"metadata":{"finalizers":null}}'
This post is licensed under CC BY 4.0 by the author.