Skip to content

Instantly share code, notes, and snippets.

@syfun
Created December 30, 2018 06:24
Show Gist options
  • Save syfun/bc9ab3e9dafa03f5239eeae95c2fa398 to your computer and use it in GitHub Desktop.
Save syfun/bc9ab3e9dafa03f5239eeae95c2fa398 to your computer and use it in GitHub Desktop.
Install k8s with minikube
#!/usr/bin/env bash
# pull image
docker pull syfun/kube-proxy:v1.12.4
docker pull syfun/kube-controller-manager:v1.12.4
docker pull syfun/pause:3.1
docker pull syfun/etcd:3.2.24
docker pull syfun/coredns:1.2.2
docker pull syfun/kube-apiserver:v1.12.4
docker pull syfun/kube-scheduler:v1.12.4
docker tag syfun/kube-proxy:v1.12.4 k8s.gcr.io/kube-proxy:v1.12.4
docker tag syfun/kube-controller-manager:v1.12.4 k8s.gcr.io/kube-controller-manager:v1.12.4
docker tag syfun/pause:3.1 k8s.gcr.io/pause:3.1
docker tag syfun/etcd:3.2.24 k8s.gcr.io/etcd:3.2.24
docker tag syfun/coredns:1.2.2 k8s.gcr.io/coredns:1.2.2
docker tag syfun/kube-apiserver:v1.12.4 k8s.gcr.io/kube-apiserver:v1.12.4
docker tag syfun/kube-scheduler:v1.12.4 k8s.gcr.io/kube-scheduler:v1.12.4
# install kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
# install minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
&& sudo install minikube-linux-amd64 /usr/local/bin/minikube
export MINIKUBE_WANTUPDATENOTIFICATION=false
export MINIKUBE_WANTREPORTERRORPROMPT=false
export MINIKUBE_HOME=$HOME
export CHANGE_MINIKUBE_NONE_USER=true
mkdir -p $HOME/.kube
mkdir -p $HOME/.minikube
touch $HOME/.kube/config
export KUBECONFIG=$HOME/.kube/config
sudo -E 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}; do # timeout for 5 minutes
kubectl get po &> /dev/null
if [ $? -ne 1 ]; then
break
fi
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment