10 Persisting Data with PersistentVolumes
This chapter covers
- Using PersistentVolume objects to represent persistent storage
- Claiming PersistentVolumes with PersistentVolumeClaims
- Static and dynamic provisioning of PersistentVolumes
- Node-local versus network-attached storage
- Snapshotting, cloning, and restoring volumes using the VolumeSnapshot resource
- Long-lived versus ephemeral PersistentVolumes
The previous chapter taught you how to mount ephemeral storage volumes into your Pods. In this chapter, you’ll learn how to do the same for persistent storage volumes, which can be either node-local or network-attached.
Note
You’ll find the code files for this chapter at https://github.com/luksa/kubernetes-in-action-2nd-edition/tree/master/Chapter09
10.1 Introducing persistent storage in Kubernetes
Ideally, a developer deploying their applications on Kubernetes shouldn’t need to know what storage technology the cluster provides, just as they don’t need to know the properties of physical servers running the Pods. Infrastructure details should be managed by the people who operate the cluster.
For this reason, when deploying an application on Kubernetes, you typically don’t refer to a specific persistent storage volume. Instead, you specify that you need persistent storage with certain properties, and the cluster either finds an existing volume that matches those properties or provisions a new one.