How can I check a pod using most cpu time from an already running pod?

Amandeep Singh:
How can I check a pod using most cpu time from an already running pod?

SunilRoopchandani:
kubectl top po --sort-by=cpu

SunilRoopchandani:
but metrcis server should be installed for this to work

Amandeep Singh:
I did that, but the question specified “Do it from an existing pod”

Amandeep Singh:
and the pod name was given

SunilRoopchandani:
was that given pod part of metrics server

Tej_Singh_Rana:
Hello, @Amandeep Singh
Please check in the

$ kubectl get pods -owide

Identify the node name.
Then describe the node:

$ kubectl describe node <node-name>

Then check the under the pods section, AGE field.

Amandeep Singh:
here is some more context:

I have a pod already running say pod_X. I need to find the pod in the cluster that is utilizing most CPU time from the pod_X; Provided, metric server is already there. I can execute k top pods and see data.

I found this weird and read the question again but could not understand the tricky part, if there.

PP:
“utilizing most CPU time from the pod_X” - One way to check is you can check logs (traffic usage)

Md Ishaq R:
@PP How do check logs via traffic usage

Fayaz Rehman:
Not sure about json syntax - But you could run this command for each node to figure out the pods with max cpu utilization

Fayaz Rehman:
k describe node <node-name> | grep -i cpu -A10 | awk ‘{print $3,TAB, TAB, TAB, $2}’ | sort