From the course: Certified Kubernetes Application Developer (CKAD) Cert Prep

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Labels, selectors, and annotations

Labels, selectors, and annotations

- Let's talk about labels and selectors. A label is a very important key-value pair that is commonly used in Kubernetes. You really find labels everywhere. And if I may give you one advice, if you want to be successful on your exam, make sure that you know everything about labels and how labels are used to connect resources together. Now if you create a deployment using kubectl create deploy, then your deployment will automatically get the label app is deploymentname. Pods that are started with the kubectl run command automatically get the label run is podname. The purpose of the label is to connect different objects and that's why they are so very important. Deployments track pods by using labels. Services connect to pods also by using labels. And the selector is used on resources to specify which label to track. As a command line argument, you can use --selector to filter output based on the presence of a label. Let's check this out. So let me start by kubectl create deploy webapp -…

Contents