In Kubernetes, what is the main difference in purpose between labels and annotations?
Think about how Kubernetes selects objects versus storing extra info.
Labels are key-value pairs used to select and organize Kubernetes objects. Annotations store additional metadata that is not used for selection.
Given a pod with label app=web and annotation description=frontend, what is the output of kubectl get pods --show-labels?
kubectl get pods --show-labelsLabels appear with --show-labels, annotations do not.
The --show-labels flag shows only labels, not annotations.
Which YAML snippet correctly adds a label tier=backend and an annotation owner=teamA to a pod spec?
Labels and annotations are separate maps under metadata.
Labels and annotations are separate keys under metadata, each with their own key-value pairs.
You have a pod with annotation env=prod but no labels. You run kubectl get pods -l env=prod but get no results. Why?
Think about what selectors use to find objects.
Label selectors only match labels. Annotations are ignored by selectors.
You want to store a large JSON string describing deployment details on a pod. Which is the best practice?
Consider size limits and purpose of labels vs annotations.
Annotations are designed to hold large, non-identifying metadata. Labels should be small and used for selection.