CKA CKA Storage and Volumes 2 — Questions and Answers
Question 1: What Kubernetes object enables dynamic provisioning of PersistentVolumes?
- VolumeMount
- StorageClass (Correct answer)
- PersistentVolumeClaim
- ResourceQuota
Correct answer: StorageClass
A StorageClass defines the provisioner and parameters used to dynamically create PersistentVolumes on demand when a PVC is submitted.
Question 2: Which field in a StorageClass manifest defines the volume provisioner plugin to use?
- spec.driver
- spec.plugin
- provisioner (Correct answer)
- volumeBindingMode
Correct answer: provisioner
The `provisioner` field identifies the plugin (e.g., `kubernetes.io/aws-ebs` or `ebs.csi.aws.com`) responsible for creating volumes.
Question 3: What does setting `volumeBindingMode: WaitForFirstConsumer` on a StorageClass do?
- Binds the volume immediately when the PVC is created
- Delays volume binding until a Pod using the PVC is scheduled (Correct answer)
- Prevents new PVCs from being created
- Forces all PVCs to use the default storage class
Correct answer: Delays volume binding until a Pod using the PVC is scheduled
WaitForFirstConsumer defers PV creation and binding until a Pod that references the PVC is scheduled, enabling topology-aware provisioning.
Question 4: How do you mark a StorageClass as the default class in a cluster?
- Set spec.default: true
- Add the annotation storageclass.kubernetes.io/is-default-class: 'true' (Correct answer)
- Name it 'default'
- Set reclaimPolicy: Default
Correct answer: Add the annotation storageclass.kubernetes.io/is-default-class: 'true'
Adding the annotation `storageclass.kubernetes.io/is-default-class: 'true'` designates a StorageClass as the cluster default for PVCs that don't specify a class.
Question 5: Which reclaim policy in a StorageClass automatically deletes the underlying storage when a PVC is deleted?
- Retain
- Recycle
- Delete (Correct answer)
- Archive
Correct answer: Delete
The Delete reclaim policy causes the associated storage asset (e.g., an EBS volume) to be deleted when its PVC is removed.
Question 6: What kubectl command lists all available StorageClasses in a cluster?
- kubectl get pv
- kubectl get sc (Correct answer)
- kubectl describe storage
- kubectl list storageclasses
Correct answer: kubectl get sc
The command `kubectl get sc` (or `kubectl get storageclasses`) retrieves all StorageClass objects in the cluster.
What Kubernetes object enables dynamic provisioning of PersistentVolumes?