<p>I have a Kubernetes cluster running in minikube, I want to filter out all Logstash pods via Kubernetes API. Kubernetes API documentation is a bit confusing, I did some research and found out that I can use something like this, but I have been unsuccessful so far:</p>

<pre><code>localhost:8000/api/v1/namespaces/default/pods?labelSelector=logstash
</code></pre>

<p>any ideas how to retrieve this? Any help would be really appreciated. </p>

0_o
<blockquote>
  <p>any ideas how to retrieve this?</p>
</blockquote>

<p>Since labels are defined in <code>&lt;name&gt;=&lt;value&gt;</code> pairs you need to supply both, as described in <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" rel="noreferrer">the documentation</a> (see the <code>API</code> section)</p>

<p>As an example, supposing you have:</p>

<ul>
<li>namepace: default</li>
<li>labels on pods you want to select:

<ul>
<li>role=ops</li>
<li>application=logstash</li>
</ul></li>
<li>kubectl proxy runs on localhost:8000</li>
</ul>

<p>Then your api call would look like this:</p>

<pre><code>curl localhost:8000/api/v1/namespaces/default/pods?labelSelector=role%3Dops,application%3Dlogstash
</code></pre>
