KCNA Storage Solutions 3 — Questions and Answers
Question 1: Which Kubernetes volume type mounts a directory from the host node's filesystem into a pod?
- emptyDir
- configMap
- hostPath (Correct answer)
- nfs
Correct answer: hostPath
A hostPath volume mounts a file or directory from the host node's filesystem directly into the pod, which can be useful for system-level access but introduces node dependency.
Question 2: A pod using an 'emptyDir' volume is deleted. What happens to the data stored in that volume?
- Data is persisted to the node's disk permanently
- Data is backed up to the cluster's etcd store
- Data is deleted when the pod is removed (Correct answer)
- Data is migrated to a PersistentVolume automatically
Correct answer: Data is deleted when the pod is removed
An emptyDir volume exists only for the lifetime of the pod; when the pod is deleted, the data in the emptyDir is permanently erased.
Question 3: What is the primary purpose of a VolumeSnapshotClass in Kubernetes?
- Define access modes for snapshots
- Specify the CSI driver and parameters used when creating volume snapshots (Correct answer)
- Set retention policies for PersistentVolumes
- Control replication of snapshots across clusters
Correct answer: Specify the CSI driver and parameters used when creating volume snapshots
VolumeSnapshotClass defines the CSI driver and optional parameters to be used when a VolumeSnapshot is created, similar to how StorageClass works for volumes.
Question 4: Which Kubernetes API resource lets you restore a PVC from a previously taken volume snapshot?
- VolumeSnapshotContent
- VolumeSnapshotClass
- DataSource referencing a VolumeSnapshot in the PVC spec (Correct answer)
- StorageClass with a restore parameter
Correct answer: DataSource referencing a VolumeSnapshot in the PVC spec
To restore from a snapshot, you create a new PVC with its dataSource field pointing to the VolumeSnapshot object, which triggers the CSI driver to provision a restored volume.
Question 5: Which of the following is NOT a valid Kubernetes volume plugin category?
- In-tree volume plugins
- Out-of-tree CSI drivers
- FlexVolume plugins
- KubeVolume extensions (Correct answer)
Correct answer: KubeVolume extensions
Kubernetes supports in-tree plugins, CSI (out-of-tree) drivers, and the legacy FlexVolume mechanism, but 'KubeVolume extensions' is not a real category.
Question 6: What does the 'volumeBindingMode: WaitForFirstConsumer' setting in a StorageClass achieve?
- Volumes are provisioned immediately when a PVC is created
- Volume provisioning is delayed until a pod using the PVC is scheduled (Correct answer)
- Volumes are shared among all pods in a namespace
- Volume binding fails if no consumer exists within 60 seconds
Correct answer: Volume provisioning is delayed until a pod using the PVC is scheduled
WaitForFirstConsumer delays PV binding and provisioning until a pod that needs the PVC is scheduled, allowing the volume to be created in the same topology zone as the pod.
Question 7: A StatefulSet requires each pod to have its own dedicated PersistentVolumeClaim. Which feature provides this?
- Shared PVC across all pods
- volumeClaimTemplates in the StatefulSet spec (Correct answer)
- DaemonSet-managed PVCs
- Pod affinity rules on PVCs
Correct answer: volumeClaimTemplates in the StatefulSet spec
StatefulSets use volumeClaimTemplates to automatically create a unique PVC for each pod replica, ensuring each instance has isolated persistent storage.
Which Kubernetes volume type mounts a directory from the host node's filesystem into a pod?