The Snapshot Controller manages CSI Volume Snapshots, enabling creation, restoration, and deletion of Persistent Volume (PV) snapshots. KubeBlocks' DataProtection Controller leverages this component for database snapshot operations.
Step 1: Check Prerequisites
Verify if required CRDs exist:
kubectl get crd volumesnapshotclasses.snapshot.storage.k8s.io
kubectl get crd volumesnapshots.snapshot.storage.k8s.io
kubectl get crd volumesnapshotcontents.snapshot.storage.k8s.io
If your cluster lacks these CRDs, you'll need to install them first:
# v8.2.0 is the latest version of the external-snapshotter, you can replace it with the version you need.
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.2.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.2.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.2.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
NOTE
Optional Installation
If snapshot backups aren't required, you can install just the CRDs and skip following steps.
Step 2: Deploy Snapshot Controller
Install using Helm with these steps:
helm repo add piraeus-charts https://piraeus.io/helm-charts/
helm repo update
# Update the namespace to an appropriate value for your environment (e.g. kb-system)
helm install snapshot-controller piraeus-charts/snapshot-controller -n kb-system --create-namespace