You don't need an extra storage layer in this lab because kind already ships one: the standard StorageClass backed by the local-path provisioner. That's plenty to drill every storage concept on the exam, and its built-in limits actually make great teaching tools.
make upmake apiOrientation
Performance exams almost never ask you to install a CSI driver from scratch. Instead, they throw real operational puzzles at you: why is this claim stuck Pending, why did this pod lose its data, how do we make this workload survive a reschedule, how do we grow this volume? All four come straight down to four fields you should know cold.
The grader only sees live objects and their status. That's why almost every storage problem announces itself through one of three tells: a PVC stuck Pending, a PV stuck Released, or a pod stuck ContainerCreating with mount errors in its events. Map those three symptoms cleanly to their causes and you've got this competency locked down.
The model: three objects, one relationship
A PersistentVolume represents a real slice of storage. A PersistentVolumeClaim is a user's request for it. A StorageClass is the blueprint for creating PVs on demand, with provisioner naming the controller that handles the work. Static provisioning (an admin pre-creating PVs) still exists, but dynamic provisioning is the default everywhere: the PVC asks for a class, the provisioner spins up a PV, and the two bind exclusively one-to-one.
pod ──mounts──▶ PVC ──binds 1:1──▶ PV ──backed by──▶ real disk / host path / cloud volume
│ ▲
└── storageClassName ──▶ StorageClass ──▶ provisioner creates the PV
(binding mode, reclaim policy, expansion, params)
Under the hood, CSI is the standard interface modern drivers implement, split into a controller side (provision, attach, snapshot) and a node side (mount/format). You won't write a CSI driver on the exam, but knowing that split tells you where to look when things break: "failed to provision" lives in controller logs, while "failed to mount" lives on the node.
The fields that decide exam tasks
| Field | Values | What it changes |
|---|---|---|
| accessModes | RWO · ROX · RWX · RWOP | A PVC only binds to a PV that offers its requested mode. local-path only supports RWO, so an RWX claim sits Pending forever. Spotting why immediately is the skill. |
| volumeBindingMode | Immediate · WaitForFirstConsumer | WaitForFirstConsumer holds the PVC in Pending until a pod actually mounts it, letting the scheduler pick the right zone first. Our standard class uses it, so you'll see a healthy Pending PVC right away. |
| persistentVolumeReclaimPolicy | Delete · Retain | Delete destroys the backing volume when the claim goes away; Retain keeps the data and leaves the PV Released so nothing can rebind to it until an admin clears spec.claimRef. |
| allowVolumeExpansion | true · false | Only classes with this set to true let you grow a PVC by bumping spec.resources.requests.storage. Shrinking is never supported anywhere. |
| volumeMode | Filesystem · Block | Block exposes a raw block device to the container. Mostly used by specialized databases. |
Requesting RWX doesn't magically turn a local disk into a shared filesystem; it just asks for a PV whose backing storage already supports multi-node read-write mounts. Likewise, nothing stops two pods on the same node from trampling each other on an RWO volume. RWOP (ReadWriteOncePod) is the strict lock: strictly one pod at a time, enforced by both the scheduler and kubelet, so two database replicas can never corrupt the same volume.
Lifecycle and the states you'll need to explain
| Symptom | Usual cause | Check |
|---|---|---|
| PVC Pending, no events | WaitForFirstConsumer waiting for a pod | totally normal: schedule a consumer |
| PVC Pending, provisioner events | unsupported access mode, no capacity, bad class name | kubectl describe pvc |
| Pod ContainerCreating forever | node-side mount or attach failure | kubectl describe pod → events |
| PV Released, won't rebind | Retain left claimRef populated | kubectl patch pv … claimRef=null |
| PVC Terminating forever | kubernetes.io/pvc-protection finalizer: a pod still mounts it | kubectl get pods -o json | grep claimName |
| Resize stuck | class lacks expansion, or filesystem resize is waiting on a pod mount/restart | status.conditions on the PVC |
Both protection finalizers look like bugs the first time you hit them, and both are saving you from yourself: pvc-protection blocks deleting a claim while a pod still mounts it, and pv-protection blocks deleting a bound PV. Never start by ripping off the finalizer: remove the pod first and let the controller clean up cleanly. Stripping finalizers blindly is the Kubernetes equivalent of yanking out a live hard drive.
StatefulSets: where storage semantics show up
volumeClaimTemplates stamps out a dedicated PVC for each replica, named <template>-<sts>-<ordinal>. Deleting the StatefulSet leaves those PVCs behind by default (unless you opt into persistentVolumeClaimRetentionPolicy), so scaling back up reconnects cleanly to the exact same data. That durability, paired with stable hostnames and ordered rollouts, is the whole point of using a StatefulSet over a Deployment.
This is also where GitOps hits its boundary: data. Deleting a namespace and letting Argo CD or Flux rebuild it brings back your YAML, not the bytes inside a PV. Three mechanisms cover disaster recovery: CSI snapshots for fast in-cluster point-in-time copies, a backup tool like Velero to ship cluster objects and volume backups off-cluster, and operator-native backups for databases. Knowing which of the three protects your state is the complete DR answer.
Snapshots mirror the exact same three-object pattern: VolumeSnapshotClass, VolumeSnapshot, and VolumeSnapshotContent. Since local-path doesn't support snapshots, this lab teaches the Kubernetes snapshot APIs conceptually and lets CloudNativePG show you real database backups.
What a platform engineer actually decides
Section 3.1's "platform APIs as products" idea shows up right here: StorageClasses are a user-facing product menu. Each class hides durability, performance, and cost choices that app teams shouldn't have to reinvent.
- Name classes by intent (
fast-ssd,cheap-hdd,shared-rwx), not by today's underlying vendor driver. - Mark exactly one default class (
storageclass.kubernetes.io/is-default-class) and price it deliberately, because every PVC that omitsstorageClassNamebuys it automatically. If two classes are marked default, the DefaultStorageClass admission plugin quietly picks the newest one. That's worse than an error, because behavior silently shifts the next time someone adds a class. - Default to
WaitForFirstConsumeranywhere zones exist, so volumes aren't created in a zone your pod can't schedule into. - Use
Deletefor ephemeral tenant scratch space andRetainfor anything whose loss would trigger a postmortem. - Cap tenant storage with quotas:
requests.storagefor the total cap, and<class>.storageclass.storage.k8s.io/requests.storageper class so teams don't default everything onto your most expensive NVMe tier (section 1.4).
Start every storage investigation with kubectl get sc: one table shows provisioner, reclaim policy, binding mode, and expansion support at a glance. Then run kubectl get pvc -A and hunt for anything that isn't Bound.
Backup and restore as objects: Velero
When an exam scenario reaches for a cluster backup tool, Velero is the standard name, built around four CRDs. A BackupStorageLocation points at your object store (bucket, prefix, provider plugin); a VolumeSnapshotLocation says where disk snapshots land; a Backup picks what to capture (includedNamespaces, includedResources, labelSelector, ttl defaulting to 30 days); and a Schedule wraps a Backup template in a cron expression, emitting backups named <schedule>-<timestamp>. Velero copies volume data either via CSI snapshots (moved/deleted once backed up) or via file-system backup (a node agent reading mounted files; works on any volume type, at the cost of crash-consistency). For application-consistent backups, use pre and post exec hooks (like flushing a database before snapshotting). A Restore replays the backup, optionally remapping namespaces with namespaceMapping: {abc: def}, and stamps restored resources with velero.io/restore-name. In a GitOps cluster, keep the boundary crisp: Git restores manifests, Velero (or your DB operator) restores PV data, and neither replaces the other.
Lifecycle features by version, and copying data
Every item below maps to a concrete field on a PVC, StatefulSet, or StorageClass that a task can ask for, along with the Kubernetes version where it graduated. Our lab runs 1.37, so everything marked GA works out of the box.
StatefulSet PVC retention (GA since 1.32)
spec.persistentVolumeClaimRetentionPolicy gives you two switches, each set to Retain (default) or Delete: whenDeleted governs StatefulSet deletion, and whenScaled governs scale-down. Under the hood, Delete attaches an ownerReference to the PVC so garbage collection removes it once its pod terminates, whereas a pod recreated after a node failure keeps its claim untouched. The go-to production pairing is whenDeleted: Retain, whenScaled: Delete: accidental deletes keep your data safe, while intentional scale-downs don't leak orphaned disks.
Expansion and recovering from failed grows
- Requires
allowVolumeExpansion: trueon the StorageClass plus CSI driver support. Always editspec.resources.requests.storageon the PVC, never the PV (editing the PV tricks the controller into thinking the grow already finished). - The underlying block device expands first; the filesystem (ext3, ext4, xfs) expands only when a pod mounts the claim (online if the driver supports it). Until a pod mounts it, the PVC shows
FileSystemResizePending, which is totally normal if no consumer is running. - You still can't shrink a bound volume, but you can cancel a failed expansion: thanks to
RecoverVolumeExpansionFailure(GA since 1.34), you can lower the requested size back down to anything abovestatus.capacity. Track live progress instatus.allocatedResourcesandstatus.allocatedResourceStatuses(such asControllerResizeInProgressorNodeResizePending).
Snapshots, clones, and populators
| Want | Write | Needs |
|---|---|---|
| point-in-time copy | VolumeSnapshot { source: { persistentVolumeClaimName } , volumeSnapshotClassName } | snapshot CRDs + snapshot-controller, driver's csi-snapshotter sidecar, and a VolumeSnapshotClass (deletionPolicy: Delete or Retain) |
| new PVC from a snapshot | dataSource: { kind: VolumeSnapshot, name, apiGroup: snapshot.storage.k8s.io } | same namespace, a class from the same driver, and status.readyToUse: true on the snapshot first |
| clone an existing PVC | dataSource: { kind: PersistentVolumeClaim, name } | CSI clone support, same namespace, and requested size >= the source size |
| populate from anything else | dataSourceRef: { apiGroup, kind, name } | a volume populator controller for that kind (GA since 1.33; cross-namespace sources remain alpha) |
Two protections that look like hangs: a PVC with an in-flight snapshot can't be deleted until the snapshot reaches readyToUse, and a bound PV holds kubernetes.io/pv-protection. Let both clear on their own rather than stripping them.
Ephemeral volumes
- Generic ephemeral volume (GA since 1.23): declare
volumes[].ephemeral.volumeClaimTemplateright inside the Pod spec. Kubernetes creates a real PVC named<pod>-<volume>owned by the pod, so it vanishes when the pod does, yet while alive it supports snapshots, clones, and expansion just like any normal PVC. Pair it withWaitForFirstConsumerclasses so scheduling chooses the node first. - CSI ephemeral volume: inline
volumes[].csiwith no PVC object, used by drivers declaring theEphemeralmode (like secrets-store drivers). Data dies with the pod and bypasses StorageClasses entirely. emptyDircounts againstephemeral-storagerequests and limits; addmedium: Memoryand it counts against container memory instead (and supports in-place resize on cgroup v2 nodes).
VolumeAttributesClass (GA since 1.34)
A StorageClass controls how a volume is provisioned; a VolumeAttributesClass (driverName plus performance parameters like IOPS and throughput) controls how it performs afterward. Better yet, pvc.spec.volumeAttributesClassName is mutable: upgrading a volume from silver to gold is a live edit instead of a data migration, and you can quota it per class (<vac>.volumeattributesclass.storage.k8s.io/...). Whenever a scenario asks how to change disk performance tiers without recreating the PVC, this is the answer.
Smaller versioned facts worth remembering
- Retroactive default class (GA since 1.28): if you create a PVC with no
storageClassNamewhile no default exists, Kubernetes retroactively patches in the default as soon as one is annotated. Explicitly settingstorageClassName: ""opts out and binds only to classless PVs. ReadWriteOncePod(GA since 1.29, CSI-only): strictly enforced by scheduler and kubelet, unlike RWO/ROX/RWX which are matching hints.HonorPVReclaimPolicyadds anexternal-provisioner.volume.kubernetes.io/finalizerso aDeletePV still cleans up its backend disk even if the PV is deleted before its PVC.- StatefulSet
updateStrategy.rollingUpdate.maxUnavailableis beta since 1.35 (on by default in 1.35.0–1.35.3, off in 1.35.4–1.36, back on by default in 1.37), andRecreateis also feature-gated. Don't rely on either unless verified; default updates remain one pod at a time, highest ordinal first.
"Grow the database volume to 20Gi" is graded against the PVC's status.capacity; editing the spec alone scores nothing. If the StorageClass lacks allowVolumeExpansion, admission rejects the edit immediately ("only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize"). And if no pod mounts the claim, capacity stays frozen at the old size with FileSystemResizePending until a consumer actually runs.
Exercises
kubectl get storageclass standard -o yaml # read provisioner, bindingMode, reclaimPolicy
cat <<'EOF' | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: scratch, namespace: default }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 1Gi } }
storageClassName: standard
EOF
kubectl get pvc scratch # Pending, and that is CORRECToutputcaptured 2026-08-26
$ kubectl get storageclass standard -o yaml # read provisioner, bindingMode, reclaimPolicy
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"},"name":"standard"},"provisioner":"rancher.io/local-path","reclaimPolicy":"Delete","volumeBindingMode":"WaitForFirstConsumer"}
storageclass.kubernetes.io/is-default-class: "true"
creationTimestamp: "2026-08-27T01:42:26Z"
name: standard
resourceVersion: "317"
uid: c527a04d-959b-4479-90bc-c1e5de4612ad
provisioner: rancher.io/local-path
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
$ cat <<'EOF' | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: scratch, namespace: default }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 1Gi } }
storageClassName: standard
EOF
persistentvolumeclaim/scratch created
$ kubectl get pvc scratch # Pending, and that is CORRECT
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
scratch Pending standard <unset> 0sNow consume it:
kubectl run writer --image=busybox:1.37 --restart=Never \
--overrides='{"spec":{"containers":[{"name":"writer","image":"busybox:1.37","command":["sh","-c","echo survived > /data/proof && sleep 3600"],"volumeMounts":[{"name":"d","mountPath":"/data"}]}],"volumes":[{"name":"d","persistentVolumeClaim":{"claimName":"scratch"}}]}}'
kubectl get pvc scratch # Bound, seconds after the pod scheduledoutputcaptured 2026-08-26
$ kubectl run writer --image=busybox:1.37 --restart=Never \
--overrides='{"spec":{"containers":[{"name":"writer","image":"busybox:1.37","command":["sh","-c","echo survived > /data/proof && sleep 3600"],"volumeMounts":[{"name":"d","mountPath":"/data"}]}],"volumes":[{"name":"d","persistentVolumeClaim":{"claimName":"scratch"}}]}}'
pod/writer created
$ kubectl get pvc scratch # Bound, seconds after the pod scheduled
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
scratch Bound pvc-5e6b3db5-7d24-4e9f-82bf-8cdad4dec78c 1Gi RWO standard <unset> 11scat /data/proof, and kubectl logs writer must print survived.Create a PVC identical to the above but accessModes: [ReadWriteMany], plus a pod that mounts it (without a consumer, WaitForFirstConsumer keeps the events silent and you learn nothing). Now it pends with a reason: kubectl describe pvc events show the provisioner refusing, because local-path only does RWO.
make api installs the CloudNativePG operator; a Postgres exists once you create one (section 3.3 does, and it is worth jumping ahead for its first exercise). With one running:
kubectl get pvc -A | grep -v Bound # unbound + consumed = a finding (your own scratch claims excepted)
kubectl get pvc -A -o custom-columns='NS:.metadata.namespace,NAME:.metadata.name,SC:.spec.storageClassName,MODE:.spec.accessModes[0],SIZE:.spec.resources.requests.storage'outputcaptured 2026-08-26
$ kubectl get pvc -A | grep -v Bound # unbound + consumed = a finding (your own scratch claims excepted)
NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
$ kubectl get pvc -A -o custom-columns='NS:.metadata.namespace,NAME:.metadata.name,SC:.spec.storageClassName,MODE:.spec.accessModes[0],SIZE:.spec.resources.requests.storage'
NS NAME SC MODE SIZE
default pg-1 standard ReadWriteOnce 1Gi
default pg-2 standard ReadWriteOnce 1Gi
default scratch standard ReadWriteOnce 1Gi
monitoring storage-loki-0 standard ReadWriteOnce 10Gi
spire spire-data-spire-server-0 standard ReadWriteOnce 1Gikubectl delete pod of the instance, and the new pod mounts the same data. That is the operator relying on the PVC semantics above.Create a PV of type hostPath (1Gi, RWO, storageClassName: manual), a PVC requesting it by the same class name, and show they bind with no provisioner involved.
kubectl get pv shows STATUS Bound and CLAIM pointing at your PVC. Then delete the PVC and explain what the PV's new status means given its reclaim policy.A StatefulSet's claims outlive it by default, which is either the safety you wanted or the leak you get billed for. The retention policy splits the two cases apart, and the ownerReference the controller writes on each claim is how the deletion half is carried out.
kubectl apply -f - <<'EOF'
apiVersion: apps/v1
kind: StatefulSet
metadata: { name: keep, namespace: default }
spec:
serviceName: keep
replicas: 3
persistentVolumeClaimRetentionPolicy: { whenScaled: Delete, whenDeleted: Retain }
selector: { matchLabels: { app: keep } }
template:
metadata: { labels: { app: keep } }
spec:
containers:
- name: c
image: busybox:1.36
command: ["sh", "-c", "sleep 86400"]
volumeMounts: [{ name: data, mountPath: /data }]
volumeClaimTemplates:
- metadata: { name: data }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 64Mi } }
EOF
kubectl rollout status statefulset/keep --timeout=180s
kubectl get pvc -l app=keep
kubectl get pvc data-keep-2 -o jsonpath='{.metadata.ownerReferences}' | jq # nothing owns it yet
kubectl scale statefulset keep --replicas=1
sleep 15
kubectl get pvc data-keep-2 -o jsonpath='{.metadata.ownerReferences}' | jq # now the condemned pod does
sleep 75
kubectl get pvc -l app=keep
kubectl delete statefulset keep
sleep 15
kubectl get pvc -l app=keep
kubectl delete pvc data-keep-0
kubectl delete pvc -l app=keep --ignore-not-foundoutputcaptured 2026-09-13
$ kubectl apply -f - <<'EOF'
apiVersion: apps/v1
kind: StatefulSet
metadata: { name: keep, namespace: default }
spec:
serviceName: keep
replicas: 3
persistentVolumeClaimRetentionPolicy: { whenScaled: Delete, whenDeleted: Retain }
selector: { matchLabels: { app: keep } }
template:
metadata: { labels: { app: keep } }
spec:
containers:
- name: c
image: busybox:1.36
command: ["sh", "-c", "sleep 86400"]
volumeMounts: [{ name: data, mountPath: /data }]
volumeClaimTemplates:
- metadata: { name: data }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 64Mi } }
EOF
statefulset.apps/keep created
$ kubectl rollout status statefulset/keep --timeout=180s
Waiting for statefulset spec update to be observed...
Waiting for 3 pods to be ready...
Waiting for 3 pods to be ready...
Waiting for 2 pods to be ready...
Waiting for 2 pods to be ready...
Waiting for 1 pods to be ready...
Waiting for 1 pods to be ready...
partitioned roll out complete: 3 new pods have been updated...
$ kubectl get pvc -l app=keep
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
data-keep-0 Bound pvc-5d487b38-6213-435f-89fa-e84c958cc0f6 64Mi RWO standard <unset> 24s
data-keep-1 Bound pvc-7e38cb51-e9b5-4d16-9f05-27bc88315451 64Mi RWO standard <unset> 17s
data-keep-2 Bound pvc-cde3b56b-bd6d-4cfb-8233-ad4868f74623 64Mi RWO standard <unset> 9s
$ kubectl get pvc data-keep-2 -o jsonpath='{.metadata.ownerReferences}' | jq # nothing owns it yet
$ kubectl scale statefulset keep --replicas=1
statefulset.apps/keep scaled
$ sleep 15
$ kubectl get pvc data-keep-2 -o jsonpath='{.metadata.ownerReferences}' | jq # now the condemned pod does
[
{
"apiVersion": "v1",
"blockOwnerDeletion": true,
"controller": true,
"kind": "Pod",
"name": "keep-2",
"uid": "a92afd0d-1914-4e04-8ba2-85d6a507a65a"
}
]
$ sleep 75
$ kubectl get pvc -l app=keep
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
data-keep-0 Bound pvc-5d487b38-6213-435f-89fa-e84c958cc0f6 64Mi RWO standard <unset> 114s
$ kubectl delete statefulset keep
statefulset.apps "keep" deleted from default namespace
$ sleep 15
$ kubectl get pvc -l app=keep
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
data-keep-0 Bound pvc-5d487b38-6213-435f-89fa-e84c958cc0f6 64Mi RWO standard <unset> 2m10s
$ kubectl delete pvc data-keep-0
persistentvolumeclaim "data-keep-0" deleted from default namespace
$ kubectl delete pvc -l app=keep --ignore-not-found
No resources foundwhenDeleted: Retain means the set never owns them. Scale down and the two condemned claims each gain an ownerReference to their own pod, which is what deletes them once that pod is gone; the last claim then survives deletion of the set itself. Two halves of one field, opposite outcomes.Expansion is a property of the driver, not of the StorageClass field that advertises it. Setting allowVolumeExpansion on a class whose provisioner cannot expand produces one of the most quoted error strings in storage tasks, so meet it here rather than in a task.
kubectl get storageclass
kubectl patch storageclass standard -p '{"allowVolumeExpansion":true}'
kubectl apply -f - <<'EOF'
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: grow, namespace: default }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 64Mi } }
EOF
kubectl run grower --image=busybox:1.36 --restart=Never --overrides='{"spec":{"containers":[{"name":"c","image":"busybox:1.36","command":["sh","-c","sleep 86400"],"volumeMounts":[{"name":"d","mountPath":"/d"}]}],"volumes":[{"name":"d","persistentVolumeClaim":{"claimName":"grow"}}]}}'
kubectl wait --for=condition=Ready pod/grower --timeout=120s
kubectl patch pvc grow -p '{"spec":{"resources":{"requests":{"storage":"128Mi"}}}}'
sleep 20
kubectl get pvc grow -o jsonpath='spec: {.spec.resources.requests.storage} status: {.status.capacity.storage}{"\n"}'
echo "conditions: $(kubectl get pvc grow -o jsonpath='{.status.conditions}')"
kubectl get pvc grow -o jsonpath='{.status.allocatedResourceStatuses}{"\n"}'
kubectl describe pvc grow | tail -8
kubectl delete pod grower
kubectl delete pvc grow
# put the shared default class back the way it was
kubectl patch storageclass standard -p '{"allowVolumeExpansion":false}'outputcaptured 2026-11-18
$ kubectl get storageclass
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
standard (default) rancher.io/local-path Delete WaitForFirstConsumer false 101m
$ kubectl patch storageclass standard -p '{"allowVolumeExpansion":true}'
storageclass.storage.k8s.io/standard patched
$ kubectl apply -f - <<'EOF'
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: grow, namespace: default }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 64Mi } }
EOF
persistentvolumeclaim/grow created
$ kubectl run grower --image=busybox:1.36 --restart=Never --overrides='{"spec":{"containers":[{"name":"c","image":"busybox:1.36","command":["sh","-c","sleep 86400"],"volumeMounts":[{"name":"d","mountPath":"/d"}]}],"volumes":[{"name":"d","persistentVolumeClaim":{"claimName":"grow"}}]}}'
pod/grower created
$ kubectl wait --for=condition=Ready pod/grower --timeout=120s
pod/grower condition met
$ kubectl patch pvc grow -p '{"spec":{"resources":{"requests":{"storage":"128Mi"}}}}'
persistentvolumeclaim/grow patched
$ sleep 20
$ kubectl get pvc grow -o jsonpath='spec: {.spec.resources.requests.storage} status: {.status.capacity.storage}{"\n"}'
spec: 128Mi status: 64Mi
$ echo "conditions: $(kubectl get pvc grow -o jsonpath='{.status.conditions}')"
conditions: [{"lastProbeTime":null,"lastTransitionTime":"2026-11-18T05:29:06Z","message":"A pod is currently referencing this PVC","reason":"PodUsingPVC","status":"False","type":"Unused"}]
$ kubectl get pvc grow -o jsonpath='{.status.allocatedResourceStatuses}{"\n"}'
$ kubectl describe pvc grow | tail -8
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal WaitForFirstConsumer 35s (x2 over 36s) persistentvolume-controller waiting for first consumer to be created before binding
Normal ExternalProvisioning 35s (x2 over 35s) persistentvolume-controller Waiting for a volume to be created either by the external provisioner 'rancher.io/local-path' or manually by the system administrator. If volume creation is delayed, please verify that the provisioner is running and correctly registered.
Normal Provisioning 35s rancher.io/local-path_local-path-provisioner-75f7fc7dc5-fn77f_38469406-ed44-47b9-ab58-e77608b6f5e9 External provisioner is provisioning volume for claim "default/grow"
Normal ProvisioningSucceeded 27s rancher.io/local-path_local-path-provisioner-75f7fc7dc5-fn77f_38469406-ed44-47b9-ab58-e77608b6f5e9 Successfully provisioned volume pvc-66665d14-7fe5-4b21-b8fa-82d0dc39d1e6
Normal ExternalExpanding 22s volume_expand waiting for an external controller to expand this PVC
$ kubectl delete pod grower
pod "grower" deleted from default namespace
$ kubectl delete pvc grow
persistentvolumeclaim "grow" deleted from default namespace
$ # put the shared default class back the way it was
$ kubectl patch storageclass standard -p '{"allowVolumeExpansion":false}'
storageclass.storage.k8s.io/standard patchedallowVolumeExpansion: true and the claim accepts the larger request, so spec reads 128Mi while status.capacity stays at 64Mi. status.conditions holds only Unused: False (a pod references the claim), nothing about resizing, and the only resize event is ExternalExpanding: waiting for an external controller to expand this PVC, which is the whole answer: local-path has no resize support, so no controller ever picks the request up and the claim waits forever with its spec and status disagreeing. There is no error to find, which is the failure mode worth recognizing.A generic ephemeral volume gives a pod a real PVC with a real class and a real lifetime of exactly one pod. The naming rule and the ownerReference are the whole trick.
kubectl apply -f - <<'EOF'
apiVersion: v1
kind: Pod
metadata: { name: eph, namespace: default }
spec:
containers:
- name: c
image: busybox:1.36
command: ["sh", "-c", "sleep 86400"]
volumeMounts: [{ name: scratch, mountPath: /scratch }]
volumes:
- name: scratch
ephemeral:
volumeClaimTemplate:
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 64Mi } }
EOF
kubectl wait --for=condition=Ready pod/eph --timeout=120s
kubectl get pvc eph-scratch
kubectl get pvc eph-scratch -o jsonpath='{.metadata.ownerReferences}' | jq
kubectl delete pod eph
sleep 15
kubectl get pvc eph-scratchoutputcaptured 2026-09-13
$ kubectl apply -f - <<'EOF'
apiVersion: v1
kind: Pod
metadata: { name: eph, namespace: default }
spec:
containers:
- name: c
image: busybox:1.36
command: ["sh", "-c", "sleep 86400"]
volumeMounts: [{ name: scratch, mountPath: /scratch }]
volumes:
- name: scratch
ephemeral:
volumeClaimTemplate:
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 64Mi } }
EOF
pod/eph created
$ kubectl wait --for=condition=Ready pod/eph --timeout=120s
pod/eph condition met
$ kubectl get pvc eph-scratch
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
eph-scratch Bound pvc-60e802fd-df09-43c4-90ba-64f0e90ad910 64Mi RWO standard <unset> 13s
$ kubectl get pvc eph-scratch -o jsonpath='{.metadata.ownerReferences}' | jq
[
{
"apiVersion": "v1",
"blockOwnerDeletion": true,
"controller": true,
"kind": "Pod",
"name": "eph",
"uid": "b7e5e146-ef47-42b5-afb7-8af422d2a318"
}
]
$ kubectl delete pod eph
pod "eph" deleted from default namespace
$ sleep 15
$ kubectl get pvc eph-scratch
Error from server (NotFound): persistentvolumeclaims "eph-scratch" not found<pod>-<volume>, owned by the pod, and gone once the pod is.Snapshots are three separate installs: the CRDs, the snapshot-controller, and driver support. kind with local-path has none of them, and knowing that is more useful than reciting the object names.
kubectl get crd | grep snapshot.storage.k8s.io || echo 'no snapshot CRDs installed'
kubectl api-resources | grep -i volumesnapshot || echo 'no volumesnapshot API on this cluster'
kubectl get csidrivers
kubectl get sc standard -o jsonpath='{.provisioner}{"\n"}'outputcaptured 2026-09-12
$ kubectl get crd | grep snapshot.storage.k8s.io || echo 'no snapshot CRDs installed'
no snapshot CRDs installed
$ kubectl api-resources | grep -i volumesnapshot || echo 'no volumesnapshot API on this cluster'
no volumesnapshot API on this cluster
$ kubectl get csidrivers
NAME ATTACHREQUIRED PODINFOONMOUNT STORAGECAPACITY TOKENREQUESTS REQUIRESREPUBLISH MODES AGE
csi.spiffe.io false true false <unset> false Ephemeral 21m
$ kubectl get sc standard -o jsonpath='{.provisioner}{"\n"}'
rancher.io/local-pathA PVC with no storageClassName is not bound to "the default forever": it records whatever default existed when admission saw it, and since retroactive default assignment it can be filled in later. Watch both halves.
kubectl get storageclass -o custom-columns='NAME:.metadata.name,DEFAULT:.metadata.annotations.storageclass\.kubernetes\.io/is-default-class'
kubectl annotate storageclass standard storageclass.kubernetes.io/is-default-class-
kubectl apply -f - <<'EOF'
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: noclass, namespace: default }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 64Mi } }
EOF
kubectl get pvc noclass -o jsonpath='class=[{.spec.storageClassName}] phase={.status.phase}{"\n"}'
kubectl annotate storageclass standard storageclass.kubernetes.io/is-default-class=true
sleep 20
kubectl get pvc noclass -o jsonpath='class=[{.spec.storageClassName}] phase={.status.phase}{"\n"}'
kubectl delete pvc noclassoutputcaptured 2026-09-13
$ kubectl get storageclass -o custom-columns='NAME:.metadata.name,DEFAULT:.metadata.annotations.storageclass\.kubernetes\.io/is-default-class'
NAME DEFAULT
standard true
$ kubectl annotate storageclass standard storageclass.kubernetes.io/is-default-class-
storageclass.storage.k8s.io/standard annotated
$ kubectl apply -f - <<'EOF'
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: noclass, namespace: default }
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 64Mi } }
EOF
persistentvolumeclaim/noclass created
$ kubectl get pvc noclass -o jsonpath='class=[{.spec.storageClassName}] phase={.status.phase}{"\n"}'
class=[] phase=Pending
$ kubectl annotate storageclass standard storageclass.kubernetes.io/is-default-class=true
storageclass.storage.k8s.io/standard annotated
$ sleep 20
$ kubectl get pvc noclass -o jsonpath='class=[{.spec.storageClassName}] phase={.status.phase}{"\n"}'
class=[standard] phase=Pending
$ kubectl delete pvc noclass
persistentvolumeclaim "noclass" deleted from default namespacestandard written into its spec once the annotation is back. Restore the annotation before you leave this exercise or every later claim on the page hangs.Self-check
A PVC has been Pending for ten minutes and describe shows no events at all. Bug or not?
Not a bug if the StorageClass uses WaitForFirstConsumer and no pod mounts it yet: until a pod is scheduled, Kubernetes won't provision anything or emit events. It turns into a real bug only once a pod references the claim and it still sits Pending, at which point the events appear and tell you why.
A PV sits in Released and your new, identical PVC will not bind to it. Why, and what is the fix?
Retain leaves spec.claimRef pointing at the old claim, so Kubernetes treats the PV as still spoken for. Clear it with kubectl patch pv <name> -p '{"spec":{"claimRef":null}}' to flip it back to Available. The real engineering decision is whether you should wipe the leftover data before letting another workload mount it.
You delete a StatefulSet and its PVCs remain. Accident or design?
100% by design. Keeping PVCs alive ensures scaling back up reattaches the same data and prevents an accidental delete from wiping a database. When you want automatic cleanup, opt in via persistentVolumeClaimRetentionPolicy (whenDeleted and whenScaled).
Two pods on different nodes must share a directory. What do you need, and what will this lab do?
You need a StorageClass backed by an RWX-capable provisioner (NFS, CephFS, or a cloud file service). Because local-path only supports RWO, the claim sits Pending and its events explain why. Saying "the current provisioner can't do RWX, here's the class/driver swap required" is the exact right answer both in the lab and on the exam.
Which quota lines cap tenant storage, and why is per-class quota interesting?
requests.storage caps total volume size and persistentvolumeclaims caps the object count; <class>.storageclass.storage.k8s.io/requests.storage caps a single class. Per-class quotas let platform teams offer an expensive high-IOPS tier without letting every tenant quietly burn budget on it.
You want scale-down to reclaim volumes but deleting the StatefulSet by mistake to keep them. Which fields, and since when is this GA?
Set persistentVolumeClaimRetentionPolicy: { whenScaled: Delete, whenDeleted: Retain } (GA since Kubernetes 1.32). Under the hood, Delete adds an ownerReference to the condemned pod so garbage collection cleans up the PVC once the pod exits; node-failure replacements don't count as scale events and keep their claims.
An expansion to 500Gi failed because the backend has no capacity and the PVC keeps retrying. Can you back out?
Yes: RecoverVolumeExpansionFailure has been GA since 1.34. Just lower the PVC request back down to anything above status.capacity (you still can't shrink below current size) and watch status.allocatedResourceStatuses and events. Before 1.34, you had to manually flip to Retain, delete the PVC, clear claimRef, and recreate it.
Restore a database volume from last night's snapshot into a new PVC. What does the manifest look like and what must be true first?
Create a PVC with dataSource: { kind: VolumeSnapshot, name: <snap>, apiGroup: snapshot.storage.k8s.io } in the same namespace, using a StorageClass from the same CSI driver and a size at least as large as the snapshot's restore size. Make sure the VolumeSnapshot shows status.readyToUse: true first, or the PVC will hang in Pending.
How do you change a volume's IOPS tier without recreating it?
Use a VolumeAttributesClass (GA since 1.34). Define the class with your driver's performance parameters, then update the mutable spec.volumeAttributesClassName field on the PVC and let the external-resizer apply it. Regular StorageClass parameters, by contrast, are locked at creation time.
Docs to know your way around
- kubernetes.io: Persistent Volumes (the access-modes and reclaim tables), Storage Classes, Volume Snapshots, StatefulSet
volumeClaimTemplates. - Offline:
kubectl explain pvc.spec,kubectl explain sc,kubectl get sc -o wide, and PVCstatus.conditionswhen a resize misbehaves. - kubernetes.io: Persistent Volumes, "Expanding Persistent Volumes Claims" and "Recovering from Failure when Expanding Volumes": the exact rules for grow-only, filesystem-on-mount and the smaller-retry path.
- kubernetes.io: Ephemeral Volumes and Volume Attributes Classes: generic ephemeral volume naming and ownership; the mutable volumeAttributesClassName field.
- velero.io/docs: "How Velero Works" and "CSI snapshot support": the Backup/Schedule/Restore objects and the CSI versus file-system backup choice.
make down-api