How to Use a Local Persistent Volume


TL;DR: A local persistent volume in a Kubernetes cluster is a persistent volume allocated in a certain node. Any pod mounting the volume will be automatically scheduled in the same node.

Since it’s limited to 1 node, clearly it can’t be used as a high-availability solution, but hey, it’s quite Ok to use it for experiments in a garage Kubernetes cluster.

Here’s a quick sample to provision a local PV(persistentVolume):

YAML

To claim the PV, the PVC(persistentVolumeClaim) looks like this:

YAML

And that’s it. The PV can be used by a pod now.

YAML

🙂

,