Skip to content

Instantly share code, notes, and snippets.

@oqq
Last active October 18, 2017 14:18
Show Gist options
  • Save oqq/52b278603e45cbf86bbcabb0b7345f3e to your computer and use it in GitHub Desktop.
Save oqq/52b278603e45cbf86bbcabb0b7345f3e to your computer and use it in GitHub Desktop.
Minikube Setup
export http_proxy=`scutil --proxy | awk '\
/HTTPEnable/ { enabled = $3; } \
/HTTPProxy/ { server = $3; } \
/HTTPPort/ { port = $3; } \
END { if (enabled == "1") { print "http://" server ":" port; } }'`
export https_proxy=`scutil --proxy | awk '\
/HTTPSEnable/ { enabled = $3; } \
/HTTPSProxy/ { server = $3; } \
/HTTPSPort/ { port = $3; } \
END { if (enabled == "1") { print "https://" server ":" port; } }'`
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$https_proxy

Install

$ brew update
$ brew install kubectl
$ brew cask install minikube

install xhyve driver

$ brew install docker-machine-driver-xhyve

# docker-machine-driver-xhyve need root owner and uid
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

start minikube

$ echo '{}' > /Users/ebraun/.minikube/config/config.json

$ minikube start \
    --logtostderr \
    --vm-driver=xhyve \
    --docker-env HTTP_PROXY=$http_proxy \
    --docker-env HTTPS_PROXY=$https_proxy \
    --docker-env NO_PROXY=192.168.64.0/24
    
$ export no_proxy=$no_proxy,$(minikube ip)
$ export NO_PROXY=$no_proxy,$(minikube ip)

$ kubectl get nodes
$ kubectl get pods --all-namespaces

test

$ kubectl run hello-minikube --image=gcr.io/google_containers/echoserver --port=8080
$ kubectl expose deployment hello-minikube --type=NodePort
$ kubectl get pod curl $(minikube service hello-minikube --url)

Dashboard

$ kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
$ minikube dashboard

Uninstall

$ minikube stop
$ minikube delete
$ rm -rf ~/.minikube .kube
$ brew uninstall kubectl
$ brew cask uninstall minikube
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment