<p>How to sort the pods with respect to it's IP or it's Node IP.</p>

<p>I tried this command and I have around 20 pods running on my 3 node cluster.</p>

<pre><code>kubectl get pods --all-namespaces --sort-by={'.spec.ip'}
</code></pre>

<blockquote>
  <p>error: ip is not found</p>
</blockquote>

<p>this is the error I am getting</p>

MR.i
<p>You're using the wrong command to sort. The correct command will be:</p>

<pre><code>kubectl get pods --all-namespaces --sort-by={.status.podIP}
</code></pre>

<p>This will sort your pods according to the podIP.</p>
