Skip to main content
Version: 1.47

Volume Snapshots

Volume Snapshots let you initialize persistent volume claims with the contents of an existing Volume Snapshot. Use them to work with large datasets, or to create application environments with real data from your production or staging environments.

Requirements​

Volume Snapshots need a CSI driver that supports snapshots, and a VolumeSnapshotClass for that driver.

CSI driver installation​

Volume Snapshots work with any CSI-compliant driver, such as:

Follow your vendor's instructions to install and set up the driver.

VolumeSnapshotClass​

Create a VolumeSnapshotClass in your cluster to set the CSI driver and the deletionPolicy for your VolumeSnapshots. For example:

# okteto-snapshot-class.yaml
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: okteto-snapshot-class
driver: ebs.csi.aws.com
deletionPolicy: Delete

Save the manifest as okteto-snapshot-class.yaml and run the following command to create the VolumeSnapshotClass:

kubectl apply -f okteto-snapshot-class.yaml

StorageClass (optional)​

You can also create a storage class for Okteto to use when it creates the volumes.

# okteto-snapshot-sc.yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: okteto-snapshot-sc
provisioner: ebs.csi.aws.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer

Save the manifest as okteto-snapshot-sc.yaml and run the following command to create the StorageClass:

kubectl apply -f okteto-snapshot-sc.yaml

Enabling Volume Snapshots​

To enable Volume Snapshots in your Okteto instance, add the following values to your config.yaml file and run a Helm upgrade to apply them.

The volumeSnapshots Helm configuration lists every available setting.

volumeSnapshots:
enabled: true
driver: ebs.csi.aws.com
class: okteto-snapshot-class
storageClass: okteto-snapshot-sc

By default, every user in your cluster can use any available snapshot as a data source for their application environments. To restrict this, set the enableNamespaceAccessValidation key to true in the volumeSnapshots section of the configuration.

Using Volume Snapshots in Application Environments​

Volume Snapshots in Development Environments explains how to use Volume Snapshots in your application environments.