OpenShift - Pod stuck Terminating

by
Jeremy Canfield |
Updated: September 20 2022
| OpenShift articles
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
Let's say the oc get pods command shows a pod stuck "Terminating".
~]# oc get pods
NAME READY STATUS RESTARTS AGE
foo-9mzm2 1/1 Running 0 8d
foo-vmzmz 1/1 Terminating 37 30m
bar-pflxc 1/1 Running 0 8d
Use the oc describe pod command to see if there are events that explain why the pod is stuck Terminating. Something like this could be returned.
~]# oc describe pod foo-vmzmz
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Unhealthy 56m (x124 over 10d) kubelet, node001 Liveness probe failed: dial tcp 10.15.114.55:6379: i/o timeout
Warning Unhealthy 55m (x4 over 56m) kubelet, node001 Readiness probe failed: rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:235: starting container process caused "process_linux.go:83: executing setns process caused \"exit status 15\""
Normal Killing 3m (x41 over 10d) kubelet, node001 Killing container with id docker://pod002:Container failed liveness probe.. Container will be killed and recreated.
The oc delete pod command can be used to try to delete the pod. When a pod is stuck Terminating, this command usually hangs indefinitely and the pod remains stuck in a Terminating state.
~]# oc delete pod foo-vmzmz
If the prior command hangs, you can try with the --force flag and the --grace-period=0 option.
~]# oc delete pod foo-vmzmz --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.
pod "foo-vmzmz" force deleted
Did you find this article helpful?
If so, consider buying me a coffee over at