Table of contents
Introduction:
Persistent Volumes (PVs) are like storage lockers in a Kubernetes cluster. They are physical storage resources, such as disks or NFS shares, that have been provisioned by an administrator. PVs are like empty lockers that can be rented out by users.
Persistent Volume Claims (PVCs) are like requests for storage lockers. They are requests for a specific amount of storage with certain characteristics, such as size and access mode. PVCs are like rental applications for lockers.
When a user creates a PVC, the Kubernetes controller looks for a PV that matches the requirements of the PVC. If a matching PV is found, the PVC is bound to the PV. This is like the administrator assigning a locker to the renter.
Once a PVC is bound to a PV, it can be mounted into a Pod. This is like the renter moving their belongings into the locker. The containers in the Pod can then access the storage on the PV. This is like the renter being able to access their belongings in the locker.
Task 1:
Add a Persistent Volume to your Deployment todo app.
Create a Persistent Volume using a file on your node.
Create a Persistent Volume Claim that references the Persistent Volume.
Update your deployment.yml file to include the Persistent Volume Claim.
Apply the updated deployment using the command:
kubectl apply -f deployment.yml
Verify that the Persistent Volume has been added to your Deployment by checking the status of the Pods and Persistent Volumes in your cluster. Use this commands
kubectl get pods
,kubectl get pv
Task 2:
Accessing data in the Persistent Volume,
Connect to a Pod in your Deployment using command :
`kubectl exec -it -- /bin/bash
`Verify that you can access the data stored in the Persistent Volume from within the Pod
Thank you for reading until here. Hope you have got something from here. See you in the next one.