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
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.