<p>I run the following function from Kubernetes official javascript client, for example :</p>
<pre><code>.listNamespacedPod(&quot;default&quot;, null, &quot;false&quot;, &quot;smth=test&quot;, null, null, null, null, null, null)
</code></pre>
<p>or any other function.</p>
<p>There is a param called labels selector.</p>
<p>Now I would like to find the pods (as in the HTTP request) with the following label selector:</p>
<pre><code>smth=test
</code></pre>
<p>But I cannot send <code>smth=test</code> as a string.</p>
<p>How can I filter by label selector?</p>
<p>This is my metadata from the YAML:</p>
<pre><code>metadata:
  name: label-demo
  labels:
    smth: test 
    app: nginx
</code></pre>
<p>I can run via <code>kubectl</code>:</p>
<pre><code>kubectl -n=&quot;namespace&quot; get deployments -l=smth=test
</code></pre>
<p>so it will return only the matched labels.</p>

Tuz
<p>Based on <a href="https://raw.githubusercontent.com/kubernetes-client/javascript/master/src/gen/api/coreV1Api.ts" rel="noreferrer">CoreV1API</a> and <a href="https://github.com/kubernetes-client/javascript/blob/ed1e579d189c727937df65897303434e2cd120fc/examples/typescript/informer/informer-with-label-selector.ts" rel="noreferrer">this sample</a>, it should be:</p>
<pre><code>.listNamespacedPod(&quot;default&quot;, undefined, &quot;false&quot;, undefined, undefined, &quot;smth=test&quot;)
</code></pre>
<p>It will list all pods with labels <code>smth=test</code> in the <code>default</code> namespace.</p>
