Storage Management
medium
Pregunta de Storage Management #019e3a4f
Enunciado de la Pregunta
Storage Management
#kubernetes
#persistentvolumeclaim
#pod
#storage
Medio
Which resource do you use to attach a volume in a Pod?
A
StorageVolume
B
PersistentVolume
C
StorageClass
D
PersistentVolumeClaim
Correcto
Explicación Oficial / Explicaciones de la Comunidad
In Kubernetes, to attach a volume to a Pod, you use a PersistentVolumeClaim (PVC). A PVC is a request for storage by a user that can be bound to a PersistentVolume (PV) that provides the actual storage. The Pod references the PVC in its volume definition, and Kubernetes automatically mounts the associated PV into the Pod's containers.
How it Works
- A
PersistentVolume(PV) is a piece of storage in the cluster provisioned by an administrator or dynamically via aStorageClass. - A
PersistentVolumeClaim(PVC) is a request for storage by a user, specifying size, access modes, and optionally aStorageClass. - Kubernetes binds the PVC to a suitable PV that matches the claim's requirements.
- In the Pod specification, you define a volume that references the PVC by name. When the Pod is created, the volume is mounted into the container at the specified mount path.
Why the Correct Answer is Right
PersistentVolumeClaimis the correct resource because it abstracts the storage details from the Pod. The Pod only needs to know the PVC name, not the underlying PV or storage backend.
Why the Incorrect Answers are Wrong
StorageVolumeis not a valid Kubernetes resource. The correct term isPersistentVolumeClaimorVolumein the Pod spec.PersistentVolumeis a cluster resource that represents actual storage, but it is not directly referenced by a Pod. Instead, a Pod uses a PVC that binds to a PV.StorageClassdefines the type of storage (e.g., fast SSD, standard HDD) and is used for dynamic provisioning of PVs, but it is not directly attached to a Pod. A PVC can reference aStorageClassto request dynamically provisioned storage.