Member-only story
DevOps in K8s — Storage, Local PV
Note, full “DevOps in K8s” mind map is available at: “DevOps in K8s Mind Map”
Why we Need Local PV?
Previously we created a PV (Persistent Volume) resource object with the backend type of hostPath
. We also mentioned that using hostPath
has one limitation: the Pods can’t freely migrate and must be tied to a specific node. This is because if it migrates to another node, the host machine might not have the corresponding data. Therefore, when using hostPath
, we often pair it with nodeSelector
.
However, there are clear advantages to using hostPath. Since the PV uses the local disk directly, especially SSDs, its read-write performance is much better compared to most remote storage solutions. Therefore, for applications that have high disk IO requirements, such as etcd, it’s very practical.
Nonetheless, compared to regular PVs, nodes that utilize hostPath
might lose data if they crash. Hence, applications using hostPath must have the ability to back up and restore data, allowing for periodic backups at other locations.
Based on hostPath, K8es has introduced a new feature with PV and PVC (Persistent Volume Claim) called Local Persistent Volume, or what we refer to as Local PV.