Skip to content

Instantly share code, notes, and snippets.

@tom-butler
Last active January 12, 2020 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tom-butler/daae68de1c58e17c284703a29bb73bd4 to your computer and use it in GitHub Desktop.
Save tom-butler/daae68de1c58e17c284703a29bb73bd4 to your computer and use it in GitHub Desktop.
local-kubernetes
#!/bin/bash
set -e
# Install k3d
wget -q -O - https://raw.githubusercontent.com/rancher/k3d/master/install.sh | bash
# verify it
k3d --version
k3d check-tools
# create a volume and cluster
docker volume create kube-volume
k3d create --workers 3 --volume kube-volume:/opt/local-path-provisioner
sleep 5
# connect to the cluster
export KUBECONFIG="$(k3d get-kubeconfig --name='k3s-default')"
# install helm
kubectl apply -f https://raw.githubusercontent.com/opendatacube/datacube-k8s-eks/master/infra/tiller.yaml
helm init --service-account tiller --wait
# install strorageClass
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
# mark it as default
kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
@tom-butler
Copy link
Author

tom-butler commented May 14, 2019

requires docker

creates a local kubernetes cluster in docker using k3s.

you can perform kubectl commands as normal, when you are done run: k3d delete to remove the cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment