KCNA Storage & Persistent Volumes 5 โ Questions and Answers
Question 1: What is the primary advantage of using the Container Storage Interface (CSI) over in-tree volume plugins?
- CSI volumes support more access modes than in-tree plugins
- CSI allows storage vendors to develop drivers independently without modifying Kubernetes core (Correct answer)
- CSI drivers are faster because they run in the kernel
- CSI eliminates the need for PersistentVolumes
Correct answer: CSI allows storage vendors to develop drivers independently without modifying Kubernetes core
CSI decouples storage driver development from Kubernetes releases, allowing vendors to ship updates independently without waiting for Kubernetes core changes.
Question 2: A PersistentVolume has a capacity of 10Gi. A PVC requests 8Gi. The PV and PVC are bound. How much storage can the PVC actually use?
- 8Gi exactly, enforced by Kubernetes
- Up to 10Gi, since the entire PV is bound to the PVC (Correct answer)
- Exactly 10Gi is allocated but only 8Gi is accessible
- This PVC would not bind because sizes don't match exactly
Correct answer: Up to 10Gi, since the entire PV is bound to the PVC
When a PV is bound to a PVC, the entire PV is dedicated to that claim; the Pod can use up to the PV's full capacity (10Gi), not just the requested 8Gi.
Question 3: Which component is responsible for registering a CSI driver with the kubelet on each node?
- external-provisioner
- node-driver-registrar (Correct answer)
- external-attacher
- csi-resizer
Correct answer: node-driver-registrar
The node-driver-registrar sidecar registers the CSI driver with kubelet using the kubelet plugin registration mechanism.
Question 4: What is a VolumeSnapshotClass used for in Kubernetes?
- Defining the default StorageClass for snapshots
- Specifying the CSI driver and parameters for creating VolumeSnapshots (Correct answer)
- Setting retention policies for old PersistentVolumes
- Grouping PVCs for batch snapshot operations
Correct answer: Specifying the CSI driver and parameters for creating VolumeSnapshots
VolumeSnapshotClass defines which CSI driver handles snapshot creation and provides driver-specific parameters, analogous to how StorageClass works for volumes.
Question 5: How does Kubernetes handle storage for a Pod in a StatefulSet when the Pod is rescheduled to a different node?
- A new empty PVC is created for the rescheduled Pod
- The same PVC is reattached to the new node and mounted to the rescheduled Pod (Correct answer)
- The PVC is cloned and the clone is attached to the new node
- Storage is lost and must be restored from a VolumeSnapshot
Correct answer: The same PVC is reattached to the new node and mounted to the rescheduled Pod
StatefulSet PVCs are retained across Pod rescheduling; when a Pod moves to a new node, Kubernetes detaches and reattaches the same PVC to preserve data.
Question 6: Which annotation on a StorageClass sets it as the cluster-wide default for PVCs that omit storageClassName?
- storageclass.kubernetes.io/is-default-class: 'true' (Correct answer)
- kubernetes.io/default-storage: 'true'
- storage.alpha.kubernetes.io/default: 'true'
- kubernetes.io/storage-class-default: 'enabled'
Correct answer: storageclass.kubernetes.io/is-default-class: 'true'
The annotation storageclass.kubernetes.io/is-default-class: 'true' marks a StorageClass as the default, automatically used by PVCs that don't specify a class.
Question 7: What is the effect of setting 'persistentVolumeReclaimPolicy: Recycle' on a PersistentVolume?
- The volume is permanently deleted when released
- Basic scrubbing (rm -rf) is performed and the volume is made available again (Correct answer)
- The volume is archived to cold storage
- The volume is retained and admin must manually reclaim it
Correct answer: Basic scrubbing (rm -rf) is performed and the volume is made available again
The Recycle policy performs a basic scrub (rm -rf /thevolume/*) and makes the PV available again for a new claim, though this policy is deprecated in favor of dynamic provisioning.
What is the primary advantage of using the Container Storage Interface (CSI) over in-tree volume plugins?