Day 36 : Managing Persistent Volumes in Your Deployment

Rahul SinghRahul Singh
1 min read

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.

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

Persistent Volume

Persistent Volume Claim

Updated Deployment.yaml file

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

0
Subscribe to my newsletter

Read articles from Rahul Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rahul Singh
Rahul Singh