Skip to content

Kubernetes cluster with Docker for Mac

Syed Sayem edited this page Mar 29, 2019 · 1 revision

This is a step-by-step guide to installing and running Kubernetes on your Mac so that you can develop applications locally.

 

Table of contents

 

Pre-requisite

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.

 

Requirements

Docker for Mac is the current release of Docker for OSX. Requirements:

  • Mac must be 2010 or new model with Intel's hardare support for memory management unit (MMU, virtualization, and Unrestricted mode.
  • OSX El Capital 10.11 and newer releases are supported.
  • Virtualbox prior to version 4.3.30 must NOT be installed. It is incompatiable. Use a newer version.

 

Install Docker for Mac (Manually)

Docker for Mac can be downloaded here.

 

Install Docker Toolbox

You can use Homebrew and Homebrew Cask to install Docker Toolbox which is a collection of useful docker tools such as docker-compose, docker-machine and Kitematic.

$ brew cask install docker       # Install Docker
$ open /Applications/Docker.app  # Start Docker

You can find more about docker follow the documentation here.

 

Starting Docker

If everything works, you should have the following commands available:

$ docker info
Containers: 0
Running: 0
Paused: 0
...
$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01
docker-machine --version
docker-machine version 0.16.1, build cce350d7

 

Troubleshooting

If you get an error like the one below, you might need to start the Docker daemon.

$ docker info
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

To start the Docker daemon, it probably needs one of these commands

open /Applications/Docker.app  # macOS
sudo systemctl start docker    # Arch, Ubuntu, CentOS

 

Enabling on startup

For Arch Linux, Ubuntu and CentOS, this will enable auto-starting of the Docker service:

sudo systemctl enable docker

 

Docker Toolbox Quick Start

For quick start find the Docker Quickstart Terminal and double click to launch it. Then you start the hello world container using:

$ docker run hello-world

top  

Enable Kubernetes in Docker for Mac

Kubernetes is not enabled by default. To enable it, click on the Docker icon, go to Preferences | Kubernetes, select the Enable Kubernetes checkbox and hit Apply.

After a few minutes, Kubernetes will be enabled, as reflected by the green statuses at the bottom of the preferences dialog.

top  

Clone this wiki locally