The VolumeSnapshot API
Kubernetes exposes point-in-time volume backups through three cooperating objects in the snapshot.storage.k8s.io API group: a VolumeSnapshotClass (analogous to StorageClass, naming a snapshotting driver and deletion policy), a VolumeSnapshot (a namespaced request to snapshot a specific PVC), and a VolumeSnapshotContent (the cluster-scoped object representing the actual snapshot resource on the backend, created automatically for dynamic snapshots just like a PV is for a PVC). This mirrors the PV/PVC/StorageClass pattern deliberately, so anyone familiar with dynamic volume provisioning can immediately understand dynamic snapshot provisioning.
Cricket analogy: A VolumeSnapshot is like calling for an instant replay freeze-frame of the exact match state at a given ball, while the VolumeSnapshotContent is the actual broadcast recording stored by the network that the freeze-frame request points to.
Restoring From a Snapshot
A snapshot by itself is not directly mountable; to use it, you create a new PVC whose spec.dataSource references the VolumeSnapshot's name and kind, which tells the CSI provisioner to create a brand-new volume pre-populated with the snapshot's data rather than an empty one. This pattern is invaluable for cloning a production database's exact state into a staging environment, rapidly rolling back a corrupted volume, or spinning up many parallel copies of a golden dataset for testing, all without touching the original live volume.
Cricket analogy: It's like taking last season's exact squad roster (snapshot) and using it to field a completely new practice team without touching the current playing eleven.
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: csi-ebs-snapclass
driver: ebs.csi.aws.com
deletionPolicy: Retain
---
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: postgres-snap-2026-07-10
namespace: production
spec:
volumeSnapshotClassName: csi-ebs-snapclass
source:
persistentVolumeClaimName: postgres-data-claim
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-data-restore
namespace: staging
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: fast-ssd
dataSource:
name: postgres-snap-2026-07-10
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
resources:
requests:
storage: 20GiNot every CSI driver supports the VolumeSnapshot API, and even among those that do, snapshot consistency for a live database usually requires the application to be quiesced or use a filesystem-consistent freeze (e.g., via a pre-hook) — a crash-consistent snapshot of a running database is not automatically the same as a transactionally consistent one.
- VolumeSnapshotClass, VolumeSnapshot, and VolumeSnapshotContent mirror the StorageClass/PVC/PV pattern for backups.
- A VolumeSnapshot is a namespaced request; VolumeSnapshotContent is the cluster-scoped actual backend resource.
- Restoring requires creating a new PVC with dataSource pointing at the VolumeSnapshot.
- Snapshots enable fast cloning, rollback, and golden-dataset replication without touching the source volume.
- deletionPolicy on VolumeSnapshotClass controls whether the backend snapshot survives VolumeSnapshot deletion.
- Not all CSI drivers support snapshots, and consistency guarantees depend on application-level cooperation.
Practice what you learned
1. What object represents the actual backend snapshot resource in the VolumeSnapshot API, analogous to a PV?
2. How do you restore data from a VolumeSnapshot into a usable volume?
3. What does the deletionPolicy field on a VolumeSnapshotClass control?
4. Why might a crash-consistent snapshot of a running database be insufficient for some use cases?
Was this page helpful?
You May Also Like
Persistent Volumes and Claims
Learn how Kubernetes decouples storage provisioning from storage consumption using PersistentVolume and PersistentVolumeClaim objects.
Storage Classes
Understand how StorageClass objects define provisioners, parameters, and policies that govern how storage is dynamically created in Kubernetes.
Dynamic Provisioning
See how Kubernetes automatically creates storage volumes on demand via CSI provisioners instead of requiring admins to pre-create PVs.
Stateful Application Patterns
Explore how StatefulSets, headless Services, and volumeClaimTemplates combine to run databases and other stateful workloads reliably on Kubernetes.