DevOps & Kubernetes (50 Qs)•Part 2: Kubernetes Architecture & Core Workloads (11 - 25)
Persistent Volumes (PV), PVC, StorageClass, and the Container Storage Interface (CSI).
Kubernetes Storage Subsystem
Kubernetes abstracts physical storage infrastructure through a 3-tier declarative model: StorageClass, PersistentVolumeClaim (PVC), and PersistentVolume (PV) managed via the Container Storage Interface (CSI).
sql
[ Developer Request ]
|
v
+-------------------------------+
| PersistentVolumeClaim (PVC) | -> Demands 100Gi, ReadWriteOnce
+-------------------------------+
|
v
+-------------------------------+
| StorageClass (CSI) | -> aws-ebs-csi-driver, gp3, dynamic provisioner
+-------------------------------+
|
v (Calls Cloud Provider Storage API)
+-------------------------------+
| PersistentVolume (PV) | -> Provisions actual EBS Volume / SAN LUN
+-------------------------------+
|
v (Attached to EC2 & Mounted into Pod filesystem)
[ Pod /var/lib/data Mount ]
Access Modes Breakdown
| Access Mode | CLI Notation | Architecture & Support |
|---|---|---|
| ReadWriteOnce | RWO | Can be mounted as read-write by a single node. Typical for block storage (AWS EBS, GCP Persistent Disk, Azure Managed Disks). |
| ReadOnlyMany | ROX | Can be mounted as read-only by many nodes simultaneously. |
| ReadWriteMany | RWX | Can be mounted as read-write by many nodes simultaneously. Requires network filesystems (NFS, AWS EFS, CephFS). |
| ReadWriteOncePod | RWOP | (Kubernetes 1.22+) Restricts access to a single Pod across the entire cluster. |
Reclaim Policies
Delete(Default in cloud): When the PVC is deleted, the underlying PV and cloud storage disk are automatically permanently destroyed.Retain: When the PVC is deleted, the PV remains inReleasedstate. The underlying physical storage and data are preserved for manual recovery.