Kubernetes Volume Snapshots: A Save Point for Data

A Volume Snapshot is a point-in-time copy of your persistent data in Kubernetes, like a game save. Use it to back up a database before an upgrade or clone a prod environment. The footgun: it's not a true backup; a storage failure can lose both.
WHY IT EXISTS: Kubernetes needed a standard, API-driven way to manage the lifecycle of data for stateful applications. Before Volume Snapshots, backing up or cloning a volume was a manual, storage-provider-specific process done outside of Kubernetes, breaking the declarative model.
THE MENTAL MODEL: A Volume Snapshot is a "save point" for a PersistentVolume. It captures the state of the data at a specific moment. You can't modify the snapshot itself, but you can use it as a template to create new volumes that start with that exact data, much like restoring a game from a saved file.
HOW IT WORKS: The process is managed through the Kubernetes API but executed by the storage system. You create a VolumeSnapshot object referencing a PersistentVolumeClaim. Kubernetes then instructs the corresponding Container Storage Interface (CSI) driver to command the underlying storage backend (like AWS EBS or GCE PD) to create the snapshot. To restore, you create a new PersistentVolumeClaim and set its dataSource to point to your VolumeSnapshot, which provisions a new volume pre-populated with the snapshot data.
WHEN TO USE IT: Use snapshots for data protection and cloning workflows. For example, before upgrading a critical database, you can take a snapshot as a quick rollback point. It's also perfect for creating a copy of your production database for a staging or development environment without impacting the live system.
WHEN NOT TO USE IT: Do not treat a snapshot as a complete, disaster-proof backup. Snapshots often reside in the same storage system, or even the same availability zone, as the source volume. A regional outage or system-wide failure could destroy both. Also, for applications like databases, taking a snapshot without quiescing the application first can lead to a corrupt or inconsistent state upon restore. This application-level consistency is your responsibility to manage.
ONE CANONICAL EXAMPLE: A team is upgrading their PostgreSQL database from version 12 to 13. Before starting the upgrade process, they create a VolumeSnapshot of the PVC containing the database files. The upgrade proceeds. If it fails catastrophically, they can delete the failed PVC and quickly provision a new one from the snapshot, effectively rolling back the database state to the pre-upgrade point in minutes.
Read the original → kubernetes.io
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.