A Kubernetes StatefulSet manages stateful applications on Kubernetes.

It is used when each replica needs a stable identity, stable storage, or ordered startup and shutdown.

Why use it

StatefulSets are useful for systems such as:

  • Databases
  • Message brokers
  • Distributed storage systems
  • Clustered applications that need stable member names

How it differs from a Deployment

A Kubernetes Deployment treats replicas as mostly interchangeable.

A StatefulSet gives each Pod a stable name and identity, such as app-0, app-1, and app-2.

StatefulSets are commonly paired with Persistent Volume Claims so each replica keeps its own storage.