This chapter covers
- The Kubernetes constructs used to represent disks and state
- Adding persistent storage to Pods
- Deploying a multiple-Pod stateful application with a leader role using StatefulSet
- Migrating and recovering data by relinking Kubernetes objects to disk resources
- Giving Pods large ephemeral storage volumes
Stateful applications (i.e., workloads that have attached storage) finally have a home with Kubernetes. While stateless applications are often lauded for their ease of deployment and high scalability, helped greatly by avoiding the need to attach and manage storage, that doesn’t mean that stateful applications don’t have their place. Whether you’re deploying a sophisticated database or are migrating an old stateful application from a virtual machine (VM), Kubernetes has you covered.
Using persistent volumes, you can attach stateful storage to any Kubernetes Pod. When it comes to multi-replica workloads with state, just as Kubernetes offers Deployment as a high-level construct for managing a stateless application, StatefulSet exists to provide high-level management of stateful applications.