This driver implements basic volume snapshotting functionality using the external snapshotter sidecar and creates snapshots of EBS volumes using the VolumeSnapshot
custom resources.
-
Kubernetes 1.13+ (CSI 1.0).
-
The
VolumeSnapshotDataSource
must be set in--feature-gates=
in thekube-apiserver
. -
The aws-ebs-csi-driver driver is installed.
- Create the
StorageClass
andVolumeSnapshotClass
:
kubectl apply -f specs/classes/
- Create a sample app and the
PersistentVolumeClaim
:
kubectl apply -f specs/app/
- Validate the volume was created and
volumeHandle
contains an EBS volumeID:
kubectl describe pv
- Validate the pod successfully wrote data to the volume, taking note of the timestamp of the first entry:
kubectl exec -it app cat /data/out.txt
- Create a
VolumeSnapshot
referencing thePersistentVolumeClaim
name:
kubectl apply -f specs/snapshot/
- Wait for the
Ready To Use: true
attribute of theVolumeSnapshot
:
kubectl describe volumesnapshot.snapshot.storage.k8s.io ebs-volume-snapshot
- Delete the existing app:
kubectl delete -f specs/app/
- Restore a volume from the snapshot with a
PersistentVolumeClaim
referencing theVolumeSnapshot
in itsdataSource
:
kubectl apply -f specs/snapshot-restore/
- Validate the new pod has the restored data by comparing the timestamp of the first entry to that of in step 4:
kubectl exec -it app cat /data/out.txt
- Cleanup resources:
kubectl delete -f specs/snapshot-restore
kubectl delete -f specs/snapshot
kubectl delete -f specs/classes