Storage Management
medium

Questão de Storage Management #019e3a4f

Enunciado da Questão
Storage Management
#dynamic provisioning
#persistentvolumeclaim
#storageclass
#kubernetes
Médio

How does dynamic storage provisioning work?

A

A user requests dynamically provisioned storage by including an existing storage class in their PersistentVolumeClaim.

Correta
B

An administrator creates a storage class and includes it in their pod YAML definition file without creating a PersistentVolumeClaim.

C

A pod requests dynamically provisioned storage by including a storage class and the pod name in their PersistentVolumeClaim.

D

An administrator creates a PersistentVolume and includes the name of the PersistentVolume in their pod YAML definition file.

Explicação Oficial / Explicações da Comunidade

Dynamic storage provisioning in Kubernetes allows storage volumes to be created on-demand when a user requests them. The correct approach is for a user to include an existing StorageClass in their PersistentVolumeClaim (PVC). The StorageClass defines the provisioner (e.g., cloud provider plugin) and parameters for the volume. When the PVC is submitted, the Kubernetes control plane automatically provisions a PersistentVolume (PV) that matches the PVC's requirements, binding them together. This eliminates the need for an administrator to pre-create PVs.

How it Works:

  1. An administrator creates a StorageClass object that specifies the provisioner (e.g., kubernetes.io/aws-ebs) and parameters (e.g., type, IOPS).
  2. A user creates a PVC that references the StorageClass via the storageClassName field. The PVC specifies access modes and resource requests (e.g., 10Gi storage).
  3. The Kubernetes controller watches for PVCs with a StorageClass and triggers the provisioner to create a PV (e.g., an EBS volume in AWS).
  4. The newly created PV is bound to the PVC, and the pod can mount it.

Why the correct value is right:
Including an existing StorageClass in the PVC is the standard method for dynamic provisioning. The StorageClass acts as a template for the provisioner to create the actual storage backend.

Why the incorrect values are wrong:

  • An administrator creating a StorageClass and including it in a pod YAML definition without creating a PVC is incorrect because pods do not directly reference StorageClasses; they reference PVCs. The PVC is the mechanism to request storage, and the StorageClass is referenced within the PVC.
  • A pod requesting dynamically provisioned storage by including a StorageClass and the pod name in the PVC is incorrect because PVCs do not include pod names. PVCs are independent resources that can be used by multiple pods, and the binding is done via the PVC name in the pod's volume definition.
  • An administrator creating a PersistentVolume and including its name in a pod YAML definition is static provisioning, not dynamic. Dynamic provisioning automatically creates the PV; manually creating a PV defeats the purpose of dynamic provisioning.