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

  1. A PersistentVolume (PV) is a piece of storage in the cluster provisioned by an administrator or dynamically via a StorageClass.
  2. A PersistentVolumeClaim (PVC) is a request for storage by a user, specifying size, access modes, and optionally a StorageClass.
  3. Kubernetes binds the PVC to a suitable PV that matches the claim's requirements.
  4. 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

  • PersistentVolumeClaim is 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

  • StorageVolume is not a valid Kubernetes resource. The correct term is PersistentVolumeClaim or Volume in the Pod spec.
  • PersistentVolume is 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.
  • StorageClass defines 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 a StorageClass to request dynamically provisioned storage.