Here’s a quick tip to remove an OpenShift pod with “Unknown” status.

Suppose this is the output when I run oc get pods:

~ ❯❯❯ oc get pods
NAME            READY     STATUS              RESTARTS   AGE
dothe-4-bjq8v   0/1       ContainerCreating   0          5h
dothe-4-ghttj   1/1       Unknown             0          15h

~ ❯❯❯ oc delete pod dothe-4-ghttj
pod "dothe-4-ghttj" deleted
~ ❯❯❯ oc get pods
NAME            READY     STATUS              RESTARTS   AGE
dothe-4-bjq8v   0/1       ContainerCreating   0          5h
dothe-4-ghttj   1/1       Unknown             0          15h

Let’s try deleting the bad pod again with --force option:

~ ❯❯❯ oc delete pod dothe-4-ghttj --force
pod "dothe-4-ghttj" deleted
~ ❯❯❯ oc get pods
NAME            READY     STATUS              RESTARTS   AGE
dothe-4-bjq8v   0/1       ContainerCreating   0          5h
dothe-4-ghttj   1/1       Unknown             0          15h

It still didn’t work. :( Let’s google to see if we’re lucky, shall we? According to this, we can pass --grace-period=0 in addition to --force:

~ ❯❯❯ oc get pods
NAME            READY     STATUS              RESTARTS   AGE
dothe-4-7czgs   0/1       ContainerCreating   0          9s
dothe-4-ghttj   1/1       Unknown             0          15h
~ ❯❯❯ oc delete pod dothe-4-ghttj --grace-period=0 --force
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 "dothe-4-ghttj" deleted
~ ❯❯❯ oc get pods
NAME            READY     STATUS              RESTARTS   AGE
dothe-4-7czgs   0/1       ContainerCreating   0          1m

There you go, there’s no more “Unknown” status pod.

Ref: