Overview
Unlike a Deployment, a StatefulSet maintains a sticky identity for each of its Pods. These pods are created from the same spec, but are not interchangeable; each has a persistent identifier that it maintains across any rescheduling.
Key Features
- Stable Network ID: Pods have predictable names (e.g.,
web-0,web-1). - Stable Storage: Each Pod gets its own Persistent Volume that stays with it even if the Pod is moved to a different node.
- Ordered Deployment/Scaling: Pods are created and deleted in a specific, sequential order.
Use Cases
- Databases (e.g., MySQL, PostgreSQL, MongoDB).
- Distributed systems that require stable network identities (e.g., Kafka, ZooKeeper).