Are you torn between the major container orchestration tools out there? We compare Kubernetes, Docker Swarm, and Amazon ECS to see which one comes out on top.
Container Orchestration: A Quick Introduction
Primitive container technology has been around since the late 1970s but didn’t become prominent until Docker debuted in 2013. From that point, containers have exploded in popularity; dramatically changing the DevOps landscape and the way we build, ship, and run distributed applications. It’s no coincidence then that Docker’s growth and container usage are developing in synchrony.
However, running a single container is like a lone musical instrument playing its symphonic score in isolation. Container orchestration allows you, the conductor, to unify the orchestra by managing and shaping the sound of the whole ensemble.
Container orchestration tools offer useful and powerful solutions for creating, managing, and updating multiple containers in coordination across multiple hosts. On top of that, orchestration allows you to share data between your services and process tasks asynchronously. Within your production environment, you can run multiple instances of each service over multiple servers to make an application highly available. The more we simplify orchestration, the deeper we can dive into the application and break down smaller microservices.
Which raises the question, which tool do you pick to conduct your symphony?
In this article, I’ll be comparing the three major players in container orchestration to help you choose the right one for you.
Container orchestration relies heavily on your infrastructure, meaning it is important to look at how these solutions integrate with your current cloud provider/on-premise solution. Are you willing to buy into one cloud provider’s entire toolchain? Or do you need something more agnostic?
Kubernetes is emerging as the current leader in the container orchestration space, surpassing Docker Swarm thanks to its configurability, reliability, and large community. Created by Google as an open-source project, Kubernetes works harmoniously with the whole Google Cloud Platform. Plus, it runs well on almost any infrastructure.
Swarm is Docker’s own orchestration tool which is now fully integrated with Docker Engine and makes use of the standard API and networking. Built into the Docker CLI, Swarm Mode requires no additional installation and new Swarm commands are easy to pick up. Deploying a service can be as simple as using the ‘docker service create’ command. Docker Swarm is fighting back against Kubernetes for the lead in the popularity race by making strides in performance, flexibility, and simplicity to gain renewed adoption.
Amazon Elastic Container Service (ECS) is Amazon’s proprietary container scheduler and designed to work in harmony with other AWS services. This means that AWS centric solutions like monitoring, load balancing, and storage integrate easily into your service. If you are using an alternative cloud provider to Amazon—or if you are running your workload on-premise—then ECS is probably not a fit.
Developed from 15 years of working with Linux containers, Kubernetes (abbreviated to K8s or Kube) is Google’s open-source answer to container management. It works in multiple production environments including bare metal, on-premise VMs, on most cloud providers, plus combinations/hybrids of all three.
Clusters include several major components:
- Pods: A group of one or more containers that are created, scheduled, and deployed together on the same node.
- Labels: The key-value tags (e.g., the names) assigned to identify pods, services, and replication controllers.
- Services: Services give a name to a group of pods, acting as a load balancer to direct traffic to running containers.
- Replication controllers: A framework responsible for ensuring that a specific number of pod replicas are scheduled and running at any given time.
Kubernetes installation is the most complex out of all three, but the process is simpler with the right tools. For integration with existing orchestration systems or bare metal environments, kubeadm works well. Helm is a popular tool that streamlines installing and managing Kubernetes applications. One of Kube’s major advantages is that you have ultimate control over its configuration, and more common platforms have plenty of documentation to support your tailored setup. On top of that, Kubernetes has a vast community of users and resources to tap into for support on Slack, StackOverflow, and GitHub if you encounter any problems.
At its core, Kubernetes has the power and capability to do anything you want, though it’s complex to deploy, manage, and achieve what you want in comparison to Docker Swarm.
Docker Swarm extends single-host Docker, allowing developers to quickly and easily deploy multiple containers and microservices. Of the three tools, it’s the most lightweight and easiest to transition to as it’s already built-in to Docker Engine.
Swarms are a cluster of nodes which comprise of:
- Manager nodes: Control orchestration, cluster management, and the distribution of tasks.
- Worker nodes: The sole purpose of workers is to run containers and services as assigned by a manager node.
- Services: A service describes how you’d like an individual container to distribute itself across your nodes. To create a service, specify the exact information as in an ordinary ‘docker run’, plus new parameters (i.e., # of container replicas).
- Tasks: Single containers place work within these “slots” according to the Swarm manager.
Swarm is great for people just starting with containers or who don’t need to configure every little detail. Most importantly, Swarm allows you to scale your containers to dramatic numbers with ease.
Swarm Mode installation requires no special effort as it’s already a part of Docker Engine. The feature comes as standard starting with version Docker 1.12 and above. Check out our recent blog post on Creating a High Availability Docker Swarm on Amazon Web Services to see how easy it is to setup your own Swarm.
Elastic Container Service (Amazon ECS)
AWS’s own container management service, Amazon ECS is a Docker-compatible service which allows you to run containerized applications on EC2 instances and is an alternative to both Kube and Swarm.
While Docker has won everyone over with its simplicity, Amazon ECS is a comparatively complex tool as you have to learn a whole new platform. Components within ECS consist of:
- ECS clusters: Groups of EC2 instances which run tasks.
- Task Definition: A text file, in JSON format, which includes much the same information as a ‘docker run’ command. Plus, details including which containers should run on on one host.
- Service: Your tool for running and maintaining specified numbers of task definition instances across your cluster.
- Service Scheduler: Keeps watch over running tasks and makes sure that the correct number is up. Plus, the feature reschedules tasks if they have failed.
- Container Agents: This feature allows you to connect your cluster instances to your container.
Amazon ECS provides maximum value for those looking for seamless integration between containers and other AWS services. It’s a fully managed service which offers high availability, scalability, and security. On top of that, your AWS support plan includes it as standard.
Plus, if you are already on AWS, there is no need to install any extra software to operate your cluster.
Ultimately, choosing the right container orchestration tool comes down to what your priorities are. Taking into account what technology you need it to work alongside.
Are you tied to AWS? It might make sense to use ECS over Kubernetes, and vice versa if Google Cloud is your provider. Are you most keen on configurability and willing to labor over complexities for your perfect service? Kubernetes should be your platform of choice. (Especially given the recent major announcement coming out of re:Invent 2017. EKS is AWS’ new managed Kubernetes service, fully compatible with ECS. Not only is EKS pure vanilla upstream Kubernetes—and as such should work with existing tools and applications out of the box—it paves the way for a fully hosted solution on AWS in the future.)
Though alternatively, if you love the Docker CLI and don’t want to fuss around with new tools, stick with the simplicity of Docker Swarm. Bear in mind though, in 2017, Docker also announced forthcoming support for Kubernetes.
So, perhaps the conquering container orchestration platform is clear already…
Post-script February 2019: It’s all about Kubernetes from here on. Check out our great content on the champion container orchestration tool in the following blog posts:
- Spotlight on Kubernetes
- The Kubernetes Networking Model
- Best Practices for Kubernetes’ Pods
- Working with Microservices & Kubernetes
Caylent provides a critical DevOps-as-a-Service function to high growth companies looking for expert support with microservices, containers, cloud infrastructure, and CI/CD deployments. Our managed and consulting services are a more cost-effective option than hiring in-house, and we scale as your team and company grow. Check out some of the use cases, learn how we work with clients, and profit from our DevOps-as-a-Service offering too.