Hands-on Lab·Certified Kubernetes Administrator
StatefulSets: Stable Identity and Ordered Startup
A Deployment's Pods are interchangeable and get random names. A StatefulSet's are numbered, start in order, keep their own volume, and get their own DNS name. Build one with a headless Service and per-Pod storage, delete a Pod to watch it come back as itself, then see the PVCs survive the StatefulSet's deletion.
Workloads Guide 28 of 103 Intermediate
- Kubernetes1.36.4
- Cluster4 nodes
- StorageClasslocal-path (default)
- CNICalico v3.32.1
- TimeAbout 40 min
- Reviewed21 August 2026
Written against the versions above. PV names, UIDs and addresses are generated per run. The StorageClass here is local-path; any dynamic provisioner behaves the same for this exercise.
| 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 with a default StorageClass. Check with
kubectl get sc; without one,volumeClaimTemplatesproduce PVCs that stay Pending forever. - The Deployments guide. The contrast with a Deployment is the point of this one.
- Enough room for three small volumes. This uses 64Mi each.
-
Two objects, because identity needs a name to resolve
-
Numbered names and staggered ages
-
One volume per Pod, provisioned automatically
-
Per-Pod DNS from the headless Service
-
Delete a Pod and watch it come back as itself
-
The PVCs outlive the StatefulSet
-
Clean up, storage included