A VolumeSnapshot is a point-in-time snapshot of the contents of a Kubernetes volume, usually a volume used through a PersistentVolumeClaim. You can think of it as a photo of the data at a specific moment, created through the underlying storage provider.
We explain how to create a VolumeSnapshot in our guide ‘Using VolumeSnapshots in Kubernetes’.
When do you use VolumeSnapshots?
VolumeSnapshots are especially useful when you want to quickly return to an earlier state of a volume. Some common use cases are:
- Before an application upgrade: create a snapshot before updating a database, CMS, or other stateful application.
- Before risky database actions: create a snapshot before running migrations, imports, or bulk deletes.
- After an incorrect change: restore a new PVC from the snapshot and then connect your workload to the restored data.
- For a test environment: create a temporary test volume with data from a snapshot, without changing the production volume itself.
Do not use VolumeSnapshots as the only backup for important production environments. A snapshot is stored within the same storage environment. For disaster recovery, an external backup or application-specific export remains important.
Is a VolumeSnapshot the same as a backup?
Not entirely. A VolumeSnapshot is a snapshot at storage level. This means the exact behavior depends on the storage provider and CSI driver used. A backup strategy usually includes more than snapshots alone, such as retention policies, offsite storage, restore tests, encryption, and monitoring. In short: a VolumeSnapshot can be part of your backup strategy, but it is not automatically a complete backup solution.
Which Kubernetes resources are used for VolumeSnapshots?
With VolumeSnapshots, you usually come across three resources:
- VolumeSnapshot: The request from a user (through a .yaml file) to create a snapshot of a volume. Conceptually, it is similar to a PersistentVolumeClaim.
- VolumeSnapshotContent: The actual snapshot in the cluster, similar to how a PersistentVolume represents the actual storage.
- VolumeSnapshotClass: Determines how snapshots are created, for example which CSI driver is used and what should happen when the snapshot is deleted.
Can I create VolumeSnapshots of multiple volumes at the same time?
For regular VolumeSnapshots, you create snapshots per volume. For applications with multiple volumes, a separate snapshot per volume may be insufficient if you need write-order consistency. For advanced use cases, Kubernetes refers to Volume Group Snapshots.