100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Kubernetes

Volume Snapshots

Learn how the Kubernetes VolumeSnapshot API enables point-in-time backups and cloning of PersistentVolumes via the CSI snapshot controller.

StorageAdvanced8 min readJul 10, 2026
Analogies

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.

yaml
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: 20Gi

Not 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

Was this page helpful?

Topics covered

#Kubernetes#AdvancedKubernetesStudyNotes#DevOps#VolumeSnapshots#Volume#Snapshots#VolumeSnapshot#API#StudyNotes#SkillVeris