0
0
KubernetesConceptBeginner · 3 min read

What is Persistent Volume Claim in Kubernetes: Explained Simply

A Persistent Volume Claim (PVC) in Kubernetes is a request for storage by a user or application. It allows pods to claim storage resources without knowing the details of the underlying storage, making storage management simple and flexible.
⚙️

How It Works

Think of a Persistent Volume Claim (PVC) as a rental request for storage space in a shared storage warehouse. You don’t need to know where exactly the storage is or how it is managed; you just ask for a certain size and type of storage, and Kubernetes finds a matching Persistent Volume (PV) to fulfill your request.

When you create a PVC, Kubernetes looks for a PV that meets the claim’s requirements like size and access mode. If a suitable PV exists, it binds the PVC to that PV, making the storage available to your pod. This separation lets developers focus on their apps without worrying about storage details.

💻

Example

This example shows a simple Persistent Volume Claim requesting 1 gigabyte of storage with read-write access.

yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
Output
persistentvolumeclaim/my-pvc created
🎯

When to Use

Use a Persistent Volume Claim when your application needs stable storage that outlives pod restarts or rescheduling. For example, databases, content management systems, or any app that saves files should use PVCs to keep data safe.

It’s especially useful in cloud or cluster environments where storage is managed separately from compute resources, allowing apps to request storage without knowing the physical details.

Key Points

  • A PVC is a user’s request for storage in Kubernetes.
  • It abstracts storage details from the application.
  • Kubernetes matches PVCs to available Persistent Volumes.
  • PVCs ensure data persists beyond pod lifecycle.
  • Commonly used for databases and stateful apps.

Key Takeaways

A Persistent Volume Claim lets pods request storage without managing the storage itself.
PVCs bind to Persistent Volumes that meet the requested size and access mode.
Use PVCs to keep data safe when pods restart or move in the cluster.
PVCs simplify storage management by separating storage requests from storage provisioning.