Open shift Pod CPU and terminating details

7/1/2020
  1. Is there any way to filter only terminating pods or problematic pods in open shift from my master node.
  1. Is there any way to find which pod is consuming more CPU from the specific node..from my master in Open shift.

We have tried with few commands but it's not helping much.

-- Velu
kubernetes
openshift

1 Answer

7/1/2020
  1. Is there any way to filter only terminating pods or problematic pods in open shift from my master node.

To view pods that are not in running status (Terminating, CrashLoopBackOff etc.) you can use:

kubectl get pods --all-namespaces  | grep -Ev '([0-9]+)/\1'

or to check pods with only Terminated you can use:

kubectl get pods --all-namespaces --field-selector=status.phase=Terminated
  1. Is there any way to find which pod is consuming more CPU from the specific node..from my master in Open shift.

To view pod CPU usage you can install metrics-server and check consumption by using:

kubectl top pod

or

oc adm top pod
-- kool
Source: StackOverflow