<p>I need to retrieve a list of pods by selecting their corresponding labels.
When the pods have a simple label <code>app=foo</code>, <code>k8s-app=bar</code>, the selection is quite easy:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl get po -l 'app in (foo), k8s-app in (bar)'
</code></pre>
<p>The complexity comes with labels that contain special characters, for example: <code>app.kubernetes.io/name=foo</code>
So when I query only this label, I don't have a problem, but if I try to add this label to the existing query, it will end by returning <code>no resources were found</code>.</p>
<pre class="lang-sh prettyprint-override"><code>kubectl get po -l app.kubernetes.io/name=foo,app=bar
kubectl get po -l 'app.kubernetes.io/name in (foo), app in (bar)'
</code></pre>
<p>Any idea how can I join the two labels in a single query?</p>

Tomer Leibovich
<p>You can use below command for retrieving a list of pods by selecting their corresponding labels.</p>
<pre><code>kubectl get pods --selector app=foo,k8s-app=bar
</code></pre>
