Kubernetes labels are super useful. If you aren’t familiar with them, a label is a key/value pair assigned in the metadata section (either metadata.labels, or spec.template.metadata.labels) of a deployment manifest. The following example assigns three key/value labels to a deployment:
apiVersion: apps/v1 kind: Deployment metadata: labels: app: nginx group: dse env: staging $ kubectl get deploy nginx -o json | jq '.metadata.labels'
{ "app": "nginx", "env": "staging", "group": "dse" } Labels get super useful when you need to apply an action to multiple resources.
↧