Dynamic provisioning and CSI
Follow a storage claim from the class that provisions it to the node where a Pod mounts it.
What you will understand
- Read a StorageClass’s provisioner, binding mode, and expansion setting.
- Explain why some claims wait for a consumer Pod before binding.
- Identify which stage to investigate when provisioning, attachment, mounting, or expansion fails.
Builds on: Volumes and persistent claims
How Kubernetes provides a volume
A worker in zone A needs a disk, but a disk provisioned in zone B cannot attach there. A StorageClass describes how volumes should be provided. It names a provisioner and can set parameters, a reclaim policy for dynamically provisioned volumes, binding behavior, and whether expansion is allowed. When a claim names a class that supports dynamic provisioning, Kubernetes and the provisioner can create a matching volume when needed.
With Immediate binding, the decision can happen as soon as the claim is created. With WaitForFirstConsumer, provisioning or binding waits until a Pod uses the claim so the scheduler can consider both Pod placement rules and storage topology. The class in your cluster may use either behavior. In the scene, change the consumer’s node constraints and see why an early decision could create a disk in the wrong place.
Why is this claim waiting for a Pod?
WaitForFirstConsumer lets the scheduler reason about the Pod’s node and the volume’s topology together.
- PVCRequest a volume from a StorageClassStorage provisionerThe class calls for binding after a consumer is considered.
- Consumer PodRequest placement and claim accessSchedulerPlacement requirements and storage topology enter the decision together.
- SchedulerSelect a compatible nodeVolume provisioningThe proposed topology can be used to provision the volume.
- ProvisionerProvide storage and bind the claimPVCThe worker has a bound volume it can prepare.
WaitForFirstConsumer lets the scheduler reason about the Pod’s node and the volume’s topology together.
A topology-aware provisioner supports WaitForFirstConsumer; no spec.nodeName bypass.
Inspect a Pending claim
A report needs local storage. Follow a healthy claim that starts Pending, then compare it with a separate claim whose StorageClass is missing.
From StorageClassTo PVC
Wait for a consumer
The report-data claim names standard. That class uses WaitForFirstConsumer. With no Pod using the claim, provisioning is deferred. The claim’s event explains why it is Pending.
- Before
- Claim submitted
- After
- Pending / WaitForFirstConsumer
The report-data claim names standard. That class uses WaitForFirstConsumer. With no Pod using the claim, provisioning is deferred. The claim’s event explains why it is Pending.
Uses kind’s standard local-path StorageClass, which delays provisioning until a consumer is scheduled. The chosen worker can vary. Other classes and drivers can behave differently.
Reveal prediction answer
Check whether the named StorageClass exists, read its binding mode, and inspect the claim’s events. A delayed-binding claim can wait normally for its first consumer.
Compare kubectl describe pvc with kubectl get storageclass. Look at the actual class name and event message before repairing the unbound teaching claim.
Diagnose and repair the missing classExplore another case
Open Inspect a Pending claim to compare two claims with the same phase. One waits for a Pod so the provisioner can create storage on the right node. The other names a StorageClass that does not exist. Check the claim’s events before deciding whether it needs a repair.
Wait for the Pod before choosing storage
Save the example as report-data.yaml. Use a real class from kubectl get storageclass and record its volumeBindingMode. This claim requests 2 GiB and single-node read-write access. A pending claim waiting for a first consumer can be healthy. Inspect its events to distinguish that state from an unknown class or a provisioning error.
# Inspect the existing class; do not substitute an invented driver name.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: report-data
spec:
storageClassName: standard # Replace with an actual lab class.
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 2GiIn the disposable kind lab cluster, standard uses WaitForFirstConsumer. Save this Pod as report-reader.yaml. Apply the claim by itself first and look for WaitForFirstConsumer in its events. Then apply the Pod and watch the claim become Bound.
apiVersion: v1
kind: Pod
metadata:
name: report-reader
spec:
terminationGracePeriodSeconds: 1
containers:
- name: reader
image: busybox:1.37.0
command: ["sleep", "3600"]
volumeMounts:
- name: reports
mountPath: /data
volumes:
- name: reports
persistentVolumeClaim:
claimName: report-datakubectl --context kind-kv-lab get namespace kv-lab >/dev/null 2>&1 || \
kubectl --context kind-kv-lab create namespace kv-lab
kubectl --context kind-kv-lab -n kv-lab apply -f report-data.yaml
kubectl --context kind-kv-lab -n kv-lab describe pvc report-datakubectl --context kind-kv-lab -n kv-lab apply -f report-reader.yaml
kubectl --context kind-kv-lab -n kv-lab wait --for=condition=Ready pod/report-reader --timeout=90s
kubectl --context kind-kv-lab -n kv-lab get pvc report-data
kubectl --context kind-kv-lab -n kv-lab delete pod report-reader
kubectl --context kind-kv-lab -n kv-lab delete pvc report-dataCompare that sequence with the missing StorageClass lab. The claim there stays Pending even after you create its consumer. Its events identify which class cannot be found.
Follow provisioning, attachment, and mounting
The Container Storage Interface (CSI) standardizes how Kubernetes integrates external storage drivers. Depending on the driver, controller-side operations can create and attach a volume. The node plugin prepares and mounts it for the Pod. Some volumes have no separate attachment operation. This gives you stages to check. An unbound claim points toward binding or provisioning. A bound claim with a Pod still waiting can point toward scheduling, attachment, or mounting. Follow these stages in the scene.
Trace a CSI volume from claim to mount
Binding identifies the volume. Attachment and mounting make it available on the selected worker.
- PVCBind to a compatible volumePersistentVolumeThe claim records the selected volume.
- CSI controllerAttach when the driver requires itWorker nodeThe storage backend makes the volume accessible to the node.
- CSI node pluginPublish the volume to the PodContainer volume mountThe application can open files at its mount path.
Binding identifies the volume. Attachment and mounting make it available on the selected worker.
A CSI driver supporting controller attachment and node staging; drivers without those capabilities skip the corresponding checkpoints.
Inspect YAML or commands
Expand with supported operations
kubectl get pvc report-data -o yamlExplore another case
kubectl get storageclass
kubectl get storageclass standard -o yaml
kubectl apply -f report-data.yaml
kubectl describe pvc report-data
# After creating the lab consumer Pod:
kubectl get pvc report-data -w
kubectl describe pod report-writerAfter creating a consumer that references report-data, compare its events with the claim’s events. If you bind to a topology-limited volume and later move the consumer, it still needs a compatible node. Use the persistent storage lab to observe what your local class actually does.
Check expansion and node placement
A class can set allowVolumeExpansion: true. With a compatible driver you request a larger size on the PVC. The driver may also need to resize the filesystem. Verify reported capacity and conditions before using the extra space. Kubernetes generally supports expanding volumes rather than shrinking them. A local volume can remain tied to its node even when both the PVC and PV are healthy, so persistence through Pod replacement proves little about node loss.
Check your understanding
A new claim is Pending and the event says it is waiting for a first consumer. What should you create or inspect next?
Create or inspect the Pod that references the claim. Check whether the scheduler can place the Pod on any node that also satisfies the storage constraints. That combined decision is what the binding mode is waiting for.
Primary documentation
Go to the source
Reviewed 2026-10-27 · Kubernetes 1.37 · Related local exercise