We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
This idea carries a full system design question on its own. Each walks through the full answer.
System Design Masterclass · Kubernetes Containers
Free preview: the first 2 parts of this 8-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Kubernetes Containers
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
Deployments treat pods as interchangeable cattle. Pods get random names (nginx-7f89b4-x9k2m), random IPs, and no persistent identity. When a pod is replaced, the new pod is a complete stranger with a different name, different IP, and different storage.
Databases need the opposite. A PostgreSQL replica needs a stable hostname so the primary can always reach it at db-1.db-svc. A broker needs a stable identity so it can own specific partitions across restarts. Strimzi (the most popular Kafka operator) explicitly requires StatefulSets because Kafka's partition assignment is tied to broker IDs. An Elasticsearch node needs to rejoin the cluster with the same identity after a restart, reconnecting to its existing data shards.
StatefulSets provide what stateful applications need: stable network identities (pod-0, pod-1, pod-2, not random hashes), ordered deployment (pod-0 starts before pod-1), persistent storage per pod (each pod gets its own PVC that follows it across restarts), and ordered scaling (scale up adds to the end, scale down removes from the end).