(assuming running inside of Kubernetes cluster master node):
_output/bin/snapshot-controller -kubeconfig=${HOME}/.kube/config -cloudprovider=gce
- Create a PVC
kubectl create namespace myns
# if no default storage class, create Provisioner
kubectl create -f examples/gce/class.yaml
kubectl -f examples/gce/pvc.yaml
- Create a Snapshot Third Party Resource
kubectl -f examples/gce/snapshot.yaml
kubectl get volumesnapshot,volumesnapshotdata -o yaml --namespace=myns
Unlike existing 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
Start provisioner (assuming running Kubernetes local cluster):
_output/bin/snapshot-provisioner -kubeconfig=${HOME}/.kube/config -cloudprovider=gce
Create a storage class:
kubectl create -f examples/gce/provision.yaml
kubectl create -f examples/gce/claim.yaml
kubectl get pv,pvc