Filter Kubernetes API by pod name Filter Kubernetes API by pod name kubernetes kubernetes

Filter Kubernetes API by pod name


any ideas how to retrieve this?

Since labels are defined in <name>=<value> pairs you need to supply both, as described in the documentation (see the API section)

As an example, supposing you have:

  • namepace: default
  • labels on pods you want to select:
    • role=ops
    • application=logstash
  • kubectl proxy runs on localhost:8000

Then your api call would look like this:

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