Stateful Workloads and Storage
Volumes
On-disk files in a container are ephemeral, which presents some problems for non-trivial applications when running in containers. Kubernetes Volumes solve this by persisting data across pod crashes and restarts.
Persistent Volumes (PV) and Claims (PVC)
- PersistentVolume (PV): A piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes.
- PersistentVolumeClaim (PVC): A request for storage by a user. It is similar to a Pod. Pods consume node resources and PVCs consume PV resources.
StatefulSets
StatefulSet is the workload API object used to manage stateful applications. Unlike a Deployment, a StatefulSet maintains a sticky identity for each of their Pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.