IBM Support

Cloud Pak for Security: How to delete a Pod stuck in a Terminating status

How To


Summary

A Red Hat OpenShift Container Platform Pod was deleted from the User Interface, but remains in a status of 'Terminating'. Stagnant terminating status can happen to a pod that is not responding to termination signals.

Objective

In this article, we are providing a process for Red Hat OpenShift Container Platform to delete a Pod that is stuck in a 'Terminating' status.
TerminatingPod

Environment

Red Hat OpenShift Container Platform (OCP) 4

Steps

  1. Log in to your Red Hat OpenShift Container Platform Console.
  2. In Red Hat OpenShift Container Platform Console click the drop-down arrow next to your username, select the option 'Copy login command', then click 'Display Token'.
    logindisplay
    DisplayToken
    Note: You might need to authenticate again.
  3. Highlight and copy the oc login command. The command looks similar to the following:
    oc login –-token=sha256......
  4. Connect to the Red Hat OpenShift Platform Server with SSH.
  5. When successfully logged in paste the oc login command, copied in an earlier step.
  6. Run the following command to retrieve a list of Projects.
    oc get projects
  7. Run the following command to retrieve a list of Pods from the Project containing the Pod that is in a 'Terminating' status. Take note of the Pod name that is in a 'Terminating' status.
    oc get pod -n <Project>
    Note: Replace <Project> with the actual name of the Project.
  8. Forcibly remove the Pod from the Project by running the following command.
    oc delete pod <Podname> -n <Project> --grace-period=0 --force
    Note: Replace <Project> with the actual name of the Project. Also, replace <Podname> with the actual name of the Pod.

    Results:
    Run the following command to confirm the Pod that was stuck in a 'Terminating' status was successfully removed:
    oc get pod -n <Project>

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB24","label":"Security Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSTDPP","label":"IBM Cloud Pak for Security"},"ARM Category":[{"code":"a8m3p0000000rbnAAA","label":"Administration Task"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
13 September 2022

UID

ibm16619145