<p>So far I was convinced that one need a PVC to access a PV like in this example from k8s <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#claims-as-volumes" rel="nofollow noreferrer">doc</a>:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
    - name: myfrontend
      image: nginx
      volumeMounts:
      - mountPath: "/var/www/html"
        name: mypd
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: myclaim
</code></pre>

<p>But then I saw in <a href="https://docs.docker.com/ee/ucp/kubernetes/storage/use-nfs-volumes/" rel="nofollow noreferrer">Docker doc</a> that one can use the following syntax (example using nfs):</p>

<pre><code>kind: Pod
apiVersion: v1
metadata:
  name: nfs-in-a-pod
spec:
  containers:
    - name: app
      image: alpine
      volumeMounts:
        - name: nfs-volume
          mountPath: /var/nfs # Please change the destination you like the share to be mounted too
      command: ["/bin/sh"]
      args: ["-c", "sleep 500000"]
  volumes:
    - name: nfs-volume
      nfs:
        server: nfs.example.com # Please change this to your NFS server
        path: /share1 # Please change this to the relevant share
</code></pre>

<p>I am confused: </p>

<ul>
<li>Is this syntax creating a PVC under the hood?</li>
<li>Or is any PV matching the spec mounted without a PVC?</li>
<li>Or perhaps the spec selects an existing PVC?</li>
</ul>

stackoverflowed
<p>An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. 
You dont need pv and pvc for emptyDIr volume.</p>

<p>Note that when a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever.</p>

<p>If you want to retain the data even if the pod crashes or restarts or the pod is deleted or undeployed then you need to use pv and pvc</p>

<p>Look at another example below, where you dont need pv and pvc using hostPath</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-pd
spec:
  containers:
  - image: k8s.gcr.io/test-webserver
    name: test-container
    volumeMounts:
    - mountPath: /test-pd
      name: test-volume
  volumes:
  - name: test-volume
    hostPath:
      # directory location on host
      path: /data
      # this field is optional
      type: Directory
</code></pre>

<p>If you need to store the data on external storage solutions like nfs, azure file storage, aws EBS, google persistentDisk etc then you need to create pv and pvc.</p>

<p>mounting pv directly to a pod is not allowed and is against the kubernetes design principles. It would cause tight coupling below the pod vloume and the underlysing storage.</p>

<p>pvc enables light coupling between the pod and the persistent volume. The pod 
doesnt know what the underlying storage is used to store the container data and is not necessary for the pod to know that info.</p>

<p>pv and pvc are required for static and dynamic provisioning of storage volumes for work loads in kubernetes cluster</p>
