What are Persistent Volumes in k8s
In Kubernetes, a Persistent Volume (PV) is a piece of storage in the cluster that has been provisioned by an administrator. A Persistent Volume Claim (PVC) is a request for storage by a user. The PVC references the PV, and the PV is bound to a specific node. Read official documentation
Task 1:
Add a Persistent Volume to your Deployment todo app.
Create a Persistent Volume using a file on your node. Template
Create a Persistent Volume Claim that references the Persistent Volume. Template
Update your deployment.yml file to include the Persistent Volume Claim. After Applying pv.yml pvc.yml your deployment file look like this Template
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
.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
Created test.txt file in container
Deleted pod:
Recreating pod by itself after delete/Autohealing:
Verifying the same file in new pod:
Thank you for reading!! Hope you find this helpful.
#day36#90daysofdevops#devopscommunity#
Always open for suggestions..!!