CertGrid CertGrid
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

Written against the versions above. Node names and ages are this lab's. The built-in label set is standard.

Four nodes. Only node01 gets labelled, which is what makes the selectors demonstrable.
Server NameIP AddressOSRolesCPURAMHDD
CKA1001192.168.0.175Ubuntu 26.04 LTSControl Plane Node2 Core4 GB50 GB
CKA1001-NODE01192.168.0.176Ubuntu 26.04 LTSWorker Node (labelled disk=ssd)2 Core4 GB50 GB
CKA1001-NODE02192.168.0.177Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB
CKA1001-NODE03192.168.0.178Ubuntu 26.04 LTSWorker Node2 Core4 GB50 GB

Before you start

  1. Your cluster is already covered in labels

  2. Add your own

  3. Four ways to select

  4. Use a label to place a workload

  5. Remove the labels

Official sources