Kubernetes Persistent Storage: Volumes, PVs, and PVCs (original) (raw)

Last Updated : 28 Apr, 2026

Kubernetes Volumes provide a persistent storage abstraction that decouples data from the individual container's lifecycle.

Kubernetes Storage Plugins

These Kubernetes Storage plugins lay the foundation for the easy management and internal operations of storage solutions in containers. It does the configurational settings on containers that are orchestrated by Kubernetes. These plugins increase the platform's adaptability and guarantee a customized solution for a range of storage requirements.

The following 2 popular kubernetes storage plugins:

  1. Network File System Plugin
  2. Container Storage Interface ( CSI )

Network File System Plugin

Container Storage Interface, or CSI

cluster

PersistentVolume (PV)

A PersistentVolume (PV) is a cluster-level storage resource that provides persistent data storage independent of Pod lifecycles. It is treated as a cluster resource, similar to nodes, and works like a volume plugin whose lifecycle is not tied to any specific Pod.

PVs can be:

Without PVs, developers would need to attach multiple files or volumes directly to Pods for storage, which:

PVs solve this problem by offering a dedicated, persistent storage layer that remains intact even if Pods crash, fail, or restart. They can represent a variety of storage backends such as NFS, iSCSI, or cloud storage (AWS EBS, GCP Persistent Disk, Azure Disk, etc.).

The PV API object stores the implementation details of the storage, abstracting away the complexity from developers and ensuring consistent, reliable storage across the cluster.

PersistentVolume Claim(PVC)

A PersistentVolumeClaim (PVC) is a request made by a user or application to access persistent storage in a Kubernetes cluster.

Since Pods cannot directly manage or provision storage, PVCs act as a bridge between Pods and PersistentVolumes (PVs), ensuring applications get the storage they need without dealing with the underlying implementation details. PVCs can specify:

Storage size requirements, such as 5Gi or 10Gi. Access modes, including:

If dynamic provisioning is enabled through a StorageClass, PVCs can automatically create new PVs without administrator involvement. This makes storage portable and reusable across different backends such as NFS, AWS EBS, or GCP Persistent Disk.

When a Pod uses a PVC, it automatically connects to the bound PV. This ensures that data remains safe and persistent even if the Pod is restarted or reschedule.

application_pod

PV and PVC Working Together

The relationship between **PersistentVolumes (PV) and **PersistentVolumeClaims (PVC) ensures that storage is provisioned and consumed in a seamless way. The workflow can be understood as follows:

Creating a Pod Yaml File with PV and PVC

Whenever developer deploying an Application using Kubernetes to make the data in this application Persistent , he raise the request for the persistent Volume it known as PVC. IT Administrators looks over the specifications of the PVC requests and provides Persistent Volumes (PV) as per required needs.

Step 1: Creating a PV ( Persistent Volume ) with a Yaml file

Based on the PVC specification , the Persistent Volume is created and allocated to it , here we are going to the manual way instead of precreated storage classes for better understanding of workflow. Try on writing a yaml code for persistent volume as follow:

apiVersion: v1
kind: PersistentVolume
metadata:
name: mypv
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: "/mnt/data"

In this file, we providing reclaim policy as Retain, to make the data permant even after the deletion of the pod application.

Save the above specified yaml file with "**my_pv.yml" and then run it with the following command:

kubectl apply -f my_pv.yml

The following screenshots show the implementation of above step3 commands

pv1

Step 2: Checking the Status of PV

After once completing the step 3 to check the status of the PV try on running the following command:

kubectl get pv

To know more about the details of the PV that you created try on running the following command with its specific name of PV

kubectl describe pv mypv

The following screenshots show the implementation of above step4 commands

pv2

Step 3: Creating a PVC (Persistent Volume Claim) with a Pod Yaml

Here we are creating PVC with name as **mypvc using Yaml syntax file with specification of storage resource of **5Gib, having accessmodes Read and Write only Once. Save the file code with name such as **my_pvc.yml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mypvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi

Run this yaml file with kubectl create command or kubectl apply command as follows

kubectl create -f my_pvc.yml

The following picture show the practical usage of the above commands

pvc1

Step 4: Check the Status of the PVC

After executing the above step 1 to check the status of PVC creation try on running the following command:

kubectl get pvc

To know more about the PVC try on seeing the description on running the following command

kubectl describe pvc/mypvc

The following screenshots show the implementation of above step2 commands

pvc2

Step 5: Creating Pod Yaml File with PV and PVC

Now create a pod yaml file as referring the following yaml code for using the above created PV and PVC with Pod application with image nginx latest version.

apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:

Save this pod yaml file with name my_pod.yml and then run it with the command kubectl create as follow:

kubectl create -f my_pod.yml

The following screenshots show the implementation of above step 5 commands

mypod1

Step 6: To Check The Status Of Created Pod

to check the creation of the pod check with the following command:

kubectl get pods

To know more about the detailing of that pod, run with the following command

kubectl describe pods/mypod

The following screenshots show the implementation of above step6 commands

mypod2

mypod3

Best Practices for Using PVs and PVCs

**1. Always use StorageClass in cloud environments

**2. Define clear retention (Reclaim) policies