<p>I have created one Persistent volume in GCP k8s cluster </p>

<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
 name: test
 labels:
  type: local
spec:
 storageClassName: manual
 capacity:
  storage: 1Gi
 accessModes:
  - ReadWriteOnce
 hostPath:
  path: "/mnt/xyz"
</code></pre>

<p>I would like understand the path "/mnt/xyz" is taking from ? I have checked the cluster nodes , didn't find the path  "/mnt/xyz".<br>
Can anyone please enlighten me on this.
Thanks in advance. </p>

Rajib Mitra
<blockquote>
  <blockquote>
    <p>Can anyone please enlighten me on this.</p>
  </blockquote>
</blockquote>

<p>You can find a nice description of ‘hostPath’ in <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">the official documentation</a>. For some quick pointers:</p>

<ul>
<li>since you didn’t specify optional type, it will be mounted without path existence checks, (and also won’t auto create path for you, see next point).</li>
<li>on every node that your pod can run you need to have ‘/mnt/xyz’ path created, since your type is undefined.</li>
<li>if your pod can be run on different nodes you can (and most probably will) end up with different content of that path on different nodes (they are not synced between nodes but are local to each node) unless you tie pod to specific node to make sure it always has same hostPath content.</li>
</ul>

<p>In your case you have to create /mnt/xyz on each node, start pod, check on which node pod started and observe /mnt/xyz on that specific node get used by pod. Now, once you restart pod and if it gets rescheduled to another node you will see that on previous node state of /mnt/xyz is frozen at the moment first pod stopped running and on newly allocated node it is reinitialized to initial state and gets used.</p>
