Home

StatefulSets

StatefulSets are a Kubernetes workload API object designed to manage stateful applications. They provide guarantees about the ordering and uniqueness of pod identities and stable, persistent storage across rescheduling, which makes them well suited for databases and other stateful services.

Key features include stable network identities, stable storage, and ordered deployment, scaling, and termination. Each Pod

The StatefulSet controller manages pod lifecycle with an emphasis on ordering. Pods are created, scaled, updated,

Update strategies include RollingUpdate and OnDelete. The default RollingUpdate proceeds in order, allowing controlled upgrades, while

Typical use cases include databases (such as MySQL, PostgreSQL), distributed systems (like etcd, Zookeeper, Cassandra), and

in
a
StatefulSet
has
a
predictable,
DNS-resolvable
hostname,
and
the
cluster
uses
a
headless
service
(a
service
with
clusterIP:
None)
to
enable
stable
DNS
for
the
pods.
Stable,
unique
storage
is
achieved
through
volumeClaimTemplates,
which
create
a
per-pod
persistent
volume
that
persists
across
restarts
and
rescheduling.
Pods
receive
a
unique
ordinal
index
(for
example,
0,
1,
2),
which
contributes
to
their
stable
identity
and
storage
association.
and
terminated
in
ordinal
order,
and
the
system
waits
for
each
Pod
to
become
ready
before
proceeding
to
the
next.
This
ordering
also
applies
to
scaling
down,
where
higher
ordinals
are
terminated
first.
OnDelete
defers
updates
until
a
Pod
is
manually
deleted,
offering
fine-grained
control
over
changes.
other
services
requiring
stable
network
identity
and
durable
storage.
Limitations
include
the
need
for
persistent
storage
provisioning,
potential
performance
considerations
for
large-scale
deployments,
and
the
inherent
sequential
nature
of
operations
which
can
affect
upgrade
and
scale-out
speed.