Hands-on Lab·Certified Kubernetes Application Developer
Blue-Green Deployments with Service Selectors
Blue-green needs no special tooling in Kubernetes. Run both versions as separate Deployments, point one Service at whichever should receive traffic, and cut over by patching the Service's selector. The switch is instant and complete, the rollback is the same command backwards, and the old version is still running the whole time.
Application Deployment Guide 17 of 44 Intermediate
- Kubernetes1.36.4
- Runtimecontainerd 2.2.6
- CNICalico v3.32.1
- TimeAbout 14 min
- Reviewed23 August 2026
Written against the versions above. A Service selector is plain equality on Pod labels, re-evaluated continuously by the endpoints controller. Patching it does not restart anything and does not touch either Deployment - the EndpointSlice is simply recomputed, typically within a second.
| 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 | 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 and kubectl.
- The session creates namespace
ckad-bgwith Deploymentsblueandgreen(two replicas each, serving different text), a Servicesiteselecting blue, and aclientPod.
-
Two versions running at once
-
The Service only sees one of them
-
Flip it
-
And back