<p>What is the main difference between hostpath and local persistent volume in Kubernetes?</p>
<p>Assuming  I have a kubernetes cluster running on my machine with a pod running a database that uses a local persistent volume to save data, if the whole cluster fail (for example shutting down the machine), at the next start of the machine (and cluster) there would no longer be a trace of the data previously saved by the pod in the persistent volume, is that correct?</p>

Marco
<p>A <code>hostPath</code> 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 <strong>work well only on single-node clusters</strong>.</p>
<p>Here, the Kubernetes <code>local persistent volumes</code> help us to overcome the restriction and we <strong>can work in a multi-node environment</strong> 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.</p>
<p>If a node storage dies completely and beyond repair (RAID usually prevents it), <strong>data of both <code>hostpath</code> and <code>local persitent</code> volumes of that node can be lost.</strong></p>
<p><strong>Ref:</strong></p>
<ul>
<li><a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="noreferrer">https://kubernetes.io/docs/concepts/storage/volumes/#hostpath</a></li>
<li><a href="https://vocon-it.com/2018/12/20/kubernetes-local-persistent-volumes/" rel="noreferrer">https://vocon-it.com/2018/12/20/kubernetes-local-persistent-volumes/</a></li>
</ul>
