Labels

  • Labels are key value pairs attached to pods, deployments, services

  • For users to identify attributes of object

  • Unique per object

Labels with Selectors

Labels with selectors let you identify specific set of objects

  • Equality based selector: labels equal/unequal

  • Set based selector: labels in/not in/exists

  • Used with kubectl

$ kubectl create -f helloworld-pod-with-labels.yml
$ kubectl get pods
$ kubectl get pods - -show-labels

Assigning labels to running Pods

Overwrites the app name

Overwrites author name

Deletes the label author

Last updated

Was this helpful?