Kubernetes selectors
- https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
- https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
Examples
kubectl get pods --selector=app=YOUR_APP
kubectl get pods --selector=app=YOUR_APP -o=jsonpath='{.items[0].metadata.name}'
selector:
app=elasticsearch-master chart=elasticsearch release=elasticsearch-prod
spec: podSelector: matchLabels: app: elasticsearch-master
apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: zk-pdb spec: minAvailable: 2 selector: matchLabels: app: zookeeper
kind: AWSNodeTemplate spec: subnetSelector: karpenter.sh/discovery: ${CLUSTER_NAME} securityGroupSelector: karpenter.sh/discovery: ${CLUSTER_NAME}
Related
kubectl set selector
- Kubernetes services
- Kubernetes field selectors
- CKA v1.21: Understand how to use Labels, Selector and Annotations
0/2 nodes are available: 1 Too many pods, 1 nodes(s) didn't match Pod's node affinity/selector
See also
Advertising: