This is a step-by-step guide to installing and running Kubernetes on your Mac so that you can develop applications locally.
You will be guided through running and accessing a Kubernetes cluster on your local machine using the following tools:
The only pre-requisite for this guide is that you have Homebrew installed. Homebrew is a package manager for the Mac. You’ll also need Homebrew Cask, which you can install after Homebrew by running
brew tap caskroom/cask in your Terminal.
Install Docker for Mac. Docker is used to create, manage, and run our containers. It lets us construct containers that will run in Kubernetes Pods.
Install VirtualBox for Mac using Homebrew. Run
brew cask install virtualbox in your Terminal. VirtualBox lets you run virtual machines on your Mac (like running Windows inside macOS, except for a Kubernetes cluster.)
Skip to step three if everything has worked to this point.
kubectl for Mac. This is the command-line interface that lets you interact with Kuberentes. Run
brew install kubectl in your Terminal.
Install Minikube via the Installation > OSX instructions from the latest release. At the time of writing, this meant running the following command in Terminal…
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.27.0/minikube-darwin-amd64 &&\ chmod +x minikube &&\ sudo mv minikube /usr/local/bin/
Minikube will run a Kubernetes cluster with a single node.
Everything should work! Start your Minikube cluster with
minikube start. Then run
kubectl api-versions. If you see a list of versions, everything’s working!
minikube start might take a few minutes.
You’ve installed all these tools and everything looks like it’s working. A quick explanation of how the components relate is needed.
kubectlis the command line application that lets you interact with your Minikube Kubernetes cluster. It sends request to the Kubernetes API server running on the cluser to manage your Kubernetes environment.
kubectlis like any other application that runs on your Mac—it just makes HTTP requests to the Kubernetes API on the cluster.