Note that we assume you correctly installed the csi-digitalocean driver, and it's up and running.
- Create a
pvc
:
$ kubectl create -f pvc.yaml
- Create a
snapshot
from the previouspvc
:
$ kubectl create -f snapshot.yaml
At this point you should have a volume and a snapshot originating from that volume. You can observe the state of your pvc's and snapshots with the following command:
$ kubectl get pvc && kubectl get pv && kubectl get volumesnapshot
- Restore from a
snapshot
:
To restore from a given snapshot, you need to create a new pvc
that refers to
the snapshot:
$ kubectl create -f restore.yaml
This will create a new pvc
that you can use with your applications.
- Cleanup your resources:
Make sure to delete your test resources:
$ kubectl delete -f pvc.yaml
$ kubectl delete -f restore.yaml
$ kubectl delete -f snapshot.yaml
To understand how snapshotting works, please read this official blog post:
https://kubernetes.io/blog/2019/12/09/kubernetes-1-17-feature-cis-volume-snapshot-beta/