<p>Need only specific columns using JSONPATH query in kubernetes:</p>
<ul>
<li><code>$ kubectl get node</code></li>
</ul>
<pre><code>NAME  STATUS    ROLES   AGE VERSION
1     Ready     master  35d v1.18.6
2     Ready     &lt;none&gt;  35d v1.18.6
3     Ready     &lt;none&gt;  35d v1.18.6             
4     Ready     &lt;none&gt;  35d v1.18.6             
5     Ready     master  35d v1.18.6             
6     Ready     &lt;none&gt;  35d v1.18.6
</code></pre>
<p>Desired output should look like this:</p>
<pre><code>NAME    VERSION
1       v1.18.6
2       v1.18.6
3       v1.18.6
4       v1.18.6
5       v1.18.6 
6       v1.18.6
</code></pre>

raju
<p>Th answer to above question is:</p>
<ul>
<li><code>$ kubectl get node -o=jsonpath='{range.items[*]}{.metadata.selfLink} {&quot;\t&quot;} {.status.nodeInfo.kubeletVersion}{&quot;\n&quot;}{end}'</code></li>
</ul>
<p>It will produce output:</p>
<pre class="lang-sh prettyprint-override"><code>01    v1.18.6
02    v1.18.6
03    v1.18.6
04    v1.18.6
05    v1.18.6
</code></pre>
<p>For further sorting:</p>
<ul>
<li><p><code>$ kubectl get node -o=custom-columns=NODE:.metadata.selfLink</code></p>
</li>
<li><p><code>$ kubectl get node -o=custom-columns=VERSION:.status.nodeInfo.kubeletVersion</code></p>
<p><code>kubectl get node -o=custom-columns=NODE:.metadata.selfLink,VERSION:.status.nodeInfo.kubeletVersion N</code></p>
</li>
</ul>
