<p>The use case is to get the environment variable *COUNTRY from all the pods running in a namespace </p>

<pre><code>kubectl get pods podname -n namespace -o 'jsonpath={.spec.containers[0].env[?(@.name~="^COUNTRY")].value}'
</code></pre>

<p>This does not seem to work. any lead?</p>

cloudbud
<p>You can retrieve this information using the following command: </p>

<pre><code>kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{.spec.containers[*].env[*].name}{"\t"}{.spec.containers[*].env[*].value}{"\n"}{end}' | grep COUNTRY | cut -f 2
</code></pre>

<p>It will return the variables content as follows:</p>

<pre><code>$ kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{.spec.containers[*].env[*].name}{"\t"}{.spec.containers[*].env[*].value}{"\n"}{end}' | grep VAR | cut -f 2

123456
7890123
</code></pre>
