Designing Kubernetes PVC Requests: Choose a StorageClass or a Specific PV
A PersistentVolumeClaim (PVC) is a namespaced object that asks Kubernetes for storage capacity and conditions a workload needs. Omitting `storageClassName` is different from setting it to an empty string, and adding a selector can prevent dynamic provisioning. Naming an existing PersistentVolume (PV) does not automatically reserve it, so choose request fields according to the storage behavior you intend.
Designing Kubernetes PVC Requests: Choose a StorageClass or a Specific PV
A PersistentVolumeClaim (PVC) is a namespaced object that asks Kubernetes for storage capacity and conditions a workload needs. Omitting storageClassName is different from setting it to an empty string, and adding a selector can prevent dynamic provisioning. Naming an existing PersistentVolume (PV) does not automatically reserve it, so choose request fields according to the storage behavior you intend.
What PVC design problem does this guide cover?
A PV is a cluster-scoped storage resource; a PVC is the application's way to describe what it needs. A PVC does more than say “I need this many GiB.” Its class, label selector, access mode, volume mode, and sometimes a specific PV name work together to determine which storage can be connected. This guide explains how those fields differ for static volumes and dynamic provisioning, and what to check when a claim remains Pending.
The manifests below explain PVC behavior documented by Kubernetes. Do not apply them unchanged before checking your cluster's default StorageClass and driver configuration.
How are an omitted storageClassName and "" different?
If storageClassName names a class, only PVs with that class can bind to the PVC. If the class has a dynamic provisioner configured, the request may also cause new storage to be created.
Omitting the field can depend on cluster configuration. When the DefaultStorageClass admission plugin is enabled and a default StorageClass exists, the PVC can be treated as requesting that default. By contrast, explicitly setting storageClassName: "" requests only a PV with no class, so it is different from choosing the default class for dynamic provisioning. If you need a particular classless PV, specify the empty string; for an ordinary user request, naming the actual class supplied by the cluster operator makes the intent clearer.
Retroactive default StorageClass assignment has been stable since Kubernetes v1.28. A PVC created while no default class exists may have a default class assigned later if the field was omitted. A PVC with storageClassName: "" remains classless and looks only for a classless PV. Therefore, do not assume that omitting the field because no default exists today means a future default will have no effect.
| PVC setting | Request meaning | Common use and caution |
|---|---|---|
storageClassName: fast | Requests a PV in class fast | Confirm the class exists and its performance, cost, and provisioner fit the need |
storageClassName: "" | Requests a PV with no class | Useful for manually created classless PVs; does not select the default dynamic class |
| Field omitted | Handled according to the cluster's default class and admission behavior | Consider whether a changed or later-created default could assign a class unexpectedly |
Which PVs does a selector choose, and what does it restrict?
A PVC selector filters candidates to PVs with matching labels. If matchLabels and matchExpressions are both present, every condition must match. These conditions are added to, rather than substituted for, storageClassName. When both class and selector are set, a candidate PV must match the class and the labels.
An important limitation is that a PVC with a non-empty selector cannot currently have a PV dynamically provisioned. Use selectors to narrow down pre-created static PVs. If you want a new backend volume to be created automatically, remove the selector and request a StorageClass supported by the operator's driver.
For example, an operator might manage static PVs labeled environment=archive, and an application may need to use only storage with those labels. The following request illustrates how class and selector conditions combine. Do not assume that archive-manual or these labels exist; check before applying it.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: archive-data
namespace: reports
spec:
storageClassName: archive-manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
selector:
matchLabels:
environment: archive
matchExpressions:
- key: tier
operator: In
values:
- regulatedThis request can bind only to a static PV that matches class archive-manual and both label conditions. If no such PV is available, the PVC remains Pending. Because adding the selector prevents the automatic provisioning path, a request can wait indefinitely if it asks for a constrained type of storage that the operator has not created in advance.
Does specifying volumeName also reserve a PV?
volumeName names the PV a PVC should bind to. This is useful when targeting a particular PV rather than relying on matching, but writing its name does not guarantee that another PVC cannot claim it first. Kubernetes documents reserving a PV by setting its claimRef to the namespace and name of the intended PVC.
When reusing a specific PV, check the intended names, namespace, class, access mode, and capacity together. Pinning a claim with volumeName can bypass some usual matching criteria, such as node affinity, but Kubernetes still checks the StorageClass, access modes, and requested size. This does not mean node affinity is irrelevant to where a real Pod can mount the volume. Check volume topology and Pod scheduling separately.
If you want to preserve data on an existing PV and reconnect it to a new PVC, first check the PV's Retain reclaim policy and its current claimRef. Naming the PV without reserving it through claimRef can create a race with other claims. Do not assume an already bound PV can be immediately reused by another PVC.
Is the requested capacity the same as usable capacity?
resources.requests.storage specifies the minimum storage capacity the PVC needs. Kubernetes may bind a PV larger than the request; a smaller PV cannot satisfy it. For Filesystem volumes, the request refers to the outer size allocated by the storage backend. With providers that create a filesystem on a block device, usable space can be slightly lower because of filesystem metadata and other overhead.
For example, binding a 20Gi request to a 24Gi static PV can satisfy the capacity requirement, but it does not mean the application can always write 24Gi of files. Check the filesystem and how the provider reports capacity. If you need more room, verify that the StorageClass and driver support expansion, including allowVolumeExpansion, then increase the PVC request. Avoid editing only the PV capacity: the control plane could infer that the backend expansion is already complete.
How should I troubleshoot a PVC that is Pending?
Pending means that the PVC has not yet been connected to a suitable PV; it does not by itself mean the cluster is broken. Compare the request with available PVs and StorageClass configuration in this order:
Read events with `kubectl describe pvc <pvc-name> -n <namespace>`. Check the requested capacity, access modes, selector, and class-related messages.
Use `kubectl get storageclass` to confirm the named class exists and, if you expect dynamic provisioning, that its provisioner is configured.
For static PV selection, use `kubectl get pv --show-labels` to inspect available capacity, `STATUS`, class, and labels. Compare them with the PVC selector; a PV must satisfy every selector condition.
If `volumeName` is set, check that the PV exists and is not already bound to another PVC, and that class, access modes, and requested size are valid. A PV name does not reserve it.
If the StorageClass uses `WaitForFirstConsumer`, dynamic provisioning or binding may wait until the first Pod is scheduled. Check the Pod's scheduling state and events too, and avoid setting `nodeName` directly because that bypasses the scheduler.
For instance, a PVC that expects automatic storage but still has a selector, or one with storageClassName: "" when only classed PVs exist, has no matching candidate. Once you identify the mismatch, adjust the selector, class, or static PV to match your intent. Deleting and recreating an in-use PVC can affect data and reclaim behavior, so inspect resource state and retention policy before making that change.
PVC request design checklist
| Goal | Check first | Avoid assuming |
|---|---|---|
| Create storage dynamically through a class | StorageClass name, provisioner, and driver support | The default class has the type and policy you want |
| Use one of the existing static PVs | PV status, capacity, class, access mode, and labels | A selector can still trigger dynamic provisioning |
| Use a classless PV | Set storageClassName: "" on the PVC | Omitting the field means the same as an empty string |
| Target a particular PV | volumeName, PV claimRef, and current claim status | Naming a PV automatically reserves it |
| Get enough usable file space | Request size, filesystem overhead, backend reporting, and usage | Requested GiB exactly equals free space in the container |
Key points
A PVC is more than a capacity request. Omitting storageClassName and setting it to an empty string express different intent; a selector narrows static PV choices and can prevent dynamic provisioning. volumeName targets a PV but does not reserve it, so use the PV's claimRef when reservation is needed. When a PVC waits, compare its request fields with available PVs and StorageClass settings before deleting or recreating storage objects, and check the data-retention policy first.
References
PVC requests, capacity, selectors, class semantics, and retroactive default assignment
PersistentVolumeClaim API fields
StorageClass provisioners and default class settings
Official procedure for creating a PVC and using storage from a Pod
Scope: This article covers Kubernetes PersistentVolumeClaim fields storageClassName, selector, and volumeName; capacity requests; static PV matching; dynamic provisioning; and Pending diagnosis. Official Kubernetes documentation was checked on 2026-11-23. The manifests and commands are examples and were not run on a cluster. Default StorageClass, admission settings, drivers, volume topology, and reclaim policies vary by cluster; verify them before applying. Deleting or reusing an existing PVC or PV can affect data.