Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setting up a K8s cluster to support CSI beta snapshot APIs
echo "Creating a Kubernetes 1.17 cluster using Kind..."
kind create cluster --image=kindest/node:v1.17.0 --name csi-117
# https://github.com/ashish-amarnath/csi-driver-host-path/tree/deploy-1.17
cd /Users/ashisham/work/kubernetes/src/code/csi-driver-host-path/
echo "Deploying hostpath plugin from $(PWD), from branch $(git branch | grep "*") *"
read -p "Press enter to deploy"
./deploy/kubernetes-1.17/deploy-hostpath.sh
# from https://github.com/ashish-amarnath/external-snapshotter/tree/deploy-1.17
read -p "Deploying external snapshotter CRDs, common controller and CSI snapshotter"
cd /Users/ashisham/work/kubernetes/src/code/external-snapshotter
# deploy CRDs
read -p "Deploy Snapshot API CRDs"
kubectl apply -f ./config/crd/
kubectl apply -f deploy/kubernetes/snapshot-controller/
kubectl apply -f deploy/kubernetes/csi-snapshotter/rbac-csi-snapshotter.yaml
kubectl apply -f deploy/kubernetes/csi-snapshotter/setup-csi-snapshotter.yaml
echo "Creating volumesnapshotclass [csi-hostpath-snapclass]"
cd /Users/ashisham/work/kubernetes/src/code/csi-driver-host-path/
kubectl apply -f deploy/kubernetes-1.17/snapshotter/csi-hostpath-snapshotclass.yaml
read -p "Validate current cluster state and continue"
echo "Deploying my-csi-app to run tests"
# # deploy hostpath plugin driver sample app to test
cd /Users/ashisham/work/kubernetes/src/code/csi-driver-host-path
for i in ./examples/csi-storageclass.yaml ./examples/csi-pvc.yaml ./examples/csi-app.yaml; do kubectl apply -f $i; done
read -p "Verify hostpath plugin volume operations work as expected"
cd /Users/ashisham/work/kubernetes/src/code/csi-driver-host-path
cat ./examples/csi-snapshot.yaml
read -p "Create a snapshot of a hostpath volume"
cat ./examples/csi-restore.yaml
read -p "Restore the snapshot into a new PVC using the sanpshot as the data source"
read -p "Deleting kind cluster [csi-117]"
kind delete cluster --name csi-117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment