Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:
sysctl -a | grep machdep.cpu.features | grep VMX
If there's output, you're good!
- kubectl
- docker (for Mac)
- minikube
- virtualbox
brew update && brew install kubectl && brew cask install docker minikube virtualbox
docker --version # Docker version 1.12.3, build 6b644ec
docker-compose --version # docker-machine version 0.8.2, build e18a919
docker-machine --version # docker-compose version 1.8.1, build 878cff1
minikube version # minikube version: v0.12.2
kubectl version --client # Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.6+e569a27", GitCommit:"e569a27d02001e343cb68086bc06d47804f62af6", GitTreeState:"not a git tree", BuildDate:"2016-11-12T09:26:56Z", GoVersion:"go1.7.3", Compiler:"gc", Platform:"darwin/amd64"}
minikube start
This can take a while, expected output:
Starting local Kubernetes cluster...
Kubectl is now configured to use the cluster.
Great! You now have a running Kubernetes cluster locally. Minikube started a virtual machine for you, and a Kubernetes cluster is now running in that VM.
kubectl get nodes
Should output something like:
NAME STATUS AGE
minikube Ready 8m
eval $(minikube docker-env)
Running docker ps
should now output something like:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
474eae7e7dd4 gcr.io/google_containers/kubernetes-dashboard-amd64:v1.4.0 "/dashboard --port=90" 35 minutes ago Up 35 minutes k8s_kubernetes-dashboard.bdfedaad_kubernetes-dashboard-46007_kube-system_92b679ab-982b-11e6-8ad0-c604d62c2a3b_2afa3feb
6142f91d57ab gcr.io/google_containers/pause-amd64:3.0 "/pause" 35 minutes ago Up 35 minutes k8s_POD.2225036b_kubernetes-dashboard-46007_kube-system_92b679ab-982b-11e6-8ad0-c604d62c2a3b_61445f01
332c645bb167 gcr.io/google-containers/kube-addon-manager:v5.1 "/opt/kube-addons.sh" 35 minutes ago Up 35 minutes k8s_kube-addon-manager.92e38b3b_kube-addon-manager-minikube_kube-system_46ae05e07c52d84167b077b142aa4a39_253f9280
8ea2cd68e0a8 gcr.io/google_containers/pause-amd64:3.0 "/pause" 35 minutes ago Up 35 minutes k8s_POD.d8dbe16c_kube-addon-manager-minikube_kube-system_46ae05e07c52d84167b077b142aa4a39_da8bd6f9
First setup a local registry, so Kubernetes can pull the image(s) from there:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
If you have already built an image, e.g. named 'my-app' locally (check by using docker images
), you can publish it to your local repo:
docker tag my-app localhost:5000/my-app
Check the two yaml files, and run the following:
kubectl create -f my-app.yml
You should now see your pod and your service:
kubectl get all
The configuration exposes my-app
outside of the cluster, you can get the address to access it by running:
minikube service my-app --url
This should give an output like http://192.168.99.100:30304
(the port will most likely differ).
Get the IP:
kubectl describe nodes | grep Addresses
Get the port:
kubectl get svc kubernetes-dashboard -o json --namespace=kube-system | grep nodePort
Then go to http://<IP>:<PORT>
.
minikube stop;
minikube delete;
rm -rf ~/.minikube .kube;
brew uninstall kubectl;
brew cask uninstall docker virtualbox minikube;
Will try to convert this to xhyve when possible.