Hedronite · Cert Lesson · Cert-Prep / CNCF · Thu 2026-09-24

CKA StorageClass — PVC/PV binding and reclaim

StorageClass holds the recipe. PVC holds the request. PV holds reclaim.

Lesson Class: Cert-Prep (CKA · Storage)
Cert Target: CKA (CNCF)
Paired Ops: AKS Azure Disk CSI
Paired Dev: Python StorageClass + PVC census
Grounding: CKA Q14 Questions+SolutionNotes · Q1 referenced · Poulton Ch.10
Q14
Create local-storage · WaitForFirstConsumer · sole default
Bind
Wait vs Immediate · one default only
Reclaim
Delete vs Retain lives on the PV
Patch until one default remains. Read reclaim on the PV.

<!-- hal:authoritative:yaml -->

On the exam, StorageClass holds the recipe. PVC holds the request. PV holds reclaim. Patch defaults until exactly one class is default.

§I - Frame

CKA storage stems still turn on three objects: StorageClass, PersistentVolumeClaim, PersistentVolume. Bootcamp Q14 is the primary drill today: create StorageClass local-storage with provisioner rancher.io/local-path, set volumeBindingMode: WaitForFirstConsumer, do not leave it default at create, then patch so it becomes the only default class. Do not modify existing Deployments or PVCs.

k8s_day_counter 20 is even, so CKA-emphasis. 09-21 was CKS ServiceAccount hardening. 09-18 was CKA Gateway. 09-12 was CKS PSA. Gateway, Ingress, NetworkPolicy, and PSA do not satisfy Q14.

Ops tonight colors the same objects with AKS disk.csi.azure.com. The exam may use local-path or another provisioner string. Memorize fields, not cloud brand names.

§II - Objective map

NeedMechanism
Dynamic recipeStorageClass with provisioner, optional parameters, reclaimPolicy, volumeBindingMode
Request bytesPersistentVolumeClaim with accessModes, resources.requests.storage, optional storageClassName
Bound volumeController provisions or matches a PersistentVolume; PVC phase Bound; spec.volumeName set
Default classAnnotation storageclass.kubernetes.io/is-default-class=true on exactly one SC
Survive claim deletePV persistentVolumeReclaimPolicy: Retain (from class at create, or static PV)

Access modes you must recognize: ReadWriteOnce (RWO), ReadOnlyMany (ROX), ReadWriteMany (RWX). Many block CSI volumes are RWO only.

§III - Q14 drill pattern (exam core)

  1. Write and apply the StorageClass (annotation false or omitted at create is fine):
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
  annotations:
    storageclass.kubernetes.io/is-default-class: "false"
provisioner: rancher.io/local-path
volumeBindingMode: WaitForFirstConsumer
  1. Confirm: kubectl get sc local-storage shows WaitForFirstConsumer and not default.
  2. Patch local-storage to default true. Patch the previous default (often local-path) to false. Q14 wants local-storage as the only default.
  3. Re-check: kubectl get sc shows one (default). validate.bash counts defaults via JSON.

Do not touch Deployments or PVCs named in the stem. Binding mode is on the class, not on the claim.

§IV - Bind and reclaim discriminators

WaitForFirstConsumer vs Immediate. Wait delays provisioning until a Pod that uses the PVC is scheduled. Immediate provisions when the PVC is created. Multi-zone disks need Wait; eager Immediate is how affinity conflicts appear in Ops notes.

Default class. A PVC that omits storageClassName uses the default. Two defaults confuse admission. Zero defaults leave omitted-class claims Pending.

Reclaim Delete vs Retain (Poulton Ch.10). Delete (common StorageClass default) removes PV and back-end asset when the PVC is deleted. Retain keeps the PV (often Released) and the external volume; other claims cannot use it until you clear stale claimRef (Q1 adjacency). Recycle is gone from current API; do not write it.

Who owns reclaim. The policy lives on the PV (persistentVolumeReclaimPolicy). StorageClass reclaimPolicy is what dynamic provisioning copies at create. Read the PV after bind.

§V - Exam traps

  1. Answering Q14 with Ingress or Gateway YAML. Wrong domain.
  2. Leaving two defaults after the patch. Patch the old default false.
  3. Setting WaitForFirstConsumer on the PVC. Field belongs on StorageClass.
  4. Expecting RWX from a block volume stem. Match accessModes to the provisioner.
  5. Hunting reclaim on the PVC. Check the PV (and the class that minted it).

§VI - Study drill

  1. Run Bootcamp Q14 LabSetUp if present; apply SolutionNotes path cold.
  2. Run validate.bash; fix until all checks pass (exists, provisioner, WaitForFirstConsumer, sole default).
  3. Flash three lines: SC recipe / PVC request / PV reclaim; Wait vs Immediate; one default only.
  4. Optional adjacency: skim Q1 LabSetUp for Retain + claimRef reset (supporting, not tonight's primary apply).

Success: Q14 validate exit 0; you can explain PVC Pending under Wait with no Pod; you can state Delete vs Retain without guessing the PVC object.

§VII - Close instruction

File Q14 as the muscle memory. Pair: Ops AKS Azure Disk CSI classes; Dev Python StorageClass/PVC census. Maghrib owns quiz.html later.

Related