We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Labels

Pod names change every time a pod is replaced, so Kubernetes doesn't really keep track of them by name. Instead, it uses labels.

A label is just a key/value pair attached to an object. When you ran kubectl create deployment synergychat-web, Kubernetes gave every new pod this label:

app: synergychat-web

A selector is a query that matches labels. For example, the app=synergychat-web selector matches every pod with that label, no matter what the pod is named:

kubectl get pods -l app=synergychat-web

Labels are important because they're how Kubernetes knows which pods belong to which deployments. The deployment continuously scans for pods matching its label selector, and those are the replicas it counts.

Assignment

  1. kubectl get pods --show-labels

    You'll see the app=synergychat-web label, plus a pod-template-hash label that Kubernetes uses to tell versions of a deployment apart.

Submit the shell checks.