CSI components and snapshots
Separate the storage API from the storage implementation
Container Storage Interface (CSI) defines an interface between orchestrators and storage plugins. Kubernetes uses storage API objects to express requests and observe state; a CSI driver communicates with the actual storage system. A StorageClass provisioner names a driver, not a storage device. The driver may implement controller services for volume creation, attachment or expansion and node services for preparing and publishing volumes to workloads. Exact capabilities differ by driver; not every driver needs attachment or supports snapshots. A bound PVC is only evidence that a claim has a volume, not that an application can read it.
Follow a volume from request to mount
For a dynamic volume, a PVC and StorageClass initiate provisioning through a compatible external provisioner, which calls the driver to create storage. With WaitForFirstConsumer, placement and storage topology must be coordinated first. For an attach-required driver, the attach/detach controller expresses attachment intent through a VolumeAttachment; the external attacher works with the driver and reports success or errors. On the selected node, kubelet interacts with the registered node plugin: NodeStageVolume may prepare a shared staging path if supported, then NodePublishVolume exposes the volume at the target. An external resizer coordinates supported controller-side expansion; node expansion may also be needed. These are responsibilities, not a universal synchronous sequence. For attach-free drivers, skip the attachment step; not all drivers implement staging.
Know which object answers which diagnostic question
CSIDriver is cluster-scoped and describes driver integration options, including attachRequired, supported lifecycle modes and storage capacity tracking. CSINode is cluster-scoped and records drivers registered on a node, along with node identifiers and relevant topology/allocatable details. CSIStorageCapacity is namespaced and can report available capacity by StorageClass and topology. Its data is a scheduling hint for applicable delayed provisioning, not a reservation. VolumeAttachment is cluster-scoped and records attachment intent and status. A false attached status plus an attachError points to the attachment stage. If attached is true but the Pod has FailedMount events, examine node plugin registration, node-side mount errors and filesystem ownership/permissions rather than deleting the PVC. An application permission error after a successful mount is a different stage. Use approved read-only diagnostics in a known lab context; never forcibly detach a disk that might have an active writer.
Create a snapshot request, not a backup guarantee
VolumeSnapshot is a namespaced request for a point-in-time storage snapshot. VolumeSnapshotContent is the cluster-scoped representation of the underlying snapshot and its binding; VolumeSnapshotClass selects driver and deletion policy. These are snapshot.storage.k8s.io/v1 custom resources, not built-in core APIs. The distribution or operator must install compatible CRDs, snapshot controller and required supporting components; the driver needs snapshot support and its snapshotter sidecar. The snapshot controller coordinates binding, while the CSI snapshotter calls the driver. This static example requests a snapshot of catalog-data in storage-study, using the fictional class study-snapshot. The request being accepted is not proof of completion. Inspect status.readyToUse, restoreSize, binding and errors. A storage-level snapshot may be crash-consistent rather than application-consistent; coordinate database quiescing or native backup mechanisms when required.
apiVersion: snapshot.storage.k8s.io/v1kind: VolumeSnapshotmetadata: name: catalog-checkpoint namespace: storage-studyspec: volumeSnapshotClassName: study-snapshot source: persistentVolumeClaimName: catalog-dataRestore to a new claim and verify recovery
A restore uses a new PVC whose dataSource points to a ready snapshot in the same namespace for this ordinary workflow. The new StorageClass and driver must support restoration; requested capacity must meet the snapshot restore size and driver/backend requirements. Match the volume mode unless an explicitly supported change is authorized. This sample assumes restoreSize is 5Gi, uses the same fictional driver, and requests a new claim rather than overwriting catalog-data. A successful restore still requires binding, mounting, reading the expected data and checking application consistency. Snapshot deletion policy is distinct from PV reclaim policy: Retain can leave snapshot content and backend data requiring administrator management, while Delete normally requests deletion when the bound snapshot is removed. Review actual content policy, access, encryption, retention and cost before cleanup. Snapshots can share a failure domain with the original storage; they are not automatically independent or offsite backups.
apiVersion: v1kind: PersistentVolumeClaimmetadata: name: catalog-restored namespace: storage-studyspec: storageClassName: study-zonal accessModes: [ReadWriteOnce] volumeMode: Filesystem resources: requests: {storage: 5Gi} dataSource: apiGroup: snapshot.storage.k8s.io kind: VolumeSnapshot name: catalog-checkpointDiagnose by stage, then test the recovery plan
Work through csi-cases.json and restore-cases.json in lab-fixtures/volume-csi. First check whether the claim is bound, the node driver is registered, an attachment is required and successful, and the node mount completed. Then check access and application health. In the restore model, readiness, driver match, capacity and mode are necessary checks but not sufficient proof that the backend can restore. For a real isolated lab, pin a supported driver and snapshot components, use synthetic data, write a marker, coordinate writes, request a snapshot, wait for readiness, restore into a new claim, compare data and verify the application. Record both claim identities and clean up only approved resources after reviewing retention. This package tests offline reasoning only. Next: Kubernetes networking model and CNI.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
CSI components and snapshots — knowledge check
Reason about Kubernetes storage using synthetic scenarios.
Which object reports the CSI drivers registered on a particular node?
A bound PVC has an attach-required driver and VolumeAttachment reports attached=false with an error. Which stage needs investigation first?
Which statement about VolumeSnapshot is correct?
A ready snapshot reports restoreSize 5Gi. Which new claim request meets this size check?
What evidence best demonstrates successful application recovery?