<p>It is possible to get all the pods on the cluster:</p>

<pre><code>kubectl get pod --all-namespaces -o wide
</code></pre>

<p>It is also possible to get all pods on the cluster with a specific label:</p>

<pre><code>kubectl get pod --all-namespaces -o wide --selector some.specific.pod.label
</code></pre>

<p>It is even possible to get all pods on the specific node of the cluster:</p>

<pre><code>kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=&lt;node&gt;
</code></pre>

<p>The question is, how to get all pods from the namespaces with a particular label?</p>

<p>e.g. <code>kubectl get pod --namespace-label some.specific.namespace.label -o wide</code> (pseudocode)</p>

<p>One cannot do that operation in one shot, because labels on <code>Namespace</code> objects are not propagated down upon their child objects. Since <code>kubectl</code> is merely doing a <code>GET</code> on <code>/api/v1/whatevers</code> there is no obvious way to make a REST request to two endpoints at once and join them together.</p>
<p>You'll want either a <code>for</code> loop in shell, or to use one of the many API client bindings to create a program that does the <code>Namespace</code> fetch, then a <code>Pod</code> fetch for those matching <code>Namespaces</code>; for example:</p>
<pre class="lang-sh prettyprint-override"><code>for n in $(kubectl get ns --selector some.specific.namespace.label -o name); do
    # it's possible kubectl -n will accept the &quot;namespace/foo&quot; output of -o name
    # or one can even -o go-template='{{ range .items }}{{ .metadata.name }} {{ end }}'
    n=${n##namespace/}
    kubectl -n &quot;$n&quot; get pods -o wide
done
</code></pre>
