(assuming running Kubernetes local cluster):
_output/bin/snapshot-controller -kubeconfig=${HOME}/.kube/config
- Create a hostpath PV and PVC
kubectl create namespace myns
kubectl -f examples/hostpath/pv.yaml
kubectl -f examples/hostpath/pvc.yaml
- Create a Snapshot Third Party Resource
kubectl -f examples/hostpath/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
Start provisioner (assuming running Kubernetes local cluster):
_output/bin/snapshot-provisioner -kubeconfig=${HOME}/.kube/config
Create a storage class:
kubectl create -f examples/hostpath/class.yaml
kubectl create -f examples/hostpath/claim.yaml
kubectl get pv,pvc