Kubernetes, Docker Swarm, and Apache Mesos are 3 modern choices for container and data center orchestration.
Both Kubernetes and Docker Swarm support composing multi-container services, scheduling them to run on a cluster of physical or virtual machines, and include discovery mechanisms for those running services.
Apache Mesos is designed for data center management, and installing complex applications such as Kubernetes on top of data center resources.
Let’s take an in-depth look at each of these orchestrators.
Kubernetes 1.0 was released in in June 2015 with a consortium of companies backing its development, including: Google, RedHat, CoreOS, and many others. Kubernetes is available for free as open source software.
Kubernetes supports different container runtimes, including Docker and rkt. Initial support for Windows Hosts and running Docker Containers for Windows was added in version 1.5 in December 2016.
The base unit of deployment in Kubernetes is called a Pod, which consists of one or more containers. All of the containers in a pod are scheduled onto the same host and can communicate with each other over the localhost loopback interface. This is a unique concept to Kubernetes and allows for atomic updates of a set of containers.
Kubernetes resources are typically defined in configuration files, which can be written in the YAML or JSON formats. The kubectl command line tool is then used to send these configurations to the Kubernetes cluster.
Kubernetes includes an optional DNS cluster add-on that allows for service discovery by name. Services can be exposed in a number of ways, including internal only, HTTP ingress, a “node port” on each machine, or mapped to an external load balancer on supported public/private cloud platforms.
Two notable derivative works are RedHat’s Openshift Origin and CoreOS’s Tectonic platforms. Both projects are based off of Kubernetes and have commercially supported offerings.
Docker Swarm initially shipped as part of the Docker Engine in version 1.12, released in July 2016. Docker Swarm is free to use in the Docker Community Edition and commercial support is available as part of Docker Enterprise edition offered by Docker, Inc.
Docker Swarm supports Docker Containers running on Linux. Support for running Docker Containers for Widnows in Swarm mode was added in February 2017.
Docker Swarm services are defined using Docker Compose files. The same compose file that is used to bring up a group of containers on a single machine can be run across many machines in Docker Swarm. This file is specified in YAML.
Docker Swarm includes a DNS server out of the box that allows for service discovery by name. Services can be exposed using ingress mode, where each host will map the same port to a service running in the Swarm.
The Apache Mesos kernel runs on every machine in a data center and abstracts away the physical and virtual resources of the machines. It provides resources to applications that run on top of it, such as Hadoop, Spark, Kafka, Elasticsearch, and Kubernetes.
Mesos is designed to run other applications on top of it, including Kubernetes. It is possible to run containers directly on Mesos, but choosing a more container-centric application to run on top of Mesos such as Kubernetes will provide better workflows for deploying containerized applications.
The Mesos project does not natively support service discovery, nor is this a desired feature. There are third party projects that attempt to solve this. However, the real power of Apache Mesos is the fact that it runs other software such as Kubernetes or Docker Swarm. So while Apache Mesos does not natively support service discovery, the applications it runs certainly can.
Which is the Best?
- Support provided by third part vendors or external software packages
** Functionality optionally provided by software that runs on top of Apache Mesos
Like most things in life, the best orchestrator depends on your use case.
Kubernetes is a powerful and highly extensible orchestrator, but it is also challenging to setup. Kubernetes is a great option if advanced features and rock solid container orchestration are a requirement.
Docker Swarm is dead simple to setup – it takes just one command. Swarm is not as extensible as Kubernetes; however, this doesn’t matter for most applications. Docker Swarm is a great option if simplicity and the ability to scale existing Docker Compose services are a requirement.
Apache Mesos is best suited for data centers where multiple complicated applications will need to be setup and configured. Mesos is a great option if multiple Kubernetes clusters are required within the data center.