What is a PersistentVolumeClaim (PVC) in Kubernetes?
A PersistentVolumeClaim (PVC) is a request for storage by a user. It allows pods to claim storage resources without knowing the details of the underlying storage.
Click to reveal answer
beginner
Which key fields are required in a basic PVC YAML definition?
apiVersion, kind, metadata (name), and spec (accessModes, resources.requests.storage).
Click to reveal answer
intermediate
What does the accessModes field in a PVC specify?
It specifies how the volume can be mounted. Common values are ReadWriteOnce, ReadOnlyMany, and ReadWriteMany.
Click to reveal answer
intermediate
How does a PVC relate to a PersistentVolume (PV)?
A PVC requests storage, and Kubernetes binds it to a matching PersistentVolume (PV) that provides the actual storage.
Click to reveal answer
intermediate
What happens if no matching PersistentVolume is available for a PVC?
The PVC stays in a pending state until a suitable PersistentVolume is available or dynamically provisioned.
Click to reveal answer
Which field in a PVC YAML defines the amount of storage requested?
Aspec.resources.requests.storage
Bmetadata.name
Cspec.accessModes
DapiVersion
✗ Incorrect
The storage size requested is specified under spec.resources.requests.storage.
What does the access mode ReadWriteOnce mean in a PVC?
AThe volume can be mounted as read-only by many nodes
BThe volume can be mounted as read-write by a single node
CThe volume can be mounted as read-write by many nodes
DThe volume is read-only and cannot be mounted
✗ Incorrect
ReadWriteOnce means the volume can be mounted as read-write by only one node at a time.
If a PVC is created but no matching PV exists, what is the PVC status?
AAvailable
BBound
CPending
DReleased
✗ Incorrect
The PVC remains in Pending state until a matching PV is found or provisioned.
Which Kubernetes object does a PVC bind to?
APod
BConfigMap
CNamespace
DPersistentVolume (PV)
✗ Incorrect
A PVC binds to a PersistentVolume (PV) that provides the actual storage.
What is the kind value in a PVC YAML file?
APersistentVolumeClaim
BPersistentVolume
CStorageClass
DPod
✗ Incorrect
The kind field for a PVC YAML is PersistentVolumeClaim.
Explain the purpose of a PersistentVolumeClaim in Kubernetes and how it interacts with PersistentVolumes.
Think of PVC as a storage order and PV as the storage supply.
You got /4 concepts.
Describe the key fields in a PersistentVolumeClaim YAML and their roles.
Focus on the YAML structure and what each part means.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a PersistentVolumeClaim (PVC) in Kubernetes?
easy
A. To configure network policies
B. To define a container image for a pod
C. To schedule pods on specific nodes
D. To request storage resources from the cluster
Solution
Step 1: Understand PVC role
A PVC is used to request storage resources in Kubernetes, separating storage use from storage details.
Step 2: Compare options
Options A, B, and D relate to other Kubernetes features, not storage requests.
Final Answer:
To request storage resources from the cluster -> Option D
Quick Check:
PVC = Storage request [OK]
Hint: PVC always requests storage, not images or network [OK]
Common Mistakes:
Confusing PVC with Pod or Deployment definitions
Thinking PVC schedules pods
Mixing PVC with network policies
2. Which of the following is the correct minimal YAML snippet to define a PVC requesting 5Gi of storage with ReadWriteOnce access mode?
Kubernetes expects storage size units like Gi, Mi, not GB. '2GB' is invalid.
Step 2: Verify other fields
accessModes and metadata name are correct. apiVersion for PVC is v1, not apps/v1.
Final Answer:
storage size unit should be Gi, not GB -> Option C
Quick Check:
Use Gi for storage size units [OK]
Hint: Use Gi, Mi units for storage size, not GB [OK]
Common Mistakes:
Using GB instead of Gi for storage size
Wrong apiVersion for PVC
Changing accessModes unnecessarily
5. You want to create a PVC that requests 20Gi storage with ReadWriteOnce access and uses a storage class named "premium-ssd". Which YAML snippet correctly defines this PVC?
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: premium-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: premium-ssd correctly sets storageClassName to premium-ssd and uses Gi units. Other options have wrong accessModes, use limits instead of requests, or wrong units (GB).
Final Answer:
Correct PVC with 20Gi, ReadWriteOnce, and premium-ssd storage class -> Option A