Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

CSI Drivers Explained

By Kokil Thapa | Last reviewed: September 2026

Persistent storage breaks many first Kubernetes deployments. Pods restart, but data vanishes because nothing outside the container holds it. CSI Drivers Explained starts with the standard fix: the Container Storage Interface, a vendor-neutral plugin model that lets any block or file backend attach volumes to pods. If you run stateful apps on managed clusters or self-hosted nodes, CSI drivers are how storage actually works in 2026. This guide maps the architecture, install flow, cloud choices, and the failures I see on real production clusters — including patterns that overlap with Linux system administration for Kubernetes hosts.

What is a CSI driver and why does Kubernetes need it?

Before CSI, each cloud volume type lived inside the Kubernetes core tree. AWS EBS, GCE PD, and Azure Disk code shipped with kube-controller-manager. That coupling slowed releases and made third-party storage awkward to support.

The Container Storage Interface specification splits storage into out-of-tree plugins. A CSI driver runs as Deployments or DaemonSets in your cluster. It registers with kubelet and the external-provisioner sidecar. Kubernetes calls the driver through standard RPC methods instead of hard-coded cloud logic.

In practice, you gain three wins. Storage vendors ship fixes without waiting for a Kubernetes minor release. You can run the same CSI pattern on AWS, Azure, on-prem Ceph, or NFS. Deprecated in-tree drivers are removed — GCE PD, OpenStack Cinder, and vSphere in-tree code were dropped in favour of CSI equivalents.

CSI Drivers Explained — High-Level FlowAPI ServerPVC + StorageClassCSI ControllerProvisioner sidecarCloud / SAN APIEBS, Azure Disk, NFSKubelet + NodeCSI node pluginPod VolumeMount inside container
CSI Drivers Explained: control plane provisions volumes; node plugin mounts them into pods

Stateful workloads — databases, Redis, document stores, queue backends — depend on this chain. A Laravel app with file uploads on local disk is a poor fit for ephemeral pod storage. Move uploads to S3 or mount a ReadWriteMany volume when multiple replicas need shared files. That design choice shows up often in enterprise application development projects where uptime and data durability matter.

How does the CSI driver architecture work in Kubernetes?

A full CSI deployment splits into identity, controller, and node services. Each exposes gRPC endpoints. Sidecar containers bridge those endpoints to Kubernetes APIs.

Core CSI components

  • Identity service — reports driver name and supported capabilities.
  • Controller service — creates, deletes, snapshots, and expands volumes.
  • Node service — stages and publishes volumes on the worker node filesystem.
  • Sidecars — external-provisioner, attacher, resizer, snapshotter, liveness-probe, node-driver-registrar.

When you apply a PersistentVolumeClaim, the external-provisioner watches PVC objects. It reads the StorageClass, calls CreateVolume on the CSI controller, and creates a PersistentVolume object. The attach-resizer sidecar handles volume attachment to the node and online expansion when allowed.

On the node, kubelet calls NodeStageVolume and NodePublishVolume. The block device or NFS export appears under the pod path. From the app view, it is just a directory or mount point.

1. Apply PVC2. Provision3. Create PV4. Schedule Pod5. Attach VolumeController + attacher6. Stage on NodeNode plugin RPC7. Mount in PodPublishVolume pathApplication reads/writes persistent dataSurvives pod restart and rescheduling
Seven-step CSI volume lifecycle from PVC to mounted pod directory

Volume access modes still matter. ReadWriteOnce binds one node at a time — typical for MySQL on a block volume. ReadWriteMany needs a file protocol like NFS, EFS, or Azure Files. Pick the wrong mode and the scheduler will leave your pod pending forever.

For deeper cloud-specific trade-offs, see the companion write-up on EBS CSI vs Azure Disk CSI. It compares latency, cost, and snapshot behaviour on the two largest clouds.

Which CSI drivers should you use for AWS, Azure, and GCP?

Managed Kubernetes often ships a default StorageClass backed by the cloud CSI driver. Self-managed clusters require explicit install. The table below covers the drivers most teams touch in 2026.

PlatformCSI DriverVolume TypeAccess ModesBest For
AWS EKSaws-ebs-csi-driverBlock (gp3, io2)RWOMySQL, PostgreSQL, Redis
AWS EKSaws-efs-csi-driverNFS fileRWXShared uploads, WordPress multi-replica
Azure AKSazuredisk-csi-driverManaged DiskRWOSingle-replica databases
Azure AKSazurefile-csi-driverSMB/NFS fileRWXLegacy apps needing shared storage
GCP GKEpd.csi.storage.gke.ioPersistent DiskRWOGeneral block workloads
On-prem / hybridRook-Ceph, Longhorn, NFS CSIBlock or fileRWO / RWXClusters without hyperscaler disks

Block CSI drivers excel at database latency. File CSI drivers excel at shared content. On a WooCommerce or multi-pod Laravel queue setup, shared file storage avoids sync headaches — a pattern I have applied on eCommerce platforms with persistent media directories.

Managed offerings simplify ops. EKS and AKS can enable the CSI driver as an add-on. GKE uses CSI by default for new clusters. Self-hosted k3s or kubeadm clusters need Helm or manifest installs plus IAM or cloud credentials on the node.

Block CSI vs File CSI — Decision GuideBlock CSIEBS, Azure Disk, Ceph RBDRWO — one node writerDatabases, cachesFile CSIEFS, Azure Files, NFSRWX — many pod readersShared uploads, CMS assetsCommon mistakeUsing RWO block volume for 3+ web replicasOnly one pod mounts — others stay Pending
Choose block CSI for single-writer databases; file CSI when multiple pods need the same path

How do you install and configure a CSI driver on a cluster?

Installation varies by cloud, but the pattern repeats. Install driver manifests, create IAM or service principal bindings, define a StorageClass, then test with a PVC. Below is a practical AWS EBS CSI flow on EKS. Adapt the credential step for Azure or GCP.

Install the AWS EBS CSI driver

  1. Enable the EKS add-on or apply the upstream Helm chart.
  2. Attach an IAM policy allowing ec2:CreateVolume, ec2:AttachVolume, and related calls to the controller service account.
  3. Create a StorageClass pointing at ebs.csi.aws.com.
  4. Apply a test PVC and Pod, then confirm the volume attaches.
# Add EKS managed add-on (replace cluster name and role ARN)
aws eks create-addon \
  --cluster-name production-cluster \
  --addon-name aws-ebs-csi-driver \
  --service-account-role-arn arn:aws:iam::123456789012:role/AmazonEKS_EBS_CSI_DriverRole

# StorageClass for gp3 volumes
kubectl apply -f - <<'EOF'
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: gp3-retain
provisioner: ebs.csi.aws.com
parameters:
  type: gp3
  fsType: ext4
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
EOF
# Test PVC + busybox pod
kubectl apply -f - <<'EOF'
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: csi-test-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: gp3-retain
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: csi-test-pod
spec:
  containers:
    - name: app
      image: busybox
      command: ["sh", "-c", "echo ok > /data/test.txt; sleep 3600"]
      volumeMounts:
        - name: data
          mountPath: /data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: csi-test-pvc
EOF

Set volumeBindingMode: WaitForFirstConsumer when volumes must land in the same AZ as the pod. Without it, a PVC in ap-south-1a can bind a disk in ap-south-1b. The pod then stays unschedulable. Nepal-hosted workloads on ap-south-1 (Mumbai) hit this often when teams skip AZ-aware binding.

Helm charts from the Kubernetes CSI project documentation cover Longhorn, NFS, and vendor drivers with the same sidecar bundle. Pin chart versions in Git like any other infra artefact. Treat driver upgrades like a server provisioning change — test in staging first.

Observability hooks matter too. CSI sidecars expose metrics compatible with Prometheus. Wire alerts before production cutover, similar to patterns in Alertmanager-based cluster alerting.

What are common CSI driver problems and how do you fix them?

CSI failures usually show up as Pending PVCs, FailedAttachVolume events, or mount errors in kubelet logs. The fixes are repetitive once you know the signatures.

Diagnosis checklist

  • PVC Pending forever — no default StorageClass, wrong provisioner name, or missing CSI controller pods.
  • FailedAttachVolume — volume stuck on old node after crash; force detach in cloud console or use volumeAttachment cleanup.
  • Permission denied on mount — SELinux context, wrong fsType, or node plugin not registered with kubelet.
  • Multi-AZ scheduling failure — block volume and pod in different availability zones.
  • Snapshot restore fails — snapshot class not installed or driver lacks snapshot capability.
# Quick triage commands
kubectl get storageclass
kubectl get pvc -A | grep Pending
kubectl get pods -n kube-system | grep csi
kubectl describe pvc csi-test-pvc
kubectl get volumeattachment
kubectl logs -n kube-system -l app=ebs-csi-controller -c csi-provisioner --tail=50

I've seen Laravel apps "lose" user uploads after deploy because developers used emptyDir instead of a PVC. The pod recycled and the directory vanished. The fix was a ReadWriteMany file CSI mount for storage/app/public plus an S3 offload for large media — cheaper and more durable than oversized NFS for every file.

CSI Troubleshooting Decision TreePVC stuck Pending?Check StorageClassprovisioner exists?CSI controller up?kube-system podsCloud IAM OK?CreateVolume deniedPod Pending?AZ mismatch — check bindingMount error?Node plugin + fsType
CSI driver troubleshooting: start at PVC status, then controller health, IAM, and node mount logs

Reclaim policies deserve attention. Delete removes the cloud disk when the PVC goes away — fine for cache tiers. Retain keeps the disk for manual recovery — safer for production databases. Document which StorageClasses use which policy so junior ops do not wipe data during a namespace cleanup.

CSI snapshots enable backup automation. Define a VolumeSnapshotClass, schedule snapshots with Velero or your backup tool, and test restore quarterly. A snapshot you have never restored is wishful thinking, not a backup strategy. Pair this with ongoing support and maintenance if your team lacks dedicated SRE capacity.

Multi-cloud teams should read active-active vs active-passive multi-cloud before assuming one CSI driver config ports everywhere. Block volumes do not migrate across clouds; snapshots and object storage do.

For YAML and manifest debugging, a JSON and YAML formatter saves time when comparing Helm output against applied cluster state.

Logging drivers solve a different problem — container stdout — but the ops mindset matches. See Docker logging drivers for the parallel plugin model on single hosts before you scale to Kubernetes.

Modern platforms also treat storage metrics as part of AIOps-driven infrastructure monitoring. Watch attach latency and provisioning error rates, not just CPU.

Key Takeaways

  • CSI drivers replace in-tree Kubernetes volume code with out-of-tree gRPC plugins for every major cloud and many on-prem backends.
  • Match volume type to access mode: block + RWO for databases, file + RWX for shared application directories.
  • Install the controller and node plugin, bind cloud IAM, define StorageClasses, then validate with a test PVC before production.
  • Use WaitForFirstConsumer binding on block volumes to avoid cross-AZ attach failures.
  • Monitor CSI sidecar logs and VolumeAttachment objects when PVCs or pods stay Pending.
  • Set reclaimPolicy deliberately — Delete for disposable data, Retain for production databases you cannot afford to lose.

People Also Ask

What is the difference between in-tree and CSI storage in Kubernetes?

In-tree drivers compiled storage logic into Kubernetes itself. CSI drivers run as separate pods with a standard API. CSI is the only supported path for new features like volume expansion and snapshots on most platforms. In-tree AWS, GCE, and Azure code is deprecated or removed in current releases.

Do I need to install a CSI driver on managed Kubernetes?

Most managed clusters include a default block CSI driver. You still configure StorageClasses, sizes, and reclaim policies. File storage (EFS, Azure Files) and snapshot classes usually need a separate install or add-on enable step.

Can one PVC be mounted by multiple pods at once?

Only with ReadWriteMany and a file-based CSI driver such as NFS or EFS. Block CSI volumes with ReadWriteOnce allow a single node writer. Attempting multiple mounts on RWO causes scheduling or attach errors.

How do CSI drivers relate to StatefulSets?

StatefulSets use volumeClaimTemplates to create one PVC per replica. Each PVC binds through the StorageClass to a CSI-provisioned disk. Pod identity stays stable, so ordered startup and persistent data work together for databases and queues.

Plan persistent storage before your next deploy

CSI Drivers Explained is not academic trivia. It is the layer that keeps databases, uploads, and queue data alive when pods move, scale, or crash. Pick the right driver, bind credentials correctly, and test restore paths before you need them. If you are standing up stateful workloads on Kubernetes for a Laravel app, WordPress stack, or custom platform, map storage in the architecture phase — not after the first data loss.

I help teams design deploy pipelines, storage classes, and production clusters alongside application code — the same full-stack scope behind sites like Notary Kathmandu on shared Deployer and CI infrastructure. For greenfield platforms, see custom software development. For performance and reliability audits on live clusters, testing and optimization covers the operational side.

Need hands-on help choosing CSI drivers, StorageClasses, or a migration off ephemeral storage? Contact us with your cluster platform and workload type — block database, shared files, or hybrid — and we can outline a concrete storage plan.

Frequently Asked Questions

A CSI driver is an out-of-tree plugin that connects Kubernetes to external storage such as EBS, Azure Disk, NFS, or Ceph through a standard gRPC API. It replaces deprecated in-tree volume code, provisions volumes dynamically via StorageClasses, and mounts them into pods through kubelet.

Before CSI, cloud volume logic for AWS EBS, GCE PD, and Azure Disk lived inside the Kubernetes core tree, which slowed releases and made third-party storage awkward. CSI splits storage into vendor-maintained plugins that register with kubelet and sidecars. Vendors ship fixes without waiting for a Kubernetes minor release, the same pattern works across AWS, Azure, on-prem Ceph, and NFS, and deprecated in-tree drivers including GCE PD, OpenStack Cinder, and vSphere have been removed in favour of CSI equivalents.

A full CSI deployment splits into three gRPC services plus sidecar containers. The identity service reports the driver name and capabilities. The controller service creates, deletes, snapshots, and expands volumes. The node service stages and publishes volumes on the worker filesystem. Sidecars including external-provisioner, attacher, resizer, snapshotter, liveness-probe, and node-driver-registrar bridge those endpoints to Kubernetes APIs so a PVC triggers CreateVolume, PV creation, attachment, and finally NodeStageVolume and NodePublishVolume on the pod node.

For single-replica databases such as MySQL, PostgreSQL, or Redis, use aws-ebs-csi-driver with gp3 or io2 block volumes in ReadWriteOnce mode. For shared uploads, WordPress multi-replica setups, or any workload where multiple pods need the same path, use aws-efs-csi-driver with NFS file storage in ReadWriteMany mode. Block CSI excels at database latency; file CSI excels at shared content directories that would otherwise require sync across replicas.

Azure AKS offers azuredisk-csi-driver for Managed Disk block storage with ReadWriteOnce, which suits single-replica databases. For legacy applications or workloads needing shared storage across pods, azurefile-csi-driver provides SMB or NFS file volumes with ReadWriteMany. Match the driver to access mode: block plus RWO for one writer at a time, file plus RWX when several pods must read and write the same mount path simultaneously.

ReadWriteOnce binds a volume to one node at a time and suits block CSI drivers for databases. ReadWriteMany allows multiple pods on different nodes to mount the same volume and requires a file protocol such as NFS, EFS, or Azure Files.

Enable the EKS managed add-on or apply the upstream Helm chart, then attach an IAM policy allowing ec2:CreateVolume, ec2:AttachVolume, and related calls to the controller service account. Create a StorageClass pointing at ebs.csi.aws.com with parameters such as type gp3, fsType ext4, reclaimPolicy Retain, volumeBindingMode WaitForFirstConsumer, and allowVolumeExpansion true. Validate with a test PVC and busybox pod before production cutover. Pin Helm chart versions in Git and test driver upgrades in staging first.

WaitForFirstConsumer delays PVC binding until Kubernetes schedules the pod, so the provisioned block volume lands in the same availability zone as the worker node. Without it, a PVC in one AZ can bind a disk in another, leaving the pod unschedulable with attach errors. Teams running workloads in ap-south-1 Mumbai hit this often when they skip AZ-aware binding. Set it on block StorageClasses where cross-AZ attachment is impossible or causes FailedAttachVolume events.

Most managed clusters ship a default block CSI driver, but you still configure StorageClasses, sizes, and reclaim policies yourself. File storage such as EFS or Azure Files and snapshot classes usually require a separate install or add-on enable step.

Only with ReadWriteMany access mode and a file-based CSI driver such as NFS, EFS, or Azure Files. Block CSI volumes with ReadWriteOnce allow a single node writer, and attempting multiple mounts causes scheduling or attach errors.

Start triage with kubectl get storageclass, kubectl get pvc, and kubectl describe pvc. Common causes include no default StorageClass defined, a wrong provisioner name in the StorageClass, missing or unhealthy CSI controller pods in kube-system, or a volumeBindingMode mismatch where the volume provisioned in a different AZ than the scheduled pod. Check CSI sidecar logs on the controller deployment and confirm IAM or cloud credentials allow the driver to call CreateVolume successfully.

FailedAttachVolume usually means the cloud disk is still attached to a node that crashed or was terminated before a clean detach. Force detach the volume in the cloud console or clean up stale VolumeAttachment objects with kubectl get volumeattachment. Multi-AZ scheduling failures produce a similar symptom when a block volume and pod sit in different availability zones; fix the StorageClass binding mode or reschedule the pod. SELinux context issues, wrong fsType, or an unregistered node plugin can also block mount even after attach succeeds.

StatefulSets use volumeClaimTemplates to create one PVC per replica automatically. Each PVC binds through the StorageClass to a CSI-provisioned disk, giving every pod stable storage identity alongside stable network identity. Ordered startup and persistent data work together for databases, Redis instances, and queue backends. Plan access mode and driver type before deploying: block RWO for independent replica data, file RWX only when replicas genuinely share one directory.

Delete removes the underlying cloud disk when the PVC is deleted, which is acceptable for cache tiers and disposable test volumes. Retain keeps the disk in the cloud account for manual recovery after PVC deletion, which is safer for production databases you cannot afford to lose. Document which StorageClasses use which policy so namespace cleanup during routine ops does not wipe data a junior operator assumed was protected.

Define a VolumeSnapshotClass for your driver, then schedule snapshots with Velero or your backup tool. The CSI controller snapshot capability creates point-in-time copies you can restore into new PVCs. Test restore quarterly because a snapshot you have never restored is wishful thinking, not a backup strategy. Snapshot restore failures often trace to a missing snapshot class, a driver without snapshot support enabled, or restore tooling that targets the wrong StorageClass provisioner name.

Share this article

0 Comments

Leave a comment

Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

Quick Contact Options
Choose how you want to connect me: