Explain the relationship between PersistentVolume (PV), PersistentVolumeClaim (PVC) and StorageClass and how the Dynamic Provisioning mechanism works?
The PV represents the physical storage disk present in the infrastructure. The PVC represents a request made by the developer to reserve storage space with certain specifications (size and access pattern). The StorageClass is the template that connects them; instead of manually creating PV disks, the volume monitors the creation of the PVC and automatically calls the CSI Driver to truncate a new physical disk in the cloud, create a matching PV, and bind them together (Bound).
Detailed Technical Explanation & PracticeExpand DetailsCollapse Details
Imagine the relationship as follows:
- Node is equivalent in computing to PersistentVolume (PV) disk.
- Pod is matched in the storage request to a PersistentVolumeClaim (PVC) request. StorageClass is an automated broker that achieves Dynamic Provisioning:
[Developer creates PVC]
│
▼
[Kubernetes detects StorageClass]
│
▼
[CSI Driver provisions Cloud Disk: AWS EBS / GCP PD]
│
▼
[Kubernetes auto-creates PV]
│
▼
[PVC & PV become Bound]
│
▼
[Kubelet attaches and mounts volume to Pod path]Setting volumeBindingMode:WaitForFirstConsumer is crucial; It postpones the creation and reservation of the physical disk until the node that will host the pod is determined by the Kube-Scheduler, ensuring that the disk is created in the same Availability Zone as the node.
- It is believed that deleting the application pod necessarily deletes the PV data; a Reclaim Policy such as Retain protects the disk and data even after the PVC and Pod are deleted.
- Using the RWO (ReadWriteOnce) disk and trying to connect it to multiple pods running on different nodes.
- What is the difference between recovery policies: Delete, Retain, and Recycle?
- What is the importance of setting volumeBindingMode: WaitForFirstConsumer in the StorageClass?
What are the access modes available for storage disks in Kubernetes, and what is the fundamental difference between them?
The access patterns are: ReadWriteOnce (RWO - disk can be mounted read-write by only one node), ReadOnlyMany (ROX - can be mounted read-only by multiple nodes at the same time), ReadWriteMany (RWX - can be mounted read-write by multiple nodes simultaneously), and ReadWriteOncePod (RWOP - limit installation to only one pod in the entire cluster).
Detailed Technical Explanation & PracticeExpand DetailsCollapse Details
Access patterns table in Kubernetes:
| Access pattern | Abbreviation | Description | Examples of compatible storage media |
|---|---|---|---|
| ReadWriteOnce | RWO |
Read and write by Single Node | AWS EBS, GCP Persistent Disk, Azure Disk, iSCSI |
| ReadOnlyMany | ROX |
Read only by Multiple Nodes | NFS, Ceph, Cloud Storage Buckets |
| ReadWriteMany | RWX |
Simultaneous read and write by multiple nodes | NFS, AWS EFS, GlusterFS, Azure Files |
| ReadWriteOncePod | RWOP |
Read and write using Exclusively One Capsule (Single Pod) | Modern CSI Plugins (Kubernetes v1.22+) |
- Confusing the concept of ReadWriteOnce (one node only) into thinking it means one pod; multiple pods within the same node can read and write to the same RWO disk, but a pod on a second node will fail to mount the disk (Multi-Attach error).
- Try using a cloud-based block disk (such as AWS EBS or Azure Managed Disk) with RWX mode; Block Storage disks do not inherently support RWX, but require networked file systems such as NFS, CephFS, or AWS EFS.
- What is the famous error message that appears when you try to run a Pod on a second server linked to an RWO disk installed on a first server?
- How does the modern ReadWriteOncePod access pattern address the security vulnerability in the exclusive storage lock?