Stateful Sets

Workload API used in Kubernetes for managing stateful applications.

A Stateful Set is a specialized API object in AKS designed to manage the deployment and scaling of a set of Pods and provide guarantees about the ordering and uniqueness of these Pods.

Characteristics of Stateful Sets

Stateful Sets are crucial for managing stateful applications which typically have the following requirements:

  • Stable Unique Network Identifiers: Ensures each pod gets a stable hostname, formatted as ...svc.cluster.local.
  • Stable, Persistent Storage: Leverages volumes created based on persistent volume claims included in the Stateful Set, maintaining data persistence across restarts by attaching storage to specific pod instances.
  • Ordered, Graceful Deployment and Scaling: Manages the creation and termination of pods in a sequential manner, maintaining the order from 0 to N-1, where N represents the desired replica count.
  • Ordered, Automated Rolling Updates: Implements updates in reverse ordinal order and ensures orderly termination of pods.

Applicability of Stateful Sets

Stateful Sets are particularly useful for deploying applications like databases which necessitate:

  • A stable and unique network identifier for reliable referencing.
  • Persistent storage to host application data.
  • Controlled and stable scaling and updates to maintain service reliability.

Example:

For deploying a database in AKS, utilizing a Stateful Set is optimal as it addresses the inherent need for stable unique IDs, persistent storage, and orderly, reliable scaling and updates.

Last modified July 21, 2024: update (e2ae86c)