When containerization was first introduced, early adoption was mainly for stateless services. Today, data-centric applications in the cloud are adopting containers with the introduction of Persistent Volumes, making it possible to store, retain, and backup container-based data.
Persistent Volumes let you introduce consistency by ensuring that a database has access to its data at all times. This means you can use Kubernetes for databases, such as MySQL and Cassandra. Once data is consistent, you can add complex workloads, including both stateless and stateful code, into your containers.
Persistent Volumes help simplify the deployment of stateful, distributed applications. In this case, you need to ensure that each pod is created with the relevant configuration and environment variables. Then, according to the specifications of a PVC, a PV is matched with a pod that meets the requirements. The storage is then mounted inside the pod. This process enables you to easily scale and maintain the state of the pods and quickly replace resources in case of failure.
Related content: read our guide to Kubernetes pods (coming soon)