Docker Swarm vs Kubernetes

How do they differ from each other, and pros and cons.

Containerisation has changed how we work with micro-services and deploy software. If you’re new to containers, here is a blog post to get started.

What’s container orchestration?

Containers basically packages services into one unit which you can deploy anywhere you like — local machine, test environment or production systems. In a production environment, you cannot pile up containers on one machine, because it’ll run out of capacity. You need multiple machines (also called nodes) to be running in a cluster (i.e networked and talking to each other) and deploy these containers to them. Now the question is, If I have multiple nodes / machines running in my cluster. Where do I deploy my container to? You would tell the orchestration software to deploy a container and it takes care of the rest.

Orchestration software generally takes care of :

Which is the best machine should I deploy this container to? Best machine can mean — the machine that’s most free of resources right now. It can also mean container with more memory, if you’re deploying a memory intensive service — for example, Redis.

If machine fails, It should automatically deploy the containers which were deployed on that machine to a new machine.

If a new machine is added to a cluster. Balance the containers to new machines without disrupting the service.

If a container fails, auto restart it.

…and more.

Now that you’ve understood why you need container orchestration. Let’s look at two most popular choices out there and see how they compare with each other.

Docker Swarm

Swarm is the native clustering engine by and for Docker. Any tools, services or software that works with containers with Docker run equally well in Docker Swarm. Here are few pros and cons about Docker Swarm.

Pros:

Ease of use. “Just works” user-experience,

Zero single-point-of-failure architecture,

Secure by default with automatically generated certificates,

Backwards compatibility with existing components.

Open Source

Cons:

Early in development / launch cycle. We do not recommend using Docker Swarm for business critical applications. It will be more mature with time.

Simple with limited features.

Kubernetes

Kubernetes is an production-ready, enterprise grade, mature orchestration platform by Google. Few things about Kubernetes :

Pros:

Its production ready and enterprise grade. Its been used by a lot of companies in production at scale.

It’s more mature than Docker Swarm.

Can be used on public, private, hybrid, multi-cloud

Modular.

Self-healing: auto-placement, auto-restart, auto-replication, auto-scaling

Open Source

Can be used for any architecture deployment because its modular.

Cons:

Difficult to set-up. If you’re not using a cloud provider like Azure, Google or Amazon. Its hard to set Kubernetes up on your cluster. Most of the cloud providers have one click install which works seamlessly.

Steeper learning curve than Docker Swarm. It does not use the Docker CLI.

CloudBoost uses a 60 node kubernetes cluster in production. We’re a server-less platform + backend as a service (BaaS) which helps developers build apps in half less time by taking care of all the mundane tasks like Authentication, Notifications, Emails, Managing and Scaling your Database, Files, Cache, and a whole lot more. We use MongoDB and Redis clusters for data store and NodeJS powers most of our micro-services. CloudBoost is completely open source under Apache 2 License, so you can modify it the way you like and install it on your own servers for free. You can check out our GitHub here : https://github.com/cloudboost/cloudboost (Pull Requests are a LOT appreciated!)

We also have a Docker Cloud / Compose file here which you can use to install CloudBoost on any cloud or machine you want.

If you want to check out how we use Kubernetes in production. You can read the blog here:

If you want to quickly launch a cluster to host non-critical apps and get started fairly quickly then we would recommend using Docker Swarm. If you’re doing anything that’s even close to being business critical — Kubernetes is the platform you should consider working on.