Skip to content

Instantly share code, notes, and snippets.

@sallyom
Last active December 17, 2021 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sallyom/36017297c5bcda24e6c952241bf76e2f to your computer and use it in GitHub Desktop.
Save sallyom/36017297c5bcda24e6c952241bf76e2f to your computer and use it in GitHub Desktop.
microshift instance, configure storage and install volsync operator
mkdir ~/.kube && sudo cp /var/lib/microshift/resources/kubeadmin/kubeconfig ~/.kube/config
sudo chown -R ec2-user:ec2-user ~/.kube
curl -o oc.tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz
tar -xzvf oc.tar.gz
sudo install -t /usr/local/bin oc
rm oc.tar.gz oc kubectl README.md
SNAPSHOTTER_VERSION=v4.2.1
# Change to the latest supported snapshotter version
# Apply VolumeSnapshot CRDs
oc apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${SNAPSHOTTER_VERSION}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
oc apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${SNAPSHOTTER_VERSION}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
oc apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${SNAPSHOTTER_VERSION}/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
# Create snapshot controller
oc apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${SNAPSHOTTER_VERSION}/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
oc apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${SNAPSHOTTER_VERSION}/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml
# clone
git clone https://github.com/kubernetes-csi/csi-driver-host-path.git
cd csi-driver-host-path
# deploy hostpath driver, configure storageclass
./deploy/kubernetes-latest/deploy.sh
for i in ./examples/csi-storageclass.yaml ./examples/csi-pvc.yaml ./examples/csi-app.yaml; do oc apply -f $i; done
oc annotate sc/kubevirt-hostpath-provisioner storageclass.kubernetes.io/is-default-class="false" --overwrite
oc annotate sc/csi-hostpath-sc storageclass.kubernetes.io/is-default-class="true" --overwrite
# AWS
# configure volumesnapshotclass
oc create -f - << SNAPCLASS
---
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: gp2-csi
driver: ebs.csi.aws.com
deletionPolicy: Delete
SNAPCLASS
# AWS
kubectl annotate volumesnapshotclass/gp2-csi snapshot.storage.kubernetes.io/is-default-class="true"
# install helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# install volsync backube repo
helm repo add backube https://backube.github.io/helm-charts/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment