What Is CSI? How Kubernetes Connects a PVC to Storage and Troubleshoots Failures
The Container Storage Interface (CSI) is a standard contract that lets an orchestrator such as Kubernetes use different storage systems through drivers. CSI does not provide disks or storage itself: a vendor's CSI driver performs storage operations, while Kubernetes controllers and driver components coordinate them. This guide follows a typical Kubernetes block-storage flow; the exact steps and capabilities depend on the driver.
What CSI standardizes
An application requests storage with a PersistentVolumeClaim (PVC), specifying needs such as capacity and access mode. A StorageClass selects a provisioner and its configuration. CSI defines calls for operations such as creating and deleting volumes, connecting them to nodes, preparing them on a node, and publishing them to a Pod. The storage product and driver determine performance, replication, encryption, recovery, and cost; CSI compatibility does not make those properties identical.
How a PVC reaches a Pod
This is a representative dynamic-provisioning flow. ControllerPublish (node attachment) and NodeStage (node-side preparation) occur only when the driver implements and needs those capabilities; not every driver follows every step.
| Stage | Responsibility | Useful Kubernetes signal |
|---|---|---|
| 1. Request | Pod references a PVC; claim states capacity, access mode, and optional StorageClass | PVC status and Events |
| 2. Provision | StorageClass provisioner and external-provisioner sidecar coordinate the driver's CreateVolume call | StorageClass, provisioner logs, new PV |
| 3. Bind | Control plane matches the claim with a suitable PersistentVolume (PV) | PVC and PV status Bound |
| 4. Attach, if supported | Controller requests ControllerPublishVolume for the scheduled node | Pod node, VolumeAttachment, attacher logs |
| 5. Prepare, if supported | Node plugin may call NodeStageVolume to prepare the device or filesystem | CSI node plugin and driver logs on that node |
| 6. Publish to Pod | Kubelet asks the node plugin to call NodePublishVolume and expose the volume at the Pod's mount path | Pod Events, node plugin logs, container mount path |
A PVC is a request; a PV represents the provisioned volume, and a StorageClass selects the provisioner and parameters. With WaitForFirstConsumer, provisioning can wait until a Pod's placement constraints are known. This helps avoid creating a zone-bound disk in an unusable location, but a claim can remain Pending until a consuming Pod exists. See Kubernetes StorageClasses.
Drivers and sidecars have different jobs
CSI defines Identity, Controller, and Node services. Identity reports the driver name and capabilities. Where implemented, Controller handles cluster-level work such as provisioning or attachment; Node prepares and publishes a volume on a node. Controller service and individual capabilities can be optional, so do not assume every volume requires an attach operation.
CSI sidecars are not the storage driver itself. external-provisioner watches Kubernetes objects and coordinates provisioning calls; external-attacher coordinates the VolumeAttachment flow when supported; node-driver-registrar helps register the node plugin with kubelet. These optional standard containers isolate common Kubernetes API logic from the driver. Use the driver's deployment guide to determine which are needed. CSI sidecar documentation
CSI and CNI handle different resources
Both are plugin interfaces, but CNI configures Pod networking while CSI manages storage-volume lifecycle and mounts. An event such as FailedCreatePodSandBox usually points first to network setup; FailedMount or a PVC stuck in Pending points first to storage provisioning or mounting. Multiple symptoms can share a cause, so use events rather than deciding from an acronym alone.
Diagnose a Pending claim or failed mount
Start with read-only inspection; do not force-delete resources or change data while the failing stage is unknown. Command visibility depends on RBAC and cluster setup.
Run `kubectl describe pvc <claim> -n <namespace>` and `kubectl get pvc,pv -n <namespace>`. For `Pending`, check the StorageClass name, provisioner installation, requested capacity/access mode, provider constraints, and whether a default class exists if none was named.
If the class uses `WaitForFirstConsumer`, check that a Pod references the claim and inspect scheduler Events and node/zone constraints before treating the pending claim as a fault.
If PVC and PV are `Bound` but the Pod does not start, inspect `kubectl describe pod <pod> -n <namespace>` and separate attachment from mount errors. For attachment, check driver capability, target node, topology, VolumeAttachment, and controller sidecar. For mount errors, inspect the CSI node plugin on the scheduled node and check filesystem type, mount options, and permissions against driver documentation.
Compare the Pod's node with CSI plugin Pods using `kubectl get pods -A -o wide`. Failures across nodes suggest checking controller/provisioner or the storage backend; a failure on one node suggests its CSI DaemonSet Pod and kubelet Events. Names and log locations vary by installation; identify the relevant containers before reading logs.
If deletion stalls, inspect protection finalizers, Pods still referencing the claim, VolumeAttachment, and driver cleanup logs. Removing finalizers or force-deleting a PV/PVC can orphan a cloud volume or desynchronize data. Follow the provider's recovery and retention procedure.
For example, if a PVC is Pending with an Event saying its StorageClass was not found, investigating file permissions inside the container is premature. If the PVC/PV are Bound and mount failures recur on one node, inspect that node's plugin and filesystem requirements first. This is an illustrative scenario, not a reported cluster test. See Kubernetes volumes and CSI troubleshooting.
What to check before adopting or upgrading CSI
Check the driver's compatibility matrix for your Kubernetes version, supported features, and compatible sidecar versions. CSI conformance alone does not guarantee that every feature is available in your cluster. Review the provisioner name, topology constraints, prerequisites for expansion/snapshots, reclaim policy, and credential permissions. Features such as snapshots and expansion can require additional Kubernetes components or API support.
Before production use, verify claim creation, Pod mounting, rescheduling or node replacement, any features you plan to use, and backend cleanup after deletion in a non-production environment. During upgrades, follow the driver's compatibility and rollback procedures and verify data retention. Deleting a Kubernetes object does not by itself prove whether backend data was deleted or retained; reclaim policy matters.
Sources
[Kubernetes volumes](https://kubernetes.io/docs/concepts/storage/volumes/)
[PersistentVolumes and PersistentVolumeClaims](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)
[StorageClasses](https://kubernetes.io/docs/concepts/storage/storage-classes/)
[Container Storage Interface specification](https://github.com/container-storage-interface/spec/blob/master/spec.md)
[Kubernetes CSI sidecars](https://kubernetes-csi.github.io/docs/sidecar-containers.html)
[Kubernetes CSI troubleshooting](https://kubernetes-csi.github.io/docs/troubleshooting.html)