How to Restore Volumes from Snapshots in Kubernetes Clusters
Validated on 7 Jun 2022 • Last edited on 17 Apr 2025
DigitalOcean Kubernetes (DOKS) is a Kubernetes service with a fully managed control plane, high availability, and autoscaling. DOKS integrates with standard Kubernetes toolchains and DigitalOcean’s load balancers, volumes, CPU and GPU Droplets, API, and CLI.
In Kubernetes, a volume snapshot is a point-in-time copy of the contents of a Kubernetes cluster. You can use snapshots to back up a cluster’s data or copy the data to another resource without needing to create a new volume.
To import an existing snapshot into DigitalOcean as a volume, you need to create a new PVC that refers to the snapshot by calling kubectl create -f your_restore_file.yaml
. Here’s an example of a YAML file that restores from a snapshot and creates a new PVC for use in the cluster:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-do-test-pvc-restore
spec:
dataSource:
name: csi-do-test-snapshot
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi