How can I list all kubernetes nodes and sort by the nodes that have the most pods?

11/11/2019

Is there a --sort-by option that allows you to sort by nodes which have the greatest number of pods running?

-- Nathan McKaskle
kubectl
kubernetes

1 Answer

11/11/2019

how about this way:

kubectl get nodes -o=custom-columns=Pods:.status.capacity.pods,NAME:metadata.name | sort -nr

or kubectl get nodes --sort-by=.status.capacity.pods

-- Markownikow
Source: StackOverflow