Get the Pod which has the maximum CPU usage

1/25/2019

I would like to sort the pod by maximum CPU usage. I know there is a lot of tools which comes with monitoring. I would like to find this by using 'kubectl top' command.

any help is appreciated - thanks

-- Gowtham
kubernetes

1 Answer

1/25/2019

You could do kubectl top pod | sort -k2 -n to sort by CPU, or add -r at the end if you want the largest at the top.

That'll tell you usage but if you want allocation (based on requests and limits) then you might instead want kubectl describe nodes. There's a github thread with some further suggestions and discussion.

-- Ryan Dawson
Source: StackOverflow