Skip to content

Instantly share code, notes, and snippets.

@minrk
Last active March 12, 2020 02:02
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save minrk/42cd5d5b68bc1c7e00b9fef9bb1490e8 to your computer and use it in GitHub Desktop.
Save minrk/42cd5d5b68bc1c7e00b9fef9bb1490e8 to your computer and use it in GitHub Desktop.
bootstrap single node kubernetes with minikube (no vm)
set -x
wget -O /usr/local/bin/rmate https://raw.github.com/aurora/rmate/master/rmate
chmod a+x /usr/local/bin/rmate
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