<p>I have deployed Gitlab to my azure kubernetes cluster with a persistant storage defined the following way:</p>

<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
  name: gitlab-data
  namespace: gitlab
spec:
  capacity:
    storage: 8Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/tmp/gitlab-data"
</code></pre>

<p>That worked fine for some days. Suddenly all my data stored in Gitlab is gone and I don't know why. I was assuming that the <code>hostPath</code> defined PersistentVolumen is really persistent, because it is saved on a node and somehow replicated to all existing nodes. But my data now is lost and I cannot figure out why. I looked up the uptime of each node and there was no restart. I logged in into the nodes and checked the path and as far as I can see the data is gone.</p>

<p>So how do PersistentVolume Mounts work in Kubernetes? Are the data saved really persistent on the nodes? How do multiple nodes share the data, if a deployment is split to multiple nodes? Is <code>hostPath</code> reliable persistent storage?</p>

<p><code>hostPath</code> doesn't share or replicate data between nodes and once your pod starts on another node, the data will be lost. You should consider to use some external shared storage. </p>

<p>Here's the related quote from the official docs:</p>

<blockquote>
  <p>HostPath (single node testing only – local storage is not supported in any way and WILL NOT WORK in a multi-node cluster)</p>
</blockquote>

<p>from <a href="https://kubernetes.io/docs/user-guide/persistent-volumes/" rel="noreferrer">kubernetes.io/docs/user-guide/persistent-volumes/</a> </p>
