Claiming Persistent Volumes

In this lesson, we will learn why and how to claim a persistent volume.

Usage of Persistent Volumes

Kubernetes persistent volumes are useless if no one uses them. They exist only as objects with relation to, in our case, specific EBS volumes. They are waiting for someone to claim them through the PersistentVolumeClaim resource.

Just like Pods which can request specific resources like memory and CPU, PersistentVolumeClaims can request particular sizes and access modes. Both are, in a way, consuming resources, even though of different types. Just as Pods should not specify on which node they should run, PersistentVolumeClaims cannot define which volume they should mount. Instead, Kubernetes scheduler will assign them a volume depending on the claimed resources.

How to Claim Persistent Volumes?

We’ll use pv/pvc.yml to explore how we could claim a persistent volume.

Get hands-on with 1200+ tech skills courses.