Persistent volumes
Persistent volumes hold some key advantages over regular Kubernetes volumes. As mentioned previously, their (persistent volumes) lifecycle is tied to the life of the cluster, not the life of a single Pod. This means that persistent volumes can be shared between Pods and reused as long as the cluster is running. For this reason, the pattern matches much better to external stores such as EBS (a block storage service on AWS) since the storage itself outlasts a single Pod.
Using persistent volumes actually requires two resources: the PersistentVolume
itself and a PersistentVolumeClaim
, which is used to mount a PersistentVolume
to a Pod.
Let's start with the PersistentVolume
itself – take a look at the basic YAML for creating a PersistentVolume
:
pv.yaml
apiVersion: v1 kind: PersistentVolume metadata:   name: my-pv spec:   storageClassName: manual   capacity:     storage: 5Gi   accessModes...