Kubernetes Selector Concepts

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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}'