[shell on that Node, create a /mnt/data directory]
$ sudo mkdir /mnt/data

[the /mnt/data directory, create an index.html file]
$ sudo sh -c "echo 'Hello from Kubernetes storage' > /mnt/data/index.html"

[test that the index.html file exists]
$ cat /mnt/data/index.html
Hello from Kubernetes storage

Now close the shell to Node.


➤ Persistent Volumes (PV)

[Create the PersistentVolume (PV)]
$ kubectl apply -f PV_1.yaml
$ kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml

[View information about the PersistentVolume (PV)]
$ kubectl get pv task-pv-volume
NAME             CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS      CLAIM     STORAGECLASS   REASON    AGE
task-pv-volume   10Gi       RWO           Retain          Available             manual                   4s

The output shows that the PersistentVolume has a STATUS of Available. This means it has not yet been bound to a PersistentVolumeClaim.


➤ Persistent Volume Claim (PVC)

[Create the PersistentVolumeClaim (PVC)]
$ kubectl apply -f PVC.yaml
$ kubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml

After create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements. 
If the control plane finds a suitable PersistentVolume with the same StorageClass, it binds the claim to the volume.

[Look again at the PersistentVolume (PV)]
$ kubectl get pv task-pv-volume
NAME             CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS    CLAIM                   STORAGECLASS   REASON    AGE
task-pv-volume   10Gi       RWO           Retain          Bound     default/task-pv-claim   manual                   2m

Now the output shows a STATUS of Bound.

[Look at the PersistentVolumeClaim (PVC)]
$ kubectl get pvc task-pv-claim
NAME            STATUS    VOLUME           CAPACITY   ACCESSMODES   STORAGECLASS   AGE
task-pv-claim   Bound     task-pv-volume   10Gi       RWO           manual         30s


➤ Pod

[Create the Pod]
$ kubectl apply -f Pod_1.yaml
$ kubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml

[Verify that the container in the Pod is running]
$ kubectl get pod task-pv-pod

[Get a shell to the container running in your Pod]
$ kubectl exec -it task-pv-pod -- /bin/bash
  ............:/# apt update
  ............:/# apt install curl
  {In shell, verify that nginx is serving the index.html file from the hostPath volume}
  ............:/# curl http://localhost/                                            
  Hello from Kubernetes storage
  ............:/# exit

The output shows the text that you wrote to the index.html file on the hostPath volume :-
Hello from Kubernetes storage

If see that message, you have successfully configured a Pod to use storage from a PersistentVolumeClaim.

[Delete the Pod, the PersistentVolumeClaim (PVC) and the PersistentVolume (PV)]
$ kubectl delete pod task-pv-pod
$ kubectl delete pvc task-pv-claim
$ kubectl delete pv task-pv-volume

[open a new shell on the Node in the cluster then remove the file and directory that created]
$ sudo rm /mnt/data/index.html
$ sudo rmdir /mnt/data

Again now close the shell to your Node.

It perform 2 volume mounts on your nginx container :- 
"/usr/share/nginx/html" for the static website. 
"/etc/nginx/nginx.conf" for the default config.
