Hands-on Lab·Certified Kubernetes Administrator
Labels, Selectors and nodeSelector
Labels are the only way anything in Kubernetes finds anything else. Read the labels your cluster gave itself, learn the four selector forms including set-based and negation, then use one to pin a Deployment to a specific node.
Scheduling and Placement Guide 39 of 103 Beginner
- Kubernetes1.36.4
- Cluster4 nodes
- Runtimecontainerd 2.2.6
- CNICalico v3.32.1
- TimeAbout 25 min
- Reviewed21 August 2026
Written against the versions above. Node names and ages are this lab's. The built-in label set is standard.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA1001 | 192.168.0.175 | Ubuntu 26.04 LTS | Control Plane Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE01 | 192.168.0.176 | Ubuntu 26.04 LTS | Worker Node (labelled disk=ssd) | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE02 | 192.168.0.177 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE03 | 192.168.0.178 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
Before you start
- A cluster with a few nodes and
kubectl. - Permission to label nodes, which is cluster-scoped.
- Nothing else. This is the mechanism everything else in Kubernetes is built on, so it is worth doing early.
-
Your cluster is already covered in labels
-
Add your own
-
Four ways to select
-
Use a label to place a workload
-
Remove the labels