Kubernetes Container Orchestration Storage Solutions 4 — Questions and Answers
Question 1: What does the 'subPath' field in a volumeMount allow you to do?
- Mount only a specific subdirectory or file from a volume into a container (Correct answer)
- Create nested mount points within the same volume
- Share a volume subdirectory between two containers
- Restrict volume access to a specific namespace path
Correct answer: Mount only a specific subdirectory or file from a volume into a container
subPath lets you mount a specific file or directory within a volume into the container rather than the entire volume root.
Question 2: Which storage plugin type is built directly into the Kubernetes codebase (in-tree) but is being deprecated in favor of CSI?
- FlexVolume
- NFS provisioner
- aws-ebs (Correct answer)
- Rook-Ceph
Correct answer: aws-ebs
In-tree plugins like aws-ebs, gce-pd, and azure-disk are built into the Kubernetes binary and are being migrated to out-of-tree CSI drivers.
Question 3: What is the purpose of the 'fsGroup' field in a pod's securityContext related to storage?
- It sets the filesystem encryption key for mounted volumes
- It causes the kubelet to change the group ownership of mounted volumes to the specified GID (Correct answer)
- It restricts volume access to processes running as a specific UID
- It specifies the filesystem type used when formatting new volumes
Correct answer: It causes the kubelet to change the group ownership of mounted volumes to the specified GID
When fsGroup is set, Kubernetes recursively changes the group ownership of the volume to that GID so the pod's processes can read and write it.
Question 4: A PVC is in 'Pending' state. What is the most common reason for this?
- The pod mounting the PVC has not started yet
- No PersistentVolume matches the PVC's storage request, access mode, or StorageClass (Correct answer)
- The namespace lacks permission to use PersistentVolumes
- The kubelet on the target node is offline
Correct answer: No PersistentVolume matches the PVC's storage request, access mode, or StorageClass
A PVC stays Pending when no available PV satisfies its requirements (size, access mode, StorageClass) and no dynamic provisioner creates one.
Question 5: Which Kubernetes object is used to protect a PVC from deletion while it is being used by a pod?
- ResourceQuota
- PodDisruptionBudget
- Finalizer (kubernetes.io/pvc-protection) (Correct answer)
- LimitRange
Correct answer: Finalizer (kubernetes.io/pvc-protection)
The pvc-protection finalizer is automatically added to PVCs and prevents their deletion until no active pods are using them.
Question 6: What is 'local' volume type in Kubernetes and how does it differ from hostPath?
- Local volumes are network-attached; hostPath is node-local disk
- Local volumes are statically provisioned with node affinity constraints; hostPath has no scheduling guarantees (Correct answer)
- Local volumes auto-replicate data; hostPath stores a single copy
- Local volumes require CSI; hostPath uses in-tree drivers only
Correct answer: Local volumes are statically provisioned with node affinity constraints; hostPath has no scheduling guarantees
Local volumes are like hostPath but include node affinity so Kubernetes guarantees the pod is always scheduled to the node that owns the data.
Question 7: When using NFS as a Kubernetes PersistentVolume, which access modes are typically supported?
- ReadWriteOnce only
- ReadOnlyMany and ReadWriteMany (Correct answer)
- ReadWriteOncePod only
- ReadWriteOnce and ReadWriteOncePod
Correct answer: ReadOnlyMany and ReadWriteMany
NFS supports concurrent access by multiple clients, so it naturally supports ReadOnlyMany and ReadWriteMany access modes.
What does the 'subPath' field in a volumeMount allow you to do?