sachin
sachin

Reputation: 139

Top CPU Utilization - Node Name

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.

Upvotes: 0

Views: 209

Answers (1)

Kiruba
Kiruba

Reputation: 1377

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.

Upvotes: 1

Related Questions