# How to Create Volume Snapshots in Kubernetes Clusters 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. You must have an existing volume in use in your cluster, which you can [create by creating a `PersistentVolumeClaim`](https://docs.digitalocean.com/products/kubernetes/how-to/add-volumes/index.html.md) (PVC). For the purposes of this tutorial, presume we have already created a PVC by calling `kubectl create -f your_pvc_file.yaml` with a YAML file that looks like this: ```yaml apiVersion: v1 kind: PersistentVolumeClaim metadata: name: csi-do-test-pvc spec: accessModes: - ReadWriteOnce resources: requests: storage: 5Gi storageClassName: do-block-storage ``` ## Create a Snapshot of a Volume To create a snapshot of a volume, call `kubectl create -f your_snapshot_file.yaml` and specify the desired PVC. Here’s an example of a YAML file that defines a snapshot: ```yaml apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshot metadata: name: csi-do-test-snapshot spec: source: persistentVolumeClaimName: csi-do-test-pvc ``` If you are using a DigitalOcean Kubernetes version prior to 1.18, the snapshot resource was supported in the alpha version only and used different fields: ```yaml apiVersion: snapshot.storage.k8s.io/v1alpha1 kind: VolumeSnapshot metadata: name: csi-do-test-snapshot spec: source: name: csi-do-test-pvc kind: PersistentVolumeClaim ``` You can now observe the state of your volumes and snapshots in the [DigitalOcean Control Panel](https://cloud.digitalocean.com) or by using the following command: ```shell kubectl get pvc && kubectl get pv && kubectl get volumesnapshot ``` ## More Information - To import volumes from existing snapshots, see [How to Restore Volumes from Snapshots in Kubernetes Clusters](https://docs.digitalocean.com/products/kubernetes/how-to/restore-volumes/index.html.md). - For more details and examples of using snapshots in Kubernetes, see [the official Kubernetes blog announcement](https://kubernetes.io/blog/2018/10/09/introducing-volume-snapshot-alpha-for-kubernetes/).