label
What is label?
label: A key/value tag attached to objects. The glue of Kubernetes — Services, selectors, and tooling all match on labels. Labels are key and value tags attached to Kubernetes objects, such as app: web or env: production. They are how Kubernetes connects things. A Service finds its pods through a label selector. A Deployment knows which pods it manages through labels. kubectl get pods -l app=web filters by them, and monitoring tools use them to group data.
Frequently asked questions about label
What should you keep in mind with label?
Use a consistent set of labels across all your resources. Kubernetes recommends keys like app.kubernetes.io/name and app.kubernetes.io/component. Be careful when changing labels on a running Deployment: if the selector no longer matches, the connection between objects breaks. Selectors on Deployments cannot be changed at all after creation, so choose them carefully the first time.
What does an example of label look like?
metadata: labels: app: web tier: frontend env: prod At a glance
| Category | Kubernetes |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |