Apply Now Apply Now Apply Now
header_logo
Post thumbnail
DEVOPS

Kubernetes Persistent Volumes and Persistent Volume Claims Explained

By Vishalini Devarajan

Kubernetes Persistent Volumes (PVs) provide storage that remains available beyond the lifecycle of individual Pods, while Persistent Volume Claims (PVCs) allow applications to request and use that storage. Together, they help Kubernetes applications retain important data even when containers restart or Pods are recreated.

When running databases, file storage systems, or stateful applications in Kubernetes, temporary container storage is not enough. Applications need reliable storage to preserve information such as database records, application files, and user data.

Kubernetes persistent volumes and persistent volume claims solve this problem by separating storage management from application workloads.

In this blog, you will learn what PVs and PVCs are, how they work together, their differences, and how to configure persistent storage using practical YAML examples.

Table of contents


  1. TL;DR
  2. What Are Kubernetes Persistent Volumes (PV)?
  3. What Is a Persistent Volume Claim (PVC) in Kubernetes?
  4. Kubernetes PV vs PVC: What Is the Difference?
  5. How Do Kubernetes Persistent Volumes and PVCs Work?
  6. What Are StorageClasses in Kubernetes?
  7. Kubernetes Persistent Volume Access Modes
  8. Common Kubernetes PV and PVC Issues
  9. Conclusion
  10. Frequently Asked Questions (FAQs)
    • What is the difference between PV and PVC in Kubernetes?
    • Why are Persistent Volumes needed in Kubernetes?
    • What happens to a PVC when a Pod is deleted?
    • What is the difference between static and dynamic provisioning in Kubernetes?
    • Can multiple Pods use the same Persistent Volume?

TL;DR

  • Persistent Volumes (PV): Cluster-level storage resources that provide persistent storage to Kubernetes applications.
  • Persistent Volume Claims (PVC): Requests made by applications for storage with specific capacity and access requirements.
  • PV vs PVC: A PV represents the available storage, while a PVC represents a request for that storage.
  • StorageClasses: Automate storage creation through dynamic volume provisioning.
  • Access Modes: Define how Pods can access storage, depending on the capabilities of the storage backend.

What Are Kubernetes Persistent Volumes (PV)?

A Kubernetes Persistent Volume (PV) is a cluster-level storage resource that provides persistent storage to applications running inside a Kubernetes cluster.

Unlike temporary container storage, a PV exists independently of individual Pods. This means its data can remain available even when a Pod is deleted, restarted, or recreated.

A PV can use different storage backends, including:

  • AWS Elastic Block Store (EBS).
  • Google Cloud Persistent Disk.
  • Azure Managed Disks.
  • Network File System (NFS).
  • Local storage.

For example, consider an e-commerce application running on Kubernetes. Its database stores customer details, order history, and payment records. If the database Pod is deleted during an update, temporary container storage may be lost.

A Persistent Volume provides storage outside the Pod’s lifecycle, allowing the application to access its existing data when a replacement Pod starts.

A PV can be created manually by a cluster administrator or automatically through dynamic provisioning using a StorageClass.

Want to strengthen your practical DevOps skills? Explore the HCL GUVI DevOps course to learn essential tools and technologies, including Docker, Kubernetes, CI/CD, and cloud technologies, through structured learning and hands-on projects.

What Is a Persistent Volume Claim (PVC) in Kubernetes?

A Persistent Volume Claim (PVC) is a request for storage made by a Kubernetes application or user. It specifies storage requirements such as capacity, access modes, and optionally a StorageClass.

Instead of directly managing the underlying storage, developers create PVCs to request the resources their applications need.

For example, a developer running a PostgreSQL database might require 10Gi of persistent storage with ReadWriteOnce access.

The developer creates a PVC with these requirements. Kubernetes then finds a suitable PV or dynamically provisions a new one if a compatible StorageClass is available.

A PVC typically includes:

  • Storage capacity: The amount of storage requested, such as 10Gi.
  • Access modes: How the storage needs to be accessed.
  • StorageClass: The storage provisioning method, if specified.
  • Volume mode: Whether storage is requested as a filesystem or block device.

Once Kubernetes finds a suitable volume, the PVC and PV become bound to each other.

Kubernetes PV vs PVC: What Is the Difference?

Kubernetes PVs and PVCs work together, but they serve different purposes. A PV represents the actual storage resource, whereas a PVC represents an application’s request for that storage.

Comparison FactorPersistent Volume (PV)Persistent Volume Claim (PVC)
DefinitionA storage resource in the clusterA request for storage
PurposeProvides persistent storageRequests storage for applications
Created byAdministrator or provisionerDeveloper or application user
Storage capacityDefines available capacitySpecifies required capacity
Access modesDefines supported access modesRequests required access modes
LifecycleIndependent of individual PodsIndependent of individual Pods
Relationship with PodsProvides the underlying storageUsed by Pods to access storage

Key difference: A PV is the storage resource, while a PVC is the request that connects an application to that resource.

How Do Kubernetes Persistent Volumes and PVCs Work?

Kubernetes Persistent Volumes and PVCs work through a storage provisioning and binding process. A PVC requests storage, Kubernetes finds or creates a matching PV, and a Pod uses the claim to access the storage.

The process involves six steps:

  1. PV creation: A cluster administrator creates a Persistent Volume, or Kubernetes provisions one dynamically through a StorageClass.
  2. PVC creation: A developer creates a Persistent Volume Claim specifying the required capacity and access modes.
  3. Volume matching: Kubernetes searches for a suitable PV based on the PVC requirements.
  4. Binding: Kubernetes connects the matching PV and PVC. Both enter the Bound state.
  5. Pod usage: A Pod references the PVC in its volume configuration to access persistent storage.
  6. Data retention: When the Pod is deleted or recreated, the underlying storage can retain its data for future Pods.

Let’s understand this using a practical example.

Step 1: Create a Persistent Volume

The following YAML creates a 5Gi Persistent Volume using a local storage path.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: app-pv
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: manual
  local:
    path: /mnt/data
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
                - worker-node-1

Here:

  • capacity defines the available storage.
  • accessModes specifies how the volume can be accessed.
  • persistentVolumeReclaimPolicy determines what happens to the volume after its claim is released.
  • local.path specifies the storage directory on the node.
  • nodeAffinity ensures the volume is associated with the specified node.

Note: Local Persistent Volumes require the specified directory to exist on the node. The node name must match the cluster’s actual hostname label.

Step 2: Create a Persistent Volume Claim

Next, create a PVC requesting 3Gi of storage.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: app-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: manual
  resources:
    requests:
      storage: 3Gi

Kubernetes matches this claim with a suitable available PV. Since the PV provides 5Gi and the PVC requests 3Gi, the storage capacity requirement is satisfied.

Step 3: Use the PVC in a Pod

Once the PVC is bound, a Pod can reference it through its volume configuration.

apiVersion: v1
kind: Pod
metadata:
  name: app-pod
spec:
  containers:
    - name: app-container
      image: nginx
      volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: app-storage
  volumes:
    - name: app-storage
      persistentVolumeClaim:
        claimName: app-pvc

Here, claimName connects the Pod to the PVC, while mountPath specifies where the storage is available inside the container.

You can verify the resources using:

kubectl get pv
kubectl get pvc
kubectl get pods

The PV and PVC should show the Bound status when the binding is successful.

GUVI Ad

What Are StorageClasses in Kubernetes?

A StorageClass defines how Kubernetes dynamically provisions persistent storage. It allows administrators to configure different storage types without manually creating every Persistent Volume.

For example, a cloud-based Kubernetes cluster might have separate StorageClasses for standard and high-performance storage.

When a developer creates a PVC referencing a StorageClass, Kubernetes uses the configured provisioner to create the required storage automatically.

There are two main provisioning methods:

1. Static Provisioning

In static provisioning, an administrator manually creates Persistent Volumes before developers request storage.

  • The administrator configures storage resources.
  • Developers create PVCs.
  • Kubernetes matches available PVs with compatible claims.

2. Dynamic Provisioning

In dynamic provisioning, Kubernetes automatically provisions storage when a PVC requests a compatible StorageClass.

  • The developer creates a PVC.
  • Kubernetes identifies the requested StorageClass.
  • The storage provisioner creates the required volume.
  • Kubernetes binds the new PV to the PVC.
FactorStatic ProvisioningDynamic Provisioning
Storage creationManualAutomatic
Administrator involvementHigherLower after configuration
StorageClassOptionalTypically required
FlexibilityDepends on pre-created volumesProvisions storage based on requests
Best suited forPreconfigured storage environmentsCloud and automated environments

StorageClasses simplify Kubernetes storage management by automating provisioning and allowing teams to choose storage based on application requirements.

Also checkout: What to Learn to Become a DevOps Engineer in 2026?

Kubernetes Persistent Volume Access Modes

Kubernetes Persistent Volume access modes define how a volume can be mounted by Pods. The supported modes depend on the storage backend and volume type.

There are four commonly used access modes:

1. ReadWriteOnce (RWO)

Allows a volume to be mounted as read-write by a single node. Multiple Pods on that same node may be able to access it simultaneously.

2. ReadOnlyMany (ROX)

Allows a volume to be mounted as read-only by multiple nodes simultaneously, provided the storage backend supports it.

3. ReadWriteMany (RWX)

Allows a volume to be mounted as read-write by multiple nodes simultaneously. This is useful for shared storage systems such as supported NFS configurations.

4. ReadWriteOncePod (RWOP)

Restricts a volume to read-write access by a single Pod across the cluster. It requires compatible CSI storage support.

Access ModeDescription
RWORead-write mounting by one node
ROXRead-only mounting by multiple nodes
RWXRead-write mounting by multiple nodes
RWOPRead-write mounting by a single Pod

Important: Access modes describe mounting capabilities, not application-level file locking. They do not automatically prevent multiple processes from modifying the same data.

Also Checkout: 10 Best DevOps Practices You Should Know

Common Kubernetes PV and PVC Issues

Persistent Volume and PVC issues usually occur because of storage capacity, access mode mismatches, incorrect configurations, or provisioning problems.

Here are five common problems and how to troubleshoot them.

1. PVC Stuck in Pending State

A PVC remains in Pending when Kubernetes cannot find or provision a suitable PV.

Possible reasons:

  • No available PV matches the claim.
  • The requested StorageClass does not exist.
  • The storage provisioner is unavailable.

Solution: Check the PVC details and events.

GUVI Ad
kubectl describe pvc app-pvc
kubectl get storageclass

2. Persistent Volume Already Bound

A PV can be bound to only one PVC at a time. If another PVC attempts to use the same PV, it cannot bind successfully.

Solution: Check the existing PV and PVC relationships.

kubectl get pv
kubectl get pvc

3. Insufficient Storage Capacity

A PVC remains pending if no suitable PV has enough available capacity to satisfy the request.

Solution: Check the available PV capacity and adjust the storage request or provision a larger volume.

4. Access Mode Mismatch

A PVC may not bind if the available PV does not support the requested access mode.

Solution: Verify the access modes configured in both resources.

kubectl describe pv app-pv
kubectl describe pvc app-pvc

5. Storage Provisioning Failures

Dynamic provisioning can fail because of cloud storage permissions, CSI driver issues, or backend configuration problems.

Solution: Inspect PVC events and the relevant CSI provisioner or controller logs.

kubectl describe pvc app-pvc
kubectl get pods -n kube-system

Checking resource events is usually the best starting point when troubleshooting Kubernetes storage problems.

Conclusion

Kubernetes Persistent Volumes and Persistent Volume Claims are essential for managing persistent storage in containerised applications. PVs provide storage resources, while PVCs allow developers to request storage based on application requirements.

Understanding how PVs, PVCs, and StorageClasses work together helps developers manage application data, simplify storage provisioning, and build reliable Kubernetes workloads.

For DevOps engineers, learning Kubernetes storage management is an important step towards handling production workloads and stateful applications.

Frequently Asked Questions (FAQs)

1. What is the difference between PV and PVC in Kubernetes?

A Persistent Volume (PV) is a storage resource available in a Kubernetes cluster, while a Persistent Volume Claim (PVC) is a request for storage made by an application. Kubernetes binds a compatible PV to a PVC.

2. Why are Persistent Volumes needed in Kubernetes?

Persistent Volumes provide storage that exists independently of individual Pods. They help applications retain important data, such as database records and files, even when Pods are deleted or recreated.

3. What happens to a PVC when a Pod is deleted?

Deleting a Pod does not automatically delete its PVC. The claim remains available, and another Pod can use it. The underlying data remains subject to the PV’s reclaim policy and storage backend behaviour.

4. What is the difference between static and dynamic provisioning in Kubernetes?

Static provisioning requires administrators to create PVs manually before applications request storage. Dynamic provisioning automatically creates storage when a PVC requests a compatible StorageClass.

5. Can multiple Pods use the same Persistent Volume?

Yes, multiple Pods can use the same Persistent Volume if its storage backend and access mode support the required mounting pattern. For example, ReadWriteMany allows read-write mounting across multiple nodes. ReadWriteOncePod restricts access to a single Pod.

Success Stories

Did you enjoy this article?

Learn with HCL GUVI

Schedule 1:1 free counselling

Similar Articles

Loading...
Get in Touch
Chat on Whatsapp
Request Callback
Share logo Copy link
Table of contents Table of contents
Table of contents Articles
Close button

  1. TL;DR
  2. What Are Kubernetes Persistent Volumes (PV)?
  3. What Is a Persistent Volume Claim (PVC) in Kubernetes?
  4. Kubernetes PV vs PVC: What Is the Difference?
  5. How Do Kubernetes Persistent Volumes and PVCs Work?
  6. What Are StorageClasses in Kubernetes?
  7. Kubernetes Persistent Volume Access Modes
  8. Common Kubernetes PV and PVC Issues
  9. Conclusion
  10. Frequently Asked Questions (FAQs)
    • What is the difference between PV and PVC in Kubernetes?
    • Why are Persistent Volumes needed in Kubernetes?
    • What happens to a PVC when a Pod is deleted?
    • What is the difference between static and dynamic provisioning in Kubernetes?
    • Can multiple Pods use the same Persistent Volume?