Storage and CSI
Draft: not yet run against a live cluster. Treat output as representative and check it on yours.
Storage failures are slow and quiet. A pod sits in ContainerCreating for six minutes, then reports a timeout that names a volume ID nobody recognises. Knowing which component owns each step turns that into a two-minute diagnosis.
Under the hood
Section titled “Under the hood”-
Provision. When a PVC is created, the CSI external provisioner sees it and calls the storage backend to create a disk, then creates a PV and binds it. If the StorageClass uses
volumeBindingMode: WaitForFirstConsumer, this waits until a pod using the claim is scheduled, so the disk is created in the right zone. Until then the PVC isPending, and that’s normal. -
Attach. Once the pod is scheduled, the attach/detach controller creates a VolumeAttachment, and the CSI driver’s controller plugin attaches the disk to that node. Network filesystems (NFS and similar) skip this step.
-
Mount. The kubelet on the node calls the CSI node plugin to stage the device (format if needed, mount once per node) and then publish it into the pod’s directory.
-
On deletion,
reclaimPolicydecides the data’s fate.Delete(the default for dynamic provisioning) deletes the disk when the PVC is deleted.Retainkeeps it for manual recovery.
Access modes describe how the volume can be mounted, not what the app does with it: ReadWriteOnce (one node at a time), ReadOnlyMany, ReadWriteMany, and ReadWriteOncePod (one pod at a time).
Minimal example
Section titled “Minimal example”kind ships a default StorageClass backed by node-local storage, enough to watch the binding flow:
kubectl get storageclassapiVersion: v1kind: PersistentVolumeClaimmetadata: name: dataspec: accessModes: [ReadWriteOnce] resources: requests: { storage: 1Gi }---apiVersion: v1kind: Podmetadata: name: writerspec: containers: - name: app image: busybox:1.36 command: ['sh', '-c', 'date >> /data/log; sleep 3600'] volumeMounts: [{ name: data, mountPath: /data }] volumes: - name: data persistentVolumeClaim: { claimName: data }kubectl apply -f pvc.yamlkubectl get pvc data -w # Pending until the pod schedules, then Boundkubectl get pvHow it breaks
Section titled “How it breaks”Self-check
Section titled “Self-check”A PVC is Pending and its event says waiting for first consumer. Is something broken?
No. With WaitForFirstConsumer, binding waits until a pod using the claim is scheduled.
Why does a rolling update of a Deployment with one ReadWriteOnce volume often get stuck?
The new pod starts before the old one stops, possibly on another node, and an RWO disk can only be attached to one node at a time.
What happens to the data when you delete a PVC whose PV has reclaimPolicy Delete?
The underlying disk is deleted along with the PV. The data is gone.
Maps to: CKA: Storage. Check the current exam curriculum, since domain names change between revisions.