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 17.06.0-ce, build 02c1d87
docker-compose --version # docker-compose version 1.14.0, build c7bdf9e
docker-machine --version # docker-machine version 0.12.0, build 45c69ad
minikube version # minikube version: v0.21.0
kubectl version --client # Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"2c2fe6e8278a5db2d15a013987b53968c743f2a1", GitTreeState:"clean", BuildDate:"2017-08-03T15:13:53Z", GoVersion:"go1.8.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 VERSION
minikube Ready 9s v1.7.0
eval $(minikube docker-env)
Running docker ps
should now output something like:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e97128790bf9 gcr.io/google-containers/kube-addon-manager "/opt/kube-addons.sh" 22 seconds ago Up 22 seconds k8s_kube-addon-manager_kube-addon-manager-minikube_kube-system_c654b2f084cf26941c334a2c3d6db53d_0
69707e54d1d0 gcr.io/google_containers/pause-amd64:3.0 "/pause" 33 seconds ago Up 33 seconds k8s_POD_kube-addon-manager-minikube_kube-system_c654b2f084cf26941c334a2c3d6db53d_0
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
You can build the Dockerfile below locally if you want to follow this guide to the letter. Store the Dockerfile locally, preferably in an empty directory and run:
docker build . --tag my-app
You should now have an image named 'my-app' locally, check by using docker images
(or your own image of course). You can then publish it to your local docker registry:
docker tag my-app localhost:5000/my-app:0.0.1
Running docker images
should now output the following:
REPOSITORY TAG IMAGE ID CREATED SIZE
node 8-alpine 442930c9c9fb 2 weeks ago 64.6MB
localhost:5000/my-app latest 442930c9c9fb 2 weeks ago 64.6MB
my-app latest 442930c9c9fb 2 weeks ago 64.6MB
Store the file below my-app.yml
on your system 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).
minikube dashboard
kubectl delete deploy my-app
kubectl delete service my-app
You're now good to go and deploy other images!
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.
Last tested on 2017 August 10
macOS Sierra 10.12.6