What is the difference between a StatefulSet and a Deployment?
⚡
Quick Answer
A Deployment runs interchangeable, stateless replicas with no stable identity. A StatefulSet gives each pod a stable, ordinal identity (pod-0, pod-1), stable DNS, and its own persistent volume, with ordered rollout and scaling.
Detailed Answer
Use a Deployment for stateless services behind a load balancer where any replica is as good as another. Use a StatefulSet for databases, Kafka, ZooKeeper, and other clustered/stateful systems that need stable network names, per-pod storage that survives rescheduling, and ordered operations for quorum safety.
💡
Interview Tip
Contrast interchangeable vs stable identity, and name databases/Kafka as the StatefulSet use case.
kubernetesstatefulsetdeployment