Volume Snapshots with CSI
What you'll learn: How to create point-in-time backups of your Kubernetes persistent volumes using CSI snapshot resources.
What Are Volume Snapshots?
Volume snapshots are like taking a photograph of your storage at a specific moment. Just as a photo captures a scene exactly as it appeared, a volume snapshot captures the entire state of your persistent volume at that instant. You can later restore from that snapshot or create new volumes based on it—perfect for backups, cloning environments, or recovering from mistakes.
The Three Key Resources
CSI introduces three Kubernetes resources to manage snapshots:
VolumeSnapshotClass defines how snapshots are created—similar to how StorageClass defines how volumes are provisioned. It specifies the CSI driver to use and any driver-specific parameters (like snapshot retention policies or encryption settings).
VolumeSnapshot is your actual snapshot request. You create this resource pointing to an existing PVC, and Kubernetes triggers the CSI driver to take the snapshot. Think of it as saying "take a picture of this volume right now."
VolumeSnapshotContent represents the actual snapshot stored in your underlying storage system. It's automatically created when a VolumeSnapshot succeeds—the binding between your snapshot request and the real snapshot data, much like how PV binds to PVC.
The Snapshot Workflow
When you create a VolumeSnapshot, the CSI driver communicates with your storage backend (AWS EBS, Azure Disk, etc.) to create the actual snapshot. Once complete, you can restore data by creating a new PVC that references the VolumeSnapshot as its data source.
Key Takeaway: Volume snapshots provide point-in-time backups of persistent volumes through three resources: VolumeSnapshotClass (defines how), VolumeSnapshot (the request), and VolumeSnapshotContent (the actual snapshot data).