Kubernetes persistente volume: hostpath vs local and data persistence Kubernetes persistente volume: hostpath vs local and data persistence kubernetes kubernetes

Kubernetes persistente volume: hostpath vs local and data persistence


A hostPath volume mounts a file or directory from the host node's filesystem into your Pod. So, if you have a multi-node cluster, the pod is restarted for some reasons and assigned to another node, the new node won't have the old data on the same path. That's why we have seen, that hostPath volumes work well only on single-node clusters.

Here, the Kubernetes local persistent volumes help us to overcome the restriction and we can work in a multi-node environment with no problems. It remembers which node was used for provisioning the volume, thus making sure that a restarting POD always will find the data storage in the state it had left it before the reboot.

Once a node has died, the data of both hostpath and local persitent volumes of that node are lost.

Ref: