Enable CSI Snapshot Support on a Cluster
Enable CSI Snapshot Support for Programmatic Creation of Longhorn Snapshots/Backups
Prerequisite
It is the responsibility of the Kubernetes distribution to deploy the snapshot controller as well as the related custom resource definitions.
For more information, see CSI Volume Snapshots.
You may manually install these components by executing the following steps.
Prerequisite
Please install the snapshot CRDs and snapshot controller from the same release version to ensure that the CRD version is compatible with the controller. You can refer to the external snapshotter version
image.csi.snapshotter.taglisted in Helm Values to determine which version of the snapshot CRDs and snapshot controller to install. Then replace<version>in the following steps with the appropriate version. For example, if the external snapshotter version is v8.5.0-xxx, use v8.5.0 for both the snapshot CRDs and snapshot controller.For general use, update the snapshot controller YAMLs with an appropriate namespace prior to installing.
For example, on a vanilla Kubernetes cluster, update the namespace from
defaulttokube-systemprior to issuing thekubectl createcommand.
Install the Snapshot CRDs:
https://github.com/kubernetes-csi/external-snapshotter/tree/<version>/client/config/crdkubectl create -k client/config/crd.Install the Common Snapshot Controller:
https://github.com/kubernetes-csi/external-snapshotter/tree/<version>/deploy/kubernetes/snapshot-controllerkube-system)kubectl create -k deploy/kubernetes/snapshot-controller.Note: previously, the snapshot controller YAML files were deployed into the
defaultnamespace by default. The updated YAML files are being deployed intokube-systemnamespace by default. Therefore, we suggest deleting the previous snapshot controller in thedefaultnamespace to avoid having multiple snapshot controllers.
See the Usage section from the kubernetes external-snapshotter git repo for additional information.
VolumeSnapshotClassEnsure the availability of the Snapshot CRDs. Afterwards create a default VolumeSnapshotClass.
# Use v1 as an example
kind: VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1
metadata:
name: longhorn
driver: driver.longhorn.io
deletionPolicy: Delete
© 2019-2026 Longhorn a Series of LF Projects, LLC. Documentation Distributed under CC-BY-4.0.
For website terms of use, trademark policy and other project policies please see lfprojects.org/policies.