Tuesday, June 9, 2026

K8S Reference - PersistentVolumeClaim (PVC) YAML

A PersistentVolumeClaim (PVC) is a request for storage made by an application. Developers create PVCs instead of dealing directly with disks or storage infrastructure. Kubernetes then finds a matching PersistentVolume (PV) or dynamically provisions one using a StorageClass.

Element Required / Optional Description Example Syntax
apiVersion Required Specifies the Kubernetes API version. For PVCs, this is always v1.
apiVersion: v1
kind Required Defines the Kubernetes resource type.
kind: PersistentVolumeClaim
metadata.name Required The unique name of the claim. Pods, Deployments, and StatefulSets reference this name when mounting storage.
name: my-app-claim
spec.accessModes Required Defines how the application intends to access the storage. The requested mode must be supported by the underlying PersistentVolume.
- ReadWriteOnce
spec.resources.requests.storage Required Specifies the minimum storage capacity required by the application.
storage: 10Gi
spec.storageClassName Optional (Recommended) References a specific StorageClass for dynamic provisioning or acts as a matching tag when binding to a static PersistentVolume.
storageClassName: manual
spec.volumeMode Optional Specifies whether the storage should be mounted as a traditional filesystem or exposed as a raw block device. Defaults to Filesystem.
volumeMode: Filesystem
PVC Binding Rule: Kubernetes will only bind a PVC to a PersistentVolume that satisfies all requested requirements, including storage size, accessModes, storageClassName, and volumeMode.
Relationship:

Pod → PVC → PV → Physical Storage

Applications consume storage through PVCs, while Kubernetes handles the mapping to actual disks or cloud storage resources.

No comments:

Post a Comment

K8S - Important Reference Articles on this Blog

The following articles provide a neat and concise reference for creating YAML files for some of the most commonly use...