<p>I have a lot of namespaces and I want to get all pods from a sub-list of namespaces.</p>
<p>For getting all the pods from all namespace the command is:</p>
<pre><code>kubectl get pods --all-namespaces   
</code></pre>
<p>To get all pods from a spesific namespace the command is:</p>
<pre><code>kubectl get pods -n namespace-name
</code></pre>
<p>However I can't find a way to get all pods from a list of namespaces, something like:</p>
<pre><code>kubectl get pods -n namespace-name1, namespace-name2, namespace-name3 
</code></pre>
<p>what is the right command for that?</p>

Dean Taler
<p>kubectl does not support this. You can use egrep to filter the list of all pods by namespaces:</p>
<pre><code>kubectl get pods -A | egrep '^(namespace-name1|namespace-name2|namespace-name3)'
</code></pre>
<p>Because <code>kubectl</code> prints the namespace at the beginning of the line, it greps for a line start <code>^</code> followed by one of the namespace names.</p>
