How to sort the pods with respect to it's IP or it's Node IP.
I tried this command and I have around 20 pods running on my 3 node cluster.
kubectl get pods --all-namespaces --sort-by={'.spec.ip'}
error: ip is not found
this is the error I am getting
I have created a kubesort to simplify sorting. It may help you.
You're using the wrong command to sort. The correct command will be:
kubectl get pods --all-namespaces --sort-by={.status.podIP}
This will sort your pods according to the podIP.