Local Persistent Volume

Step 0: Create a Volume

mkdir -p /mnt/disk/vol1

Give permissions

chmod 777 /mnt/disk/vol1

You should know on which worker node, you want to run your Pod. Based on that you need to run the above commands.

Step 1: Configure StorageClass

kubectl apply -f 01-volume-binding.yaml

This command is not mandatory to run, however if you run this command. always verify your PV and PVC Status.

Step 3: Configure Persistent Volume

kubectl apply -f 02-lpv.yaml

Step 4: Configure Persistent Volume Claim

kubectl apply -f 03-lpvc.yaml

Step 5: Persistent volume claim is not bound to the persistent volume automatically. Instead, it will remain "Available" until the first consumer shows up

kubectl get pv

Step 6: Deploy the Application

kubectl create -f 04-app.yaml
kubectl get pv
kubectl get pods

Look at PV status is still "Bound", even though the POD is gone.

Scenario 1

Scenario 2

Verifying Multiple Read Access

Clear Everything in the current namespace

Run the Below command on those Nodes, where you have created the mount path.

If you are not aware then run this below command on all the nodes.

Last updated

Was this helpful?