<p>hi all quick question on host paths for persistent volumes</p>

<p>I created a PV and PVC here</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: task-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: task-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
</code></pre>

<p>and I ran a sample pod</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: task-pv-pod
spec:
  volumes:
    - name: task-pv-storage
      persistentVolumeClaim:
        claimName: task-pv-claim
  containers:
    - name: task-pv-container
      image: nginx
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
        - mountPath: "/usr/share/nginx/html"
          name: task-pv-storage

</code></pre>

<p>i exec the pod and created a file</p>

<pre><code>root@task-pv-pod:/# cd /usr/share/nginx/html
root@task-pv-pod:/usr/share/nginx/html# ls
tst.txt
</code></pre>

<p>However, when I go back to my host and try to ls the file , its not appearing. Any idea why? My PV and PVC are correct as I can see that it has been bounded.</p>

<pre><code>ubuntu@ip-172-31-24-21:/home$ cd /mnt/data
ubuntu@ip-172-31-24-21:/mnt/data$ ls -lrt
total 0
</code></pre>

adr
<p>A persistent volume (PV) is a kubernetes resource which has its own lifecycle independent of the pod <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="nofollow noreferrer">pv documentation</a>. Using a PVC to consume from a PV makes it visible in some other tool. For example azure files, ELB, a server with NFS, etc. My point here is that there is no reason why the PV should exist in the node.</p>

<p>If you want your persistence to be saved in the node use the <code>hostPath</code> option for PVs. Check this <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/" rel="nofollow noreferrer">link</a>. Though this is not a good production practice. </p>
