Skip to content

Instantly share code, notes, and snippets.

@jdolitsky
Created March 21, 2019 08:09
Show Gist options
  • Save jdolitsky/5036bdb793eca5b2f12a2488011250e2 to your computer and use it in GitHub Desktop.
Save jdolitsky/5036bdb793eca5b2f12a2488011250e2 to your computer and use it in GitHub Desktop.
kind install with helm and local-path-provisioner
#!/bin/bash -ex
CLUSTER_NAME=${CLUSTER_NAME:-mycluster}
go get -u sigs.k8s.io/kind
kind delete cluster --name=$CLUSTER_NAME || true
kind create cluster --name=$CLUSTER_NAME
SET_KUBE_CMD="export KUBECONFIG="$(kind get kubeconfig-path --name="$CLUSTER_NAME")""
$SET_KUBE_CMD
# Install local-path-provisioner
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
# Set local-path as default storage class (and unset the current default, i.e standard)
kubectl patch storageclass standard -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false", "storageclass.beta.kubernetes.io/is-default-class":"false"}}}'
kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true", "storageclass.beta.kubernetes.io/is-default-class":"true"}}}'
# Install Helm (Tiller)
kubectl -n kube-system create sa tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
set +x
echo ""
echo "To access this cluster:"
echo ""
echo " $SET_KUBE_CMD"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment