<p>I've found jsonpath examples for testing multiple values but not extracting multiple values.</p>

<p>I want to get <code>image</code> and <code>name</code> from <code>kubectl get pods</code>.</p>

<p>this gets me <code>name</code>
<code>
kubectl get pods -o=jsonpath='{.items[*].spec.containers[*].name}' |  xargs -n 1
</code></p>

<p>this gets me <code>image</code>
<code>
kubectl get pods -o=jsonpath='{.items[*].spec.containers[*].image}' |  xargs -n 1
</code></p>

<p>but
<code>
kubectl get pods -o=jsonpath='{.items[*].spec.containers[*].[name,image}' |  xargs -n 2
</code></p>

<p>complains <code>invalid array index image</code> - is there a syntax for getting a list of node-adjacent values?</p>

<p>Use below command to get name and image:</p>
<pre><code>kubectl get pods -Ao jsonpath='{range .items[*]}{@.metadata.name}{&quot; &quot;}{@.spec.template.spec.containers[].image}{&quot;\n&quot;}{end}'
</code></pre>
<p>It will give output like below:</p>
<pre class="lang-none prettyprint-override"><code>name image
</code></pre>
