CSI: the plugin interface for storage
The Container Storage Interface (CSI) is to storage what CNI is to networking: a standard interface that lets Kubernetes provision, attach, and mount volumes without knowing the specifics of any one backend. Each cloud ships a CSI driver — the EBS CSI driver, the PD CSI driver, the Azure Disk CSI driver — that a StorageClass points at via its provisioner field.
Provider storage classes, side by side
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-ssd
provisioner: ebs.csi.aws.com
parameters:
type: gp3
iops: "3000"
volumeBindingMode: WaitForFirstConsumerapiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-ssd
provisioner: pd.csi.storage.gke.io
parameters:
type: pd-ssd
volumeBindingMode: WaitForFirstConsumerapiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-ssd
provisioner: disk.csi.azure.com
parameters:
skuName: Premium_LRS
volumeBindingMode: WaitForFirstConsumerThe PVC that consumes any of these looks identical — only the StorageClass name differs, which is the whole point.
Access modes
- ReadWriteOnce (RWO) — mountable read-write by one node at a time. Nearly all cloud block storage (EBS, Persistent Disk, Azure Disk) is RWO only.
- ReadWriteMany (RWX) — mountable read-write by multiple nodes at once. Needs a network filesystem (EFS, Filestore, Azure Files) rather than a block disk.
- ReadOnlyMany (ROX) — multiple nodes, read-only.
A StatefulSet whose Pods each need their own writable volume is the normal RWO case. Multiple Pods needing to write to the same shared directory — a shared upload folder, for instance — needs RWX, and therefore a different kind of storage entirely.
Volume snapshots & backups
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: db-data-snapshot
spec:
volumeSnapshotClassName: csi-snapclass
source:
persistentVolumeClaimName: db-dataCSI's snapshot API gives you provider-native, point-in-time disk snapshots through the same Kubernetes-native YAML — useful for backups, or for cloning a volume to seed a new environment.