<p>The kubernetes documentation <a href="https://kubernetes.io/docs/tasks/access-application-cluster/list-all-running-container-images/#list-container-images-by-pod" rel="nofollow noreferrer">includes</a> an example command for listing container images by pod:</p>
<blockquote>
<p><strong>List Container images by Pod</strong></p>
<p>The formatting can be controlled further by using the range operation to iterate over elements individually.</p>
<pre><code>kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{&quot;\n&quot;}{.metadata.name}{&quot;:\t&quot;}{range .spec.containers[*]}{.image}{&quot;, &quot;}{end}{end}' |\
sort
</code></pre>
</blockquote>
<p>When I run this command in my Debian WSL2 instance, it correctly lists the containers for each pod I have running across all namespaces.</p>
<p>When I run the same command in the Windows commandline, I get an error: <code>error: a resource cannot be retrieved by name across all namespaces</code>:</p>
<pre><code>C:\workspace&gt;kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{&quot;\n&quot;}{.metadata.name}{&quot;:\t&quot;}{range .spec.containers[*]}{.image}{&quot;, &quot;}{end}{end}' | sort
error: a resource cannot be retrieved by name across all namespaces
</code></pre>
<p>Is this a bug with kubectl, or is this command *nix only? Is there an OS-independent command for getting container images by pod across all namespaces?</p>
<p>(I'm running Debian on WSL2, Windows 10 Enterprise. Docker Desktop using WSL2 integration, K8S with minikube.)</p>

Roddy of the Frozen Peas
<p>From k8s offical <a href="https://kubernetes.io/docs/reference/kubectl/jsonpath/" rel="nofollow noreferrer">doc</a>:</p>
<blockquote>
<p>On Windows, you must double quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote around any literals in the template. For example: <code>kubectl get pods -o=jsonpath=&quot;{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}{end}&quot;</code></p>
</blockquote>
<p>I think this will solve your problem.</p>
