Kubernetes Selector Concepts

From NovaOrdis Knowledge Base
Revision as of 00:40, 6 February 2022 by Ovidiu (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

Example

...
selector:
  matchLabels:
    color: blue
...

Query by Selector

Get the namespace of the first pod from a series that has an "app=my-app" label.

kubectl get -A pods --selector=app=my-app -o jsonpath='{.items[0].metadata.namespace}'