DEV Community


Posted on

Answer: How to order pods based on the nodes in kubernetes

You can pipe the kubectl command output to sort:

kubectl get pods -o wide --namespace=machines | sort -k7

or to omit the first line

kubectl get pods -o wide --namespace=machines | sed -n '1!p' | sort -k7

Also, you should be able to do this by --sort-by option in kubectl:

Top comments (0)