Skip to content

Instantly share code, notes, and snippets.

@darkhelmet
Forked from minrk/minikube-bootstrap.sh
Last active May 23, 2018 20:34
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 darkhelmet/60efdd765d820ce918cc9e86549d17f6 to your computer and use it in GitHub Desktop.
Save darkhelmet/60efdd765d820ce918cc9e86549d17f6 to your computer and use it in GitHub Desktop.
bootstrap single node kubernetes with minikube (no vm)
set -x
# apt -y update
# apt -y dist-upgrade
# apt -y install docker.io
which minikube || (curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && mv minikube /usr/local/bin/)
which kubectl || (curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/)
which helm || (curl -Lo helm.tar.gz https://kubernetes-helm.storage.googleapis.com/helm-v2.6.1-linux-amd64.tar.gz && tar -xzf helm.tar.gz && mv linux-amd64/helm /usr/local/bin/)
export MINIKUBE_WANTUPDATENOTIFICATION=false
export MINIKUBE_WANTREPORTERRORPROMPT=false
export MINIKUBE_HOME=$HOME
export CHANGE_MINIKUBE_NONE_USER=true
mkdir $HOME/.kube || true
touch $HOME/.kube/config
export KUBECONFIG=$HOME/.kube/config
minikube start --vm-driver=none
# this for loop waits until kubectl can access the api server that minikube has created
for i in {1..150} # timeout for 5 minutes
do
kubectl get po &> /dev/null
if [ $? -ne 1 ]; then
break
fi
sleep 2
done
helm init
# kubectl commands are now able to interact with minikube cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment