Fresh Blurbs

Installing and Running Kubernetes Locally On a MacOS Sierra

Kubernetes is probably the most popular container-orchestration system, currently. It was originally developed and eventually open-sourced by Google. Kubernetes competes with the likes of Swarm, DC/OS and AWS's ECS.

Kubernetes is a complex ecosystem of various software components that is actually quite non-trivial to put together. It can be a great way of orchestrating containers (e.g. Docker ones) in production, but if you need a compatible local environment for development, setting such thing up yourself, from scratch, can be a painful experience. Which is why the community has created Minikube - a Kubernetes distribution for easy local installation.

Minikube still requires a Docker-compatible VM. There are many ways of getting one, but at the time of this writing, the most straightforward way, on MacOS Sierra, is the installation of Docker for Mac. This is also the way recommended by Docker documentation itself.

Docker for Mac uses the xhyve hypervisor, a lightweight solution that frees you from installing heavier, full Linux VMs like VirtualBox etc. It's worth noting that Minikube did originally require using VirtualBox, but the latest versions are compatible with Docker for Mac – great news! Following is a quick list of commands showing how you can get everything installed.

Note: the following instructions are specific to the component versions available at the time of writing. If you are reading this post later, please make sure to use commands that contain updated versions of the corresponding software.

To run through the commands you will need a working Docker for Mac and Homebrew. Make sure to install those, before executing the following commands.

Once you have Docker for Mac and Homebrew:

$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ 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

$ curl -Lo minikube && chmod +x minikube && sudo mv minikube /usr/local/bin/
$ curl -Lo kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/

$ minikube start --logtostderr --show-libmachine-logs --vm-driver=xhyve

If you are working behind a proxy, start minikube as:

$ minikube start --docker-env HTTP_PROXY=$http_proxy \
                 --docker-env HTTPS_PROXY=$https_proxy

where $http_proxy is full proxy URI, such as:

comments powered by Disqus