Docker For Mac Kubernetes

Docker For Mac Kubernetes
  • (Note that Docker Desktop does have support for Kubernetes built in, but it is an older version of Kubernetes, and limited to a single node cluster.) You can be up and exploring Kubernetes on Mac within 10 minutes, with all the advantages of an API managed, immutable, secure Kubernetes OS.
  • Downloading and installing Docker for Mac For now, Kubernetes is only available on Docker for Mac 17.12 CE Edge (special Docker version for new and experimental features), so make sure you install the Edge version. On your Mac, double-click the Docker.dmg file and begin the installation process as instructed.

The Docker Desktop installation includes Docker Engine, Docker CLI client, Docker Compose, Notary, Kubernetes, and Credential Helper. Install and run Docker Desktop on Mac Double-click Docker.dmg to open the installer, then drag the Docker icon to the Applications folder.

The Docker team announced support for running Kubernetes using the Dockerfor Mac application. For a while, it was only available on unstable Edgereleases of the Mac application.

Docker for Mac’s Kubernetes cluster is now available in the stable release channel! 🎉

This makes running Kubernetes for local development somuch easier. You no longer need to install and run a separate cluster usingsomething like Minikube. (Though, if you need to, I have a guide on installingMinikube on your Mac.)

It's available on Docker Community Edition version 18.06.0-ce-mac70 2018-07-25 or later.

Setting up kubectl with Docker for Mac Kubernetes

Setting up kubectl to use Docker for Mac is simple.

  1. If you don't already have kubectl installed, the easiest way is with Homebrew.

    brew install kubernetes-cli

  2. Install the most recent version of Docker for Mac, one that includes the Kubernetescluster functionality.
  3. Click the Docker menu bar icon > Preferences, then click the Kubernetes tab. Click the checkboxto enable Kubernetes and switch the default orchestrator to Kubernetes. Docker might take a fewminutes to install more components here.
  4. Docker for Mac will start the Kubernetes cluster. Once it’s running,click the Docker menu bar icon again and expand the Kubernetes menu item. Then under Context, selectdocker-for-desktop. This will switch kubectl to the docker-for-desktop context.
  5. Run kubectl config current-context in a Terminal window. It should output docker-for-desktopif kubectl’s context has updated.
  6. If you’re curious, you can also see the configuration settings that kubectl uses to connect to Docker for Mac’s Kubernetes cluster. Run kubectl config view to outputall your available kubectl contexts. (I have a chapter in my book that explains kubectl config in detail)

Running your first Kubernetes pod with Docker for Mac

Once you’ve set up kubectl to use Docker for Mac’s Kubernetes cluster,you can run your first pod!

Docker For Mac Kubernetes Is Starting

Create a file called pod.yaml containing the following YAML configuration.

Now run the pod, and then check its status as it gets run on Docker for Mac’s single node cluster

Does this replace Minikube?

I’d expect Minikube to stick around for a while—it’s a much more stable and matureimplementation of a single-node Kubernetes cluster that you can run locallyon your Mac. But Docker for Mac is a great, simple way to run a simple cluster on your local machine. Plus, the Docker menu bar icon gives you a new, fast way to switch kubectl contexts.

MacStadium's Orka brings modern, orchestration and containerization solutions Kubernetes and Docker to Mac-specific CI. We understand that most native iOS and macOS developers have likely not had much exposure to these powerful tools, as they have historically not been able to run on Mac. But that has all changed with the introduction of Orka. Now, teams that focus on dev for iOS and macOS have access to this powerful tech.

Why Docker:

Docker has emerged as the dominant containerization solution in the software world. It is so popular because it offers coherence between the respective development and production environments for a given project. This means that the same code will run regardless of where it is physically because Docker provides a constant environment across machines in which to run code. Historically, to achieve a similar outcome, teams have used VMs (virtual machines). However, while an excellent choice for many applications, VMs are inherently complex, and thus present a greater technical debt for the average team to overcome. Conversely, Docker containers are relatively simple to manage and require less overhead to run.

Why Kubernetes:

Kubernetes is the leading, open-source, orchestration engine for managing multiple containers, such as those that Docker provides. Kubernetes provides a framework to run distributed systems – i.e. those that are bundled up into a series of containers – resiliently. It isn't just for production, though. Kubernetes is an excellent tool for managing containerized code that needs to be run in concert with other containers. In short, it just makes life easier.

Docker For Mac Kubernetes Commands

Key Concepts:

Containerization – the practice of isolating code in a known and preservable environment, so as to ensure it will run as intended anywhere it ends up.

Orchestration – the practice of coordinating multiple computational resources for a common high-level purpose, although they may not all be doing the same work, but rather sub-portions of the same whole.

Node – distributed systems work in different ways, but inevitably there is the concept of a series of computational resources that are doing the work, naturally enough these are called “nodes,” “workers,” and sometimes “slaves” as well. In Orka, a node is a single, physical Mac Pro within the greater cluster. Kubernetes then facilitates communication between the various nodes, and further, the various Docker containers housed within a given node.

Docker For Mac Kubernetes

Image file (*.img) – a configuration file that defines a VM, complete with its own operating system. These are commonly used to re-make a given environment time and again for the sake of consistency during continuous integration (CI).

Further Reading:

Orka Docs – Kubernetes Reference is a nice overview of Kubernetes features and functionality. Particularly helpful in sussing out the nuances of using Kubernetes on a Mac.

Docker For Mac Kubernetes Not Starting

The Children’s Illustrated Guide to Kubernetes – a fun, easy, informative introduction to guiding principles of Kubernetes.


An Introduction to Kubernetes, by Justin Ellingwood, is a great bet if you’re ready to get started with Kubernetes in earnest, and you are looking for a stepping off point.

The Kubernetes Docs – the ultimate source of truth for all things Kubernetes.

Docker For Mac Kubernetes Ingress