Reputation: 8978
Is there a way to combine kubectl top pod
and kubectl top nodes
?
Basically I want to know pods sorted by cpu/memory usage BY node.
I can only get pods sorted by memory/cpu for whole cluster with kubectl top pod
or directly memory/cpu usage per whole node with kubectl top nodes
.
I have been checking the documentation but couldnt find the exact command.
Upvotes: 3
Views: 2817
Reputation: 5267
There is no built-in solution to achieve your expectations. kubectl top pod
and kubectl top node
are different commands and cannot be mixed each other. It is possible to sort results from kubectl top pod
command only by cpu
or memory
:
kubectl top pod POD_NAME --sort-by=cpu # Show metrics for a given pod and sort it by 'cpu' or 'memory'
If you want to "combine" kubectl top pod
and kubectl top node
you need to write custom solution. For example script in Bash based on this commands.
Upvotes: 3