Difference between revisions of "Kubernetes selectors"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
[[kubectl get pods]] [[--selector]]=app=YOUR_APP -o=[[jsonpath]]='{.items[0].metadata.name}' | [[kubectl get pods]] [[--selector]]=app=YOUR_APP -o=[[jsonpath]]='{.items[0].metadata.name}' | ||
+ | |||
+ | [[kubectl get pods]] --field-selector [[status.]]phase=Running | ||
[[selector:]] | [[selector:]] |
Revision as of 06:08, 4 November 2022
- https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
- https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
kubectl get pods --selector=app=YOUR_APP
kubectl get pods --selector=app=YOUR_APP -o=jsonpath='{.items[0].metadata.name}'
kubectl get pods --field-selector status.phase=Running
selector: ports:
Related
kubectl set selector
- Kubernetes services
- CKA v1.21: Understand how to use Labels, Selector and Annotations
See also
Advertising: