Top CPU Utilization - Node Name

8/7/2020

I would like to save node name which consuming highest CPU (in the current namespace) into the file.

kubectl top node provide you all nodes information, need to pick the top one from the list.

-- sachin
kubernetes

1 Answer

8/7/2020

Ideal command to get the sorted list is kubectl top node --no-headers --sort-by='cpu' | head -1 > somefilename.txt, but the result will be inconsistent due to open issue kubectl top issue

As a workaround you can try this command if you are running in any linux/mac OS:

kubectl top node --no-headers | sort -k3 -n | tail -1 > somefilename.txt

This issue has been resolved in kubectl 1.18.

-- Kiruba
Source: StackOverflow