Skip to content

4.3. StatefulSets

Overview​

The StatefulSets page manages every StatefulSet held on the MCM control plane in one place. A StatefulSet is the workload for applications that need to keep state; it provides a fixed network identity and persistent storage.

What it is for:

  • Managing multi-cluster StatefulSets together
  • Deploying and scaling stateful applications
  • Guaranteeing pod order and uniqueness
  • Checking the PropagationPolicy and OverridePolicy

Where StatefulSets are used:

  • Databases (MySQL, PostgreSQL, MongoDB, and so on)
  • Message queues (Kafka, RabbitMQ, and so on)
  • Distributed storage (Cassandra, Elasticsearch, and so on)
  • Applications that need to keep state

How the Screen Is Laid Out​

The StatefulSets page shows the StatefulSet list as a table.

The StatefulSets main screen

The Elements at the Top of the Page​

ElementDescription
Namespace filterShows only the StatefulSets of a particular namespace
Refresh buttonRefreshes the StatefulSet list
Create buttonOpens the dialog for creating a new StatefulSet
Search boxSearches by StatefulSet name

Table Columns​

ColumnDescriptionSortable
NameThe StatefulSet name✅
NamespaceThe namespace the StatefulSet belongs to✅
StatusReady pods / desired pods✅
ImageThe container image name✅
AgeThe time since the StatefulSet was created✅
ActionsThe edit and delete buttons-

How Status Is Shown​

The Status column is shown as ready / desired:

  • 2/2: both replicas are Ready
  • 1/2: only 1 of 2 replicas is Ready

StatefulSet Detail​

Clicking a StatefulSet row opens the detail panel.

StatefulSet detail

The Detail Panel Header​

ElementDescription
StatefulSet nameThe name of the chosen StatefulSet
NamespaceThe namespace the StatefulSet belongs to
Sync StatusThe N/N pod-ready figure

The Action Buttons​

ButtonWhat it does
Scale DownLowers the replica count
Scale UpRaises the replica count
RestartRolling-restarts the StatefulSet
RefreshRefreshes the StatefulSet information
EditOpens the YAML edit mode
DeleteDeletes the StatefulSet

The Tabs​

The Overview Tab​

Shows the StatefulSet's basic information, replica state, and the settings particular to a StatefulSet.

Basic information:

ItemDescription
NameThe StatefulSet name
NamespaceThe namespace the StatefulSet belongs to
StatusN/N ready
AgeThe time since creation
CreatedWhen the StatefulSet was created

Replica state:

ItemDescription
Pod ready stateN / N pods ready (with a progress bar)
Desired ReplicasThe replica count that is set
Ready ReplicasThe number of replicas that are Ready
Current ReplicasThe number of replicas running now
Updated ReplicasThe number of replicas updated to the latest version

Pod state:

The pod state section shows the StatefulSet's pods visually:

  • Running: pods working normally
  • Pending: pods waiting to be scheduled
  • Failed: pods that failed

StatefulSet Info:

Shows the settings particular to a StatefulSet:

ItemDescription
Service NameThe headless service name (which provides the stable network identity)
Pod Management PolicyOrderedReady or Parallel
Update StrategyRollingUpdate or OnDelete

Container images:

Shows the list of container images defined on the StatefulSet.

The Multi-Cluster Policies Tab​

Shows the multi-cluster policies that apply to the StatefulSet.

The multi-cluster policies tab

PropagationPolicy:

ColumnDescription
NameThe PropagationPolicy name
NamespaceThe namespace the policy belongs to
ScopeNamespace-scoped policies / cluster-scoped policies
Target ClustersThe list of target clusters

OverridePolicy:

Shown where there are per-cluster custom settings.

The Labels Tab​

Shows the list of Kubernetes labels applied to the StatefulSet.

The Annotations Tab​

Shows the list of annotations applied to the StatefulSet.

The Pods Tab​

Shows the list of pods running for that StatefulSet.

The Pods tab
ColumnDescription
NameThe pod name (my-statefulset-0, my-statefulset-1, for example)
ClusterThe cluster the pod is running on
StatusThe pod state (Running / Pending / Failed and so on)
NodeThe node the pod is scheduled on
RestartsThe pod restart count
AgeThe time since the pod was created
ActionsThe view and delete buttons

Note: StatefulSet pods carry sequential names (my-statefulset-0, my-statefulset-1, for example). Pods of the same name are created on each cluster.

The Events Tab​

Shows the Kubernetes events related to the StatefulSet.

Creating a StatefulSet​

Creates a new StatefulSet on the MCM control plane.

Fields​

FieldRequiredDescription
Name✅The StatefulSet name
Namespace✅The namespace to deploy into
Service Name✅The headless service name
Replicas✅The initial replica count (default: 1)
Container image✅The container image URL
Volume claim template-The PersistentVolumeClaim template
Ports-The container port settings
Environment variables-The container environment variables

Editing the YAML​

The "Edit YAML" tab lets you write the StatefulSet definition directly.

StatefulSet Operations​

Scaling Up and Down​

Adjusts the StatefulSet's replica count.

  1. Choose the StatefulSet
  2. Press the scale up (▲) or scale down (▼) button
  3. The replica count rises or falls

Note: StatefulSet scaling happens in order:

  • Scaling up: pods are created in the order 0, 1, 2...
  • Scaling down: pods are deleted in reverse, ...2, 1, 0

Rolling Restart​

Restarts every pod of the StatefulSet in turn.

  1. Choose the StatefulSet
  2. Press the "Restart" button in the detail panel
  3. Press the "Restart" button in the confirmation dialog

The restart proceeds in reverse (from the last pod to the first).

Editing a StatefulSet​

  1. Choose the StatefulSet
  2. Press the "Edit" button in the detail panel
  3. Change the StatefulSet definition in the YAML editor
  4. Press the "Save" button

Deleting a StatefulSet​

⚠️ Caution: deleting a StatefulSet does not delete its PersistentVolumeClaims automatically. The PVCs have to be managed separately to preserve the data.

  1. Choose the StatefulSet to delete
  2. Press the "Delete" button in the detail panel
  3. Type the StatefulSet name in the confirmation dialog
  4. Press the "Delete" button

Worked Examples​

Scenario 1: Deploying a Database Across Clusters​

  1. Press the "Create" button
  2. Enter the StatefulSet details:
    • Name: mysql
    • Namespace: database
    • Service Name: mysql-headless
    • Replicas: 3
    • Container image: mysql:8.0
  3. Set the volume claim template:
    • Storage class: standard
    • Capacity: 10Gi
  4. Press the "Create" button
  5. Name the target clusters with a PropagationPolicy

Scenario 2: Checking StatefulSet Status​

  1. Click the StatefulSet you want to check in the list
  2. Check the replica state on the Overview tab
  3. Check the service name and management policy in StatefulSet Info
  4. Check the pod distribution per cluster on the Pods tab
  5. Confirm the pod names are sequential (my-statefulset-0, my-statefulset-1)

Scenario 3: Scaling Out​

  1. Choose the StatefulSet to scale out
  2. Press the "Scale Up" button
  3. Watch the new pod being created in order (my-statefulset-2, for example)
  4. The next pod is created only after that one becomes Ready

Scenario 4: A Rolling Update​

  1. Choose the StatefulSet and press "Edit"
  2. Change the container image version (mysql:8.0 → mysql:8.1, for example)
  3. Press "Save"
  4. Watch the update proceed in reverse:
    • my-statefulset-2 → my-statefulset-1 → my-statefulset-0
  5. Each pod updates only after the previous one becomes Ready

Scenario 5: Checking the Pods per Cluster​

  1. Choose the StatefulSet
  2. Click the "Pods" tab
  3. Check the pod of the same name on each cluster:
    • Cluster A: my-statefulset-0
    • Cluster B: my-statefulset-0
  4. Check each pod's node, status, and restart count

StatefulSet against Deployment​

TraitStatefulSetDeployment
Pod nameSequential and fixed (app-0, app-1)Random (app-abc123)
Network identityStable (a headless service)Dynamic
StoragePersistent (the PVC is kept)Ephemeral
OrderCreation and deletion order guaranteedNo order
ScalingSequentialParallel
Where it is usedDatabases, stateful appsStateless web apps

Pod Management Policies​

OrderedReady (the default):

  • Pods are created and deleted in order
  • The next pod is created only after the previous one is Ready
  • Suited to building a database cluster

Parallel:

  • Every pod is created and deleted at once
  • Used where order does not matter
  • Used where fast scaling is needed

Update Strategies​

RollingUpdate (the default):

  • Updates the pods in reverse (last to first)
  • partition: updates only the pods at or above a given index

OnDelete:

  • A pod updates only when it is deleted by hand
  • Used where complete control is needed

The Headless Service​

A StatefulSet is used together with a headless service:

  • A service whose ClusterIP is None
  • It gives each pod its own DNS name
  • For example mysql-0.mysql-headless.database.svc.cluster.local

Managing PersistentVolumeClaims​

A StatefulSet's volume claim template:

  • Creates its own PVC per pod
  • The PVC is kept when the StatefulSet is deleted (preserving the data)
  • The PVC has to be deleted by hand

Next Steps​