Kubernetes CSI volume snapshots and restores

Set up VolumeSnapshot support in a self-managed Kubernetes cluster with the snapshot controller, per-driver VolumeSnapshotClasses and tested PVC restores, alongside Velero backups.

On this page

How Kubernetes CSI volume snapshots and restores work for stateful workloads

Stateful workloads need point-in-time copies of their PersistentVolumeClaims before upgrades, schema changes or risky data operations, and a snapshot only helps if every layer beneath it is in place. A VolumeSnapshot object is not a self-contained feature. It depends on three things working together: a CSI driver that implements the snapshot capability, the external snapshot controller that watches VolumeSnapshot objects and coordinates with the driver, and the VolumeSnapshot CRDs (VolumeSnapshot, VolumeSnapshotContent and VolumeSnapshotClass) that the API server must recognize before anything can be created. If the driver lacks snapshot support, or the controller and CRDs were never installed, the objects will either be rejected or sit unbound, and teams often discover this only during an incident. Confirm the driver's snapshot support in its own documentation before you design around it, and confirm which CRD and controller versions the driver expects, since those pairings are version-specific.

Snapshots are a volume-level capability and are distinct from application backups. A snapshot captures the block or file state of a volume at one moment, which is fast and useful for rollback and cloning, but it knows nothing about database transactions, in-flight writes or the application's logical consistency. Application-consistent snapshots need the workload to quiesce or flush first, typically through a pre-snapshot hook or the database's own backup mode, and that coordination is design work for the platform and application teams together. Snapshots also usually live in the same storage system as the volumes they protect, so they do not by themselves protect against loss of that system. Velero and similar tools combine snapshot calls with copies to object storage, which is where the two approaches meet. Decide early which recovery points need a local snapshot, which need an off-cluster copy, and who owns each restore procedure.

Which VolumeSnapshotClass settings fit which storage backend

On-premises block storage from Longhorn or OpenEBS is the most common case for self-managed clusters without an array. Both are CSI drivers that can provide snapshots, but the driver name and snapshot behavior are specific to each project and each release, so the driver field in the VolumeSnapshotClass must match the name the installed CSI driver registers. Confirm the snapshot capability and supported version for your release in the project documentation before you build the class.

  • Driver name: Copy the provisioner name from the installed CSI driver, such as the name shown in the CSIDriver object, rather than from memory or an older guide.
  • Snapshot support: Check whether your chosen data engine and release support snapshots for every volume type your teams will use.
  • deletionPolicy: Use Retain for snapshots that act as recovery points you must keep after a VolumeSnapshot object is deleted, and Delete where snapshot content should follow the object lifecycle.
  • Backup relationship: Local snapshots on the same disks do not protect against node or disk loss, so pair them with an off-cluster backup target.
  • Restore testing: Restore a PVC from a snapshot in a test namespace before relying on the class.

Confirm each value against your Longhorn or OpenEBS release notes before applying the class.

Snapshot configuration options and when each fits

This table compares the main configuration choices for VolumeSnapshot support: deletion policy, default versus labeled snapshot classes, where the snapshot controller runs, and who owns snapshot schedules. Read each row against your recovery goals and your team's operating model, since most choices trade cleanup behavior and retained storage cost against how easily workloads and teams can take snapshots. Confirm each driver's behavior in its own documentation before you standardize on a setting.

OptionBehavior and trade-offCost and cleanup effectWho can create snapshots and when it fits
deletionPolicy: DeleteDeleting a VolumeSnapshot also removes the snapshot on the storage backend. Recovery depends on the snapshot still existing.Lowest retained storage cost. Removing a VolumeSnapshot object frees backend capacity automatically.Fits short-lived or developer-facing snapshots where the snapshot is not the only recovery copy.
deletionPolicy: RetainDeleting the Kubernetes object leaves the backend snapshot in place, so it can still be recovered or imported.Storage accumulates until someone removes it on the backend. Plan an audit for orphaned snapshots.Fits production data where a snapshot must outlive an accidental object deletion, paired with a documented cleanup owner.
Default VolumeSnapshotClassOne class per driver is marked as default, so snapshots without an explicit class use it.Simple to use, but any team can create snapshots with the default policy and retention without review.Fits small clusters with one driver and one backup tool that owns snapshot creation.
Labeled VolumeSnapshotClassClasses are named for tiers or purposes, such as application-consistent or crash-consistent, and selected explicitly.Requires more classes to maintain, but makes retention and deletion policy visible in each manifest.Fits shared clusters where teams need different policies and snapshot creation must be traceable.
Snapshot controller placementThe snapshot controller and its CRDs are installed once per cluster and watch VolumeSnapshot objects across namespaces.Runs as a cluster component, so its upgrades must follow the CSI driver and Kubernetes version support you confirm.Owned by the platform team. Confirm the chart or manifest version matches the snapshot CRDs installed.
Snapshots owned by VeleroVelero creates and tracks snapshots as part of backup jobs, with its own schedules and retention.Backup retention is set in Velero, so cleanup depends on its configuration and the driver's deletion policy.Fits teams that want one tool for backup schedules, restores and retention across namespaces.
Snapshots owned by the CSI driver or a GitOps jobThe driver's own scheduler or a versioned CronJob or manifest creates VolumeSnapshot objects on a timetable.Retention is defined in the job or driver, so reviewers must check both schedule and deletion behavior.Fits pre-change snapshots or setups where schedules must be reviewed in Git, but restore coordination with Velero needs an explicit plan.
RBAC for snapshot creationUsers need permission to create VolumeSnapshot objects in their namespace, and deletion rights are separate.Unrestricted create rights can fill backend capacity. Restrict and monitor snapshot counts per namespace.Grant create and delete rights only to the role that owns the schedule, and confirm this with your access review.

Setting up the snapshot controller and first restore

This sequence confirms that the storage driver can take snapshots, installs the snapshot CRDs and controller, and proves with a test PVC that a snapshot can be taken and restored with its data intact. Run it in a non-production cluster first.

  1. Confirm the driver supports snapshots

    Before installing anything, check with your storage driver's documentation that it implements the CSI snapshot capability and which snapshot controller version it expects. Confirm the driver's release notes list that version, and confirm the cluster's Kubernetes version is supported by both the driver and the snapshot components. Your storage vendor or driver maintainers should confirm the compatibility matrix for your environment. The check is done when you have a written version pairing for the driver, the snapshot CRDs and the snapshot controller.

  2. Install the snapshot CRDs and controller

    A platform engineer applies the VolumeSnapshot CRDs (VolumeSnapshots, VolumeSnapshotContents and VolumeSnapshotClasses) and the snapshot controller at the version the driver expects, usually from the external-snapshotter project's manifests pinned to a tag. Run the commands against a non-production cluster first, and keep the manifests in Git so the versions are recorded. Verify with kubectl get crd | grep snapshot that the three CRDs exist, and kubectl get pods -n kube-system (or the namespace your manifests use) shows the snapshot controller running.

  3. Create a VolumeSnapshotClass for each driver

    Create one VolumeSnapshotClass per CSI driver that serves PVCs in the cluster, setting the driver field to the exact CSI driver name and choosing a deletionPolicy that fits how the snapshots will be used. Mark a class as default only if one driver should serve most snapshots. Confirm with kubectl get volumesnapshotclass that each class lists the expected driver, and check the driver's documentation for any parameters it requires, such as secret references. The step is complete when each class is listed with the correct driver name.

  4. Create a test PVC with known data

    Create a small test PVC in a dedicated namespace using a StorageClass backed by the driver under test, then start a pod that writes a recognizable file, such as a checksum file, to the volume. Record the checksum and the file list so you can compare them after the restore. Confirm the PVC is Bound with kubectl get pvc and that the pod has written the file. Keep the test data identifiable so it is clear which artifacts belong to the test.

  5. Take a test snapshot and wait for readyToUse

    Create a VolumeSnapshot object that references the test PVC and the VolumeSnapshotClass, optionally with the pod briefly quiesced so the data is stable. Watch the object with kubectl get volumesnapshot -n <namespace> and wait for the READYTOUSE column to show true, which means the snapshot content is available for restore. If it stays false, run kubectl describe volumesnapshot and check the events, the snapshot controller logs and the driver's CSI snapshotter sidecar logs. The step is done when the snapshot reports readyToUse as true and has a bound VolumeSnapshotContent.

  6. Restore the snapshot to a new PVC

    Create a new PVC that uses the snapshot as its data source with spec.dataSource set to the VolumeSnapshot kind and name, and request a size at least as large as the snapshot's restore size. Make sure the new PVC uses the same driver's StorageClass. Check with kubectl get pvc that the new claim becomes Bound, then mount it in a new pod. The step is done when the restored claim is Bound and the pod can read the volume.

  7. Verify the restored data against the original

    Start a verification pod that mounts the restored PVC read-only and recompute the checksum and file list recorded earlier. Compare the output with the values from the original test PVC, and confirm the file ownership and permissions match. Record the results and the versions used in the test, then delete the test resources in the right order so no orphaned volumes remain. The sequence is complete when the checksums match and the record is saved for use in the production runbook.

Application-consistent snapshots: quiescing databases before the copy

A crash-consistent snapshot captures the volume as it stands at one instant, the same state a server would be in after a sudden power loss. Most databases and Kafka brokers can recover from that state, but only if their write-ahead logs and data files were written in an order the storage layer preserved. An application-consistent snapshot goes further: the application is told to flush buffers, finish in-flight transactions and pause writes before the storage layer takes the copy, so the restored data needs no crash recovery. The VolumeSnapshot API itself does not do this. The snapshot controller and the CSI driver copy blocks; they do not know what a database is doing. Quiescing is something you wire in around the snapshot, typically with a pre-snapshot hook that runs a database command, a freeze call from the application, or the vendor's own backup mode, followed by a post-snapshot hook that resumes writes.

Decide per workload which level you need before writing any manifests. Stateless services and many caches can tolerate crash-consistent copies. Relational databases, document stores and Kafka brokers usually need either a quiesce step or a recovery procedure you have tested. For Kafka, the broker data directories, the controller metadata and the partition logs must be captured in a state the brokers can rejoin, and the vendor's guidance on whether to stop brokers, pause producers or rely on log recovery varies by version and deployment, so confirm it with your Kafka distribution and operator documentation. For PostgreSQL, the usual pattern is a checkpoint or backup-mode call before the snapshot and a resume afterward, but the exact commands and their effect on replicas depend on the operator and version you run. Your pre-hook must also handle failure: if it cannot complete, the snapshot should be skipped or marked failed rather than taken anyway.

Treat every snapshot of a running database as unproven until you restore it. Restore into a separate namespace from a VolumeSnapshot, start the database, let it complete crash recovery, and run the application's integrity checks and a sample of reads against known records. Record how long recovery took, since that is the number you will need for recovery planning. Keep in mind that a snapshot lives in the same storage system as the source volume, so it protects against logical errors and some failures but not against loss of that storage, which is why snapshots are usually paired with an off-cluster copy from a tool such as Velero, covered in the next section. Ask your database and Kafka vendors which procedure they support for consistent snapshots, and ask your storage vendor or CSI driver team how the driver handles snapshot quiescing and whether it offers a group snapshot mechanism for volumes that must be captured together.

How a snapshot and restore flow through the cluster

The flow starts with a VolumeSnapshot that references an application PVC and a VolumeSnapshotClass. The snapshot controller creates a VolumeSnapshotContent object, and the CSI controller plugin asks the storage backend for a point-in-time copy. A restore runs the other way: a new PVC points at the snapshot, and the CSI driver provisions a volume from it. Check that the snapshot reports ready before you restore, and confirm with your driver vendor whether the Velero path reads these snapshots or triggers them.

Snapshot creation, restore and the Velero hand-off in one cluster.

How VolumeSnapshots fit with Velero backups

Velero can use CSI snapshot support to capture PVC data alongside the Kubernetes resources that describe an application, so a single backup can include both the objects and the volume contents. The snapshot itself is created through the CSI driver and its VolumeSnapshotClass, which means the data usually stays in the same storage system as the source volume. That placement is fast and useful for recent recovery, but it also means a failure in the array, the storage pool or the cluster can take the snapshot down with the volume. For that reason, the backup copy must land in a separate location such as an object store outside the failure domain of the cluster's storage, and the design should state which copy serves which recovery case.

Before you write a schedule, confirm the current Velero CSI integration with the Velero documentation, including which Velero release supports the CSI snapshot path, which CSI snapshot CRDs and snapshot controller version it expects, and how it selects the VolumeSnapshotClass for each driver. Check whether your driver supports snapshot move or data mover options, since these change where the data is copied and how long a backup takes. Ask your storage vendor or driver maintainers the same questions for your specific driver, because support for snapshots and for retention behavior varies between drivers.

Test the two mechanisms together rather than separately. A restore test should rebuild a namespace from a Velero backup, confirm that PVCs are recreated from the right snapshots or copies, and check that the application starts and reads its data correctly. Run the test against a non-production cluster with a realistic data set, time the restore, and record which steps were manual. Repeat the test after every Kubernetes minor upgrade, driver upgrade or Velero upgrade, since any of those can change how snapshots are created or pruned.

Security and access controls for snapshot data

A VolumeSnapshot is a copy of production data, so it needs the same access thinking as the volume it came from. The cards below cover who may act on snapshot objects, where snapshot data can be seen, how the storage behind it is encrypted, and what sensitive material may be frozen inside it.

RBAC on snapshot resources

Snapshot creation, deletion and restore are separate permissions on the snapshot.storage.k8s.io API group and the PersistentVolumeClaim resource it creates from. Grant create on volumesnapshots only to the roles that run backups, and keep delete with a smaller group, since deleting a snapshot can remove the only recovery point. Check who can create a PVC with a dataSource pointing at a snapshot, because that is how a restore happens and it can expose old data to a new workload.

Authentication docs

Cross-namespace snapshot exposure

A VolumeSnapshot lives in one namespace and can only be restored into that namespace, but the VolumeSnapshotContent it points to is cluster-scoped. Review who can read or create VolumeSnapshotContent objects, because they reveal snapshot handles and source references across teams. Pre-provisioned snapshot contents, used for importing existing backups, are a common route for one tenant to reach another tenant's data.

Encryption of snapshot storage

Snapshot data is stored by the CSI driver's backend, not by Kubernetes, so encryption at rest depends on the driver and the array, storage system or cloud service behind it. Ask each driver vendor whether snapshots inherit volume encryption, whether keys are managed in your key service, and who holds the keys for offsite copies. Record the answer per VolumeSnapshotClass, since one cluster can run several drivers with different behavior.

Secrets captured in volume snapshots

A snapshot copies the whole volume, including any Secret files, tokens or private keys an application wrote to disk. Kubernetes Secrets are stored unencrypted in etcd by default, and a copy of a volume can persist the same material outside that protection. Keep credentials out of application volumes where possible, mount them from a secrets store, and treat snapshots that contain them as sensitive data with matching retention and access.

Secrets good practices

Snapshot retention and deletion checks

Snapshots that nobody deletes keep copies of sensitive data alive long after the application is retired. Set a retention rule for each snapshot class and confirm that deleting a VolumeSnapshot also removes its backend copy, which depends on the deletionPolicy set on the VolumeSnapshotClass. Test deletion in a non-production cluster and check the backend storage to confirm the data is gone.

Audit trail for snapshot actions

Create, delete and restore calls against snapshot objects should appear in the Kubernetes audit log, so the security team can see who took a copy and who restored it. Confirm your audit policy records these resources at a level that includes the request user, and forward the log to a system outside the cluster. Without this record, a restored copy of sensitive data can be hard to account for during an investigation.

Questions teams ask before setting up snapshots and restores

What drives the cost of setting up VolumeSnapshot support?

The main cost is the engineering time to install the snapshot controller and CRDs, define a VolumeSnapshotClass for each CSI driver, and prove that restores work. Cost rises with the number of storage backends, the number of applications that need consistent snapshots, and how much restore testing the organization requires. Storage overhead is a recurring cost: snapshots consume capacity on the backend, so retention counts matter. Ask any partner for a quote that lists each backend, each application class, the Velero integration if one is needed, and the restore test scope as separate line items.

How long does snapshot setup take, and does the backend change that?

The backend is the largest factor. A driver with mature VolumeSnapshot support and a clear VolumeSnapshotClass model is faster to configure than one where snapshot behavior depends on array features, custom tooling or a separate licensing step. Application-consistent snapshots for databases add time because each application needs its own freeze or quiesce procedure and its own restore test. Confirm the snapshot support of your specific CSI driver version with the driver vendor or project before estimating duration, since support differs across drivers.

What does our team need to provide for the work?

You need cluster administrator access to install the snapshot controller and CRDs, and access to the storage system or its management API so snapshot classes can be tested against real volumes. Storage administrators should confirm capacity planning, snapshot retention and where snapshot data physically lives. Application owners must agree on which data needs consistent snapshots and must make time in a restore test window, because a snapshot that has never been restored into a working application has not been proven. Plan these inputs before the engagement starts so testing is not delayed.

Can our platform team set up snapshots and restores alone?

Yes, if your team already operates the storage backend, has Kubernetes administration experience and can test restores against your applications. The pieces are documented in the Kubernetes and CSI ecosystem, and a competent team can build the first VolumeSnapshotClass and restore path. The harder parts are application-consistent procedures for databases, coordinating snapshots with Velero backups and running repeatable restore tests. Teams without a storage specialist or without time for regular restore exercises often find that the setup works but the proof does not exist.

When should we bring in outside help for snapshots?

Bring in outside help when several storage backends are involved, when stateful databases or message brokers need consistent snapshots, or when an audit or customer review will ask for evidence of tested restores. Outside help is also useful when Velero and CSI snapshots must work together and you want a documented design for which system owns which recovery point. DeployOpen plans, implements, documents and supports self-hosted open-source platforms in infrastructure you control, and works from a written, fixed scope agreed before work starts. It does not issue audit reports or certifications, so ask your independent auditor what evidence they expect.

Do snapshots replace Velero backups?

No. A VolumeSnapshot records the state of one persistent volume on the storage backend, usually in the same storage system, so it does not by itself protect against loss of that system or capture Kubernetes objects such as Deployments, Services and Secrets. Velero backs up Kubernetes resources and can use CSI snapshots for volume data, and it can also copy data to a separate location. Decide which recovery point covers which failure, then test both paths. A common design uses snapshots for short-term, fast restores and Velero for off-site and cluster-level recovery.

What goes wrong most often with snapshots and restores?

The most common failure is a snapshot that completes but restores a database in an inconsistent state, because the application was not quiesced before the snapshot. Other frequent problems are a VolumeSnapshotClass pointing at the wrong driver, deletion policies that remove backend snapshots unexpectedly, retention that fills storage capacity, and restores that were never tried in a clean namespace. Engineers should check that restored volumes mount, that applications start and that data matches expectations, and should record how long each restore took so recovery planning uses real numbers.

How DeployOpen scopes and delivers snapshot and restore work

DeployOpen plans, implements, tests and documents VolumeSnapshot support inside your own clusters and storage, so your team can take and restore snapshots with confidence. Engagements are fixed-scope, with the snapshot design, restore procedure and handover agreed in writing before work starts.

How we scope

  • Inventory the CSI drivers in use and confirm which ones support volume snapshots in your environment
  • Agree which workloads need snapshots, their recovery point targets and where Velero backups fit alongside them
  • Define the written scope, deliverables and timeline for snapshot controller, VolumeSnapshotClass and restore work

How we build

  • Install the snapshot controller and VolumeSnapshot CRDs using the versions your distribution and drivers support
  • Create one VolumeSnapshotClass per driver with deletion policy and parameters agreed with your storage team
  • Test restores of PVCs from snapshots, plus application-consistent snapshot hooks for databases you designate

How we hand over

  • Document the snapshot design, class definitions, RBAC for who may create and restore snapshots, and restore runbooks
  • Run a restore drill with your operators and record the results, including what was verified and what remains open
  • Provide the configuration as code so changes go through your existing review and change process

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer covering snapshot controller and driver updates
  • Retest restore procedures after Kubernetes minor upgrades or driver changes, as agreed in the retainer scope
  • Confirm with your storage vendor and Kubernetes distribution which snapshot features apply to your versions before relying on them

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.