Kubernetes 101 : Persistent volume - PV - and Persistent volume claim - PVC - : Local storage



We start by creating a persistent volume ( PV that our pods could use after requesting it through a persistent volume claim ( PVC ).


After creating the PV using the "kubectl apply" command, we check its status:


There is no "CLAIM" for it, as it is not bound to any PVC.

We then create our persistent volume claim ( PVC ), as below:


After creating the PVC using the "kubectl apply" command, we check the status of the persistent volume ( PV ) that we have created earlier:


We can see that the PV is now bound to the "nginx-pvc" claim, because they matches .
 
We can then create the deployment for the pods 
that will be using our PV as below:


The pods in our deployment use the "nginx-pvc" to claim the persistent volume "nginx-pv", it is then mounted inside the container on the "/opt/nginx_data" mountpoint.

Comments

Leave as a comment:

Archive