Skip to content
StackDecode
BeginnerLesson 4 of 35

Labels, selectors and annotations

Labels are how Kubernetes groups and finds things.

Labels are key-value tags on objects. Selectors match them: a Service picks its pods, a Deployment manages its pods, you filter with -l.

bash
kubectl get pods -l app=web,tier=frontend
kubectl label pod hello env=dev
kubectl get pods --show-labels

Annotations are also key-value metadata, but not used for selection. They hold things like descriptions, tool settings and build info.