Force Delete a Stuck Kubernetes Pod
Objective
Remove a pod that is stuck in Terminating state when the standard deletion grace period does not complete.
Prerequisites
kubectlconfigured with access to the target cluster and namespace.- The pod name and namespace.
Procedure
-
Identify the stuck pod:
kubectl get pods -n <namespace> -
Attempt a normal deletion with a short grace period:
kubectl delete pod <pod-name> -n <namespace> --grace-period=0 -
If the pod remains, force delete it:
kubectl delete pod <pod-name> -n <namespace> --grace-period=0 --force -
If the pod is managed by a workload controller, scale the controller to zero and back to trigger reconciliation:
kubectl scale deployment/<name> -n <namespace> --replicas=0kubectl scale deployment/<name> -n <namespace> --replicas=<original-count>
Verification
- Run
kubectl get pods -n <namespace>and confirm the pod is no longer listed. - Check the workload controller events to ensure a replacement pod is running correctly.