KubeDojo

StatefulSets

AK
by Alexis Kinsella··16 min read
StatefulSets

You scale a database Deployment from 3 to 5 replicas, and the new Pods come up with fresh storage, random names like postgres-7f8b6d4bc-x2k9p, and no way to rejoin the existing cluster. The old nodes don't recognize them. This is the exact problem StatefulSets solve. Databases need stable storage that follows a specific instance. Consensus systems like etcd need predictable peer addresses before they can form a cluster. Message brokers need ordered startup so leaders come up before followers.

StatefulSets exist for these workloads. They give each Pod three things a Deployment never will: a stable ordinal identity, a predictable DNS name, and dedicated persistent storage that survives rescheduling. The CKAD exam tests this under "Application Design and Build" (20%), and the distinction between "use a Deployment" and "use a StatefulSet" shows up in both exam tasks and production architecture decisions.

Sign in to access this lesson

Create a free account or sign in to enroll in the CKAD — Certified Kubernetes Application Developer course and access all 44 lessons.

CKAD — Certified Kubernetes Application Developer

44 lessons

Browse the full course curriculum →