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". In this example, pod002 has been "Terminating" for 30 minutes.
oc get pods . . . NAME READY STATUS RESTARTS AGE pod001 1/1 Running 0 8d pod002 1/1 Terminating 37 30m pod003 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.
oc describe pod/pod002
Something like this could be returned.
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.
Try to delete the pod using the oc delete pod command. Often I have observed that this command will hang and never complete.
~]# oc delete pod pod002 pod "pod002" deleted
If the prior command hangs, add the --force flag and --grace-period=0 option.
oc delete pod pod002 --force --grace-period=0
Something like this should be returned.
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 "pod002" force deleted