DCA · Question #155
You want to mount external storage to a particular filesystem path in a container in a Kubernetes pod. What is the correct set of objects to use for this?
The correct answer is A. a volume in the pod specification, populated with a perslstentVolumeClaim bound to a. To mount external storage to a container in a Kubernetes pod, you define a volume in the pod specification, which is then populated by a PersistentVolumeClaim bound to a PersistentVolume.
Question
You want to mount external storage to a particular filesystem path in a container in a Kubernetes pod. What is the correct set of objects to use for this?
Options
- Aa volume in the pod specification, populated with a perslstentVolumeClaim bound to a
- Ba storageClass In the pod's specification, populated with a volume which Is bound to a provisioner
- Ca volume in the pod specification, populated with a storageClass which is bound to a provisioner
- Da perslstentVolume in the pod specification, populated with a persistentVolumeClaim which is
How the community answered
(43 responses)- A74% (32)
- B7% (3)
- C14% (6)
- D5% (2)
Why each option
To mount external storage to a container in a Kubernetes pod, you define a volume in the pod specification, which is then populated by a PersistentVolumeClaim bound to a PersistentVolume.
In Kubernetes, a `PersistentVolumeClaim` (PVC) is used by a pod to request a specific size and access mode of storage. This PVC is then bound to a `PersistentVolume` (PV), which represents the actual storage resource provisioned (either statically or dynamically by a `StorageClass`). The `volume` definition within the pod's specification references this PVC, allowing the container to mount the requested external storage at a specified path.
A `StorageClass` is for dynamic provisioning of PVs, it's not directly populated by a `volume` within a pod, which instead references a `PersistentVolumeClaim`.
A `volume` in the pod's specification references a `PersistentVolumeClaim`, not directly a `StorageClass`; the `StorageClass` is used by the `PersistentVolumeClaim` to provision the underlying storage.
A `PersistentVolume` represents the physical storage resource and is not directly defined within a pod's specification; pods consume storage via `PersistentVolumeClaims`.
Concept tested: Kubernetes Persistent Storage (PV, PVC, Pod Volume)
Source: https://kubernetes.io/docs/concepts/storage/persistent-volumes/
Topics
Community Discussion
No community discussion yet for this question.