Hands-on Lab·Certified Kubernetes Administrator
StorageClasses and Dynamic Provisioning
A claim with no PersistentVolume behind it, deliberately stuck Pending until a Pod appears. Then the volume is created on demand, pinned by node affinity to wherever that Pod landed, and the data outlives the Pod that made it.
Storage Guide 68 of 103 Intermediate
- Kubernetes1.36.4
- Cluster4 nodes
- Runtimecontainerd 2.2.6
- CNICalico v3.32.1
- TimeAbout 30 min
local-path is a node-local provisioner. A cloud or network provisioner behaves the same at the API level and differs in what the volume actually is.
- Provisionerrancher.io/local-path
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| CKA1001 | 192.168.0.175 | Ubuntu 26.04 LTS | Control Plane Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE01 | 192.168.0.176 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE02 | 192.168.0.177 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
| CKA1001-NODE03 | 192.168.0.178 | Ubuntu 26.04 LTS | Worker Node | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when nobody should be hand-creating volumes any more. This matters because a claim against a WaitForFirstConsumer class is supposed to sit Pending until a Pod appears - and that Pending looks exactly like a broken cluster.
- reading the four StorageClass fields that decide how every claim against it behaves
- seeing Pending as the correct answer here, with the event that explains why
- creating a Pod and watching scheduling, provisioning and binding all resolve at once
- deleting the Pod and confirming the data outlives it
Before you start
- The PersistentVolumes and claims guide, since this replaces the manual half of it.
- A cluster with a working provisioner and a default StorageClass. The installation guides add local-path.
- The node affinity guide, for reading the affinity the generated volume carries.
-
Read the StorageClass before using it
-
Pending is the correct answer, and the event says so
-
A Pod appears and the volume is created where it landed
-
The data outlives the Pod