Get the Pod which has the maximum CPU usage

For a general command that gives usage see stackoverflow.com/a/64025079/2746623. On unix I was doing kubectl top pod | sort -k2 -n but the linked answer is more general.

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.


$ kubectl top pods --all-namespaces --sort-by cpu


you can run the below command to sort all pods across all namespaces by their cpu utilization.

kubectl top po -A --sort-by=cpu

Tags:

Kubernetes