Docker vs Mesos vs Kubernetes
Comparing Docker vs Mesos vs Kubernetes
DevOps introduced a new and progressive way to work, which has evolved over time. The product runs deployments using container technology, where you can bundle applications as well as their dependencies together. Any platform can run these packages, irrespective of the infrastructure beneath. It is very efficient to handle a few containers running simultaneously, but what would you do if you have to handle thousands of containers at the same time without impacting their working?
It is important to handle all the deployments within containers seamlessly. As a result, managing them is crucial. Container orchestrators play a key role here. Container orchestration engines enable us to manage these containers across any platform. This article will focus on Docker Swarm, Mesos, and Kubernetes, their differences, and how to choose.
What are Container Orchestration Engines?
All of the containers including Kubernetes, Swarm, and Mesos belong to the DevOps infrastructure management tools class that is also known as the Container Orchestration Engines (COEs). These engines work as an abstraction layer between the resources and the containerized applications running using those resources.
These COEs help in providing a solution to bind all the resources from the data center in a single pool. The pool can be used for deploying various applications, including single applications and large scale ingestion and processing of data.
Each tool comes with a variety of feature sets but we will share some of the high-level features mentioned below.
- Container scheduling is responsible for various functions like to start and stop the containers; to distribute the containers amongst the pooled resources; help in recovering the failed containers; and rebalance them from failed hosts to running ones, and to scale various applications via containers. You can do it either manually or automatically.
- High availability ensures that the containers and the orchestration tools are highly available.
- Health checks allow checking the health of the container or application.
- Service discovery ensures that various services and applications are available faster. Distributed computing makes this possible by storing data over a network.
- Load Balancing the incoming requests, whether it is generated internally within a cluster, or externally via outside clients.
- They help in attaching various storage types (network, local) for containers in a cluster.
The orchestration engine provides quite a few additional functionalities other than the above-mentioned features. Below is the graph showing how the interest for the orchestration tools has changed over the years.
Docker vs Mesos vs Kubernetes
1. Docker Swarm
In 2015, Docker released Swarn as its native Container orchestration engine, written in Go language. It is available in version 1.12 and is the recommended version for using Swarm. You can use Swarm with Docker seamlessly as Swarm is well integrated with Docker API. The primitives that are used for a single Docker host can also be used with Swarm, which helps in managing the infrastructure of containers. In such a way, there is no need for configuring a separate orchestration engine for using Swarm.
Swarm is based on the YAML-based deployment model that uses Docker Compose. Apart from this, Swarm also helps in auto-healing the clusters, overlay networks with DNS, ensure high-availability with the help of multiple masters, and many more.
But, Swarm does not come with the support of native auto-scaling or provide external load balancing feature. If you want to scale, you need to do it manually or with the help of third-party solutions. However, Swarm supports ingress load balancing but if you want to do external load balancing, you need help from third-parties.
- Managers: it is an acting control layer that should be redundant in your architecture. Each manager needs an individual node for its deployment.
- Discovery: it is the state and service discovery layer. You are allowed to set up your discovery services within the manager nodes or in independent node sets. Try to make these manager nodes redundant.
- Worker: it is the major part where all your end-services will run along with your worker nodes. You can add as many workers you require at this layer. This layer represents horizontal growth.
- Services: this layer will deploy the task and services.
- Workloads: These are defined as the docker containers and commands contained in a service.
Docker Swarm already had the support for running the dockerized container on Linux environment. But, in February 2017, Swarm added support for running the Dockerized container on Windows systems as well.
Docker Compose files are being used for defining the Docker Swarm services. These files are YAML-based and also used to bring up containers on a single machine that can also be run on several machines in Swarm.
Swarm uses a DNS service that helps for the service discovery by their name. You can use the ingress mode for exposing the services. In the ingress mode each host maps to the same port to a running service in Swarm.
In July 2016, Mesos version 1.0 was released. But it was earlier discovered by PhD students at UC Berkeley. Mesos is written in C++, making it different from other container orchestration engines. It is based on a distributed approach for managing the data center and cloud resources. On mesos you can run multiple masters that use Zookeeper for tracking the state of the cluster among various masters.
You are allowed to run other container management frameworks on the top of Mesos that includes even Kubernetes and marathon. Also based on Apache Mesos is Mesosphere DC/OS, which is a well-known distributed datacenter OS. Mesos uses a modular approach to manage containers, giving users more control over scalability and the type of applications they can run.
Mesos is capable of scaling up to thousands of nodes and is used by big companies like Twitter, eBay, and many more. Apart from this, Apple also has a proprietary framework that is based on Mesos called Jarvis that powers Siri.
Some of the most important features are its support for several container engines, running multiple OSes, and providing an interactive web UI. It is easy to learn and understand, showing a steeper learning curve compared to the other COEs.
- Master: it is a control layer that manages every container task.
- Slaves: it handles all the workload and handles the deployment of every service.
- Service discovery: it ensures the service discovery services using the Mesos-DNS or Marathon-lb features.
- Load balancing: it uses the Marathon-lb HAproxy-based load balancer for balancing the workload in case of any failure.
- Constraints: these are some restrictions that provide a way for fine controlling the deployment of the applications.
- Metrics: it helps in monitoring information and providing them using the REST API to third party components.
- Applications: these are the deployed services, PODS
- REST API: these are the functions running using Mesos/Marathon REST calls.
Mesos can be used to run different applications like Kubernetes. On Mesos, you can directly run containers. Nevertheless, if you want a better working workflow for deploying applications inside containers, you will need to use a container-centric application such as Kubernetes.
Mesos ensures service discovery using the third-parties help. Mesos may not be able to provide service discovery on its own, but applications running on it, such as Kubernetes, might be able to.
In June 2014, Google launched Kubernetes, written in Go language. It is an open-source project based on the container running experience with a wide and strong community managing it. Kubernetes is extensively supporting Docker as its container engine. Its deployment model is YAML-based, which helps in scheduling the containers on various hosts along with many other features.
Some of the major features of Kubernetes are auto-scaling, load balancing, management of volume of data, and secret management. Apart from this, you also get a web UI that allows you to manage and troubleshoot the cluster. Thus, Kubernetes can run on its own without the need for third-party support. Kubernetes uses services like Swarm, while Mesos uses pods.
You can even configure Kubernetes master as a high available cluster. Kubernetes shows a steeper learning curve making it easier to install and configure than other COEs. Thus Kubernetes is the most opted container orchestration engine in the market.
- Master: it is the base of this orchestrator that allows you to run and expose the Kubernetes API. This API handles all the management tasks.
- Discovery Layer: it is an etcd-based key/value store where you can register all your components. Your etcd services will use the same hosts as your Kubernetes master.
- Nodes/Minions: most of the workload will run here. The services and pods will run inside the nodes.
- Labels and Selectors: it helps in defining the way for organizing your objects. Apart from this, it also specifies how replication controllers and replica sets know to manage which pod.
Kubernetes has a base unit called pod which consists of one or several containers. You can schedule containers to run on the same host where they can communicate with each other using the loopback interface. It helps in updating the set of containers. All the resources of Kubernetes are defined in the configuration files, written in YAML or JSON formats. You can use the Kubernetes command “kubectl” for sending the config files to the Kubernetes cluster.
Kubernetes comes with a DNS cluster, providing service discovery service. You can expose the running services using various methods including internal only, HTTP ingress, a node port running on every machine, or mapping to the external load balancer running on various cloud platforms.
Its most important derivative works are OpenShift Origin by RedHat and Tectonic platforms by CoreOS. These projects are based on Kubernetes and have offerings from its community.
** features are being optionally provided by software or applications running on top of Apache Mesos.
There is no doubt on the importance of container technology in the DevOps process. It has benefitted many companies with its implementation. Running and managing large projects on complex infrastructure has become easy for developers. All this is possible due to container technology and various container orchestration engines.
The three widely used container orchestration engines have been mentioned in this article with all features and functionalities, providing you a complete sight of which COE to use and when.