How to delete or kill PODs hanging in Terminating state

Solution Verified - Updated -

Issue

  • PODs hanging or stuck in Terminating state.
  • Pods stuck in "Terminating" state in spite of using --force along with --grace-period and setting {"finalizers":null}.

    $ oc patch pod -n apic-project testubi-apiconnect-62pv9 -p '{"metadata":{"finalizers":null}}'
     The Pod "testubi-apiconnect-62pv9" is invalid: spec.initContainers: Forbidden: pod updates may not add or remove containers
    

Environment

  • Red Hat OpenShift Container Platform (OCP)
    • 3.6 or later (for finalizer error messages)
    • 4
  • Attempting to delete a POD or deploy a new version

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content