(assuming running Kubernetes local cluster):
_output/bin/snapshot-controller -kubeconfig=${HOME}/.kube/config -cloudprovider=aws
- Create an PVC
kubectl create namespace myns
# if no default storage class, create one
kubectl create -f https://raw.githubusercontent.com/kubernetes/kubernetes/master/examples/persistent-volume-provisioning/aws-ebs.yaml
kubectl create -f examples/aws/pvc.yaml
- Create a Snapshot Third Party Resource
kubectl create -f examples/aws/snapshot.yaml
kubectl get volumesnapshot,volumesnapshotdata -o yaml --namespace=myns
Unlike exiting PV provisioners that provision blank volume, Snapshot based PV provisioners create volumes based on existing snapshots. Thus new provisioners are needed.
There is a special annotation give to PVCs that request snapshot based PVs. As illustrated in the example, snapshot.alpha.kubernetes.io
must point to an existing VolumeSnapshot Object
metadata:
name:
namespace:
annotations:
snapshot.alpha.kubernetes.io/snapshot: snapshot-demo
_output/bin/snapshot-provisioner -kubeconfig=${HOME}/.kube/config -cloudprovider=aws
kubectl create -f examples/aws/class.yaml
kubectl create -f examples/aws/claim.yaml