What Are Orchestrators, and How Do They Relate to Docker?
When you are deploying containerized applications, it’s just a question of time until you ask yourself: “should we use an orchestrator?”. But what is an orchestrator anyway?
The Short Version
Container orchestrators are tools that helps you with managing your running containers. They take care of the busywork for you.
Here’s an example: you tell your orchestrator “I want 2 containers based on image X running at all times”.
The orchestrator starts paying attention, and takes action to make your wishes become reality. If no containers are running it will start 2 new ones. If there are 3 running, it will stop one of them.
Reconciliation Engines
At the core, an orchestrator is a reconciliation engine. It’s a fancy term, for a tool which was provided with a description of how reality should look. It then periodically (or on-demand) checks what the world looks like and performs actions to make it look more like the goal state it was provided with.
Reconciliation engines can be spotted in many places. Terraform is a reconciliation engine. Ansible is one. Kubernetes (a popular orchestrator) is one as well.
Not Just Containers
You might have noticed that I went with “container orchestrator” instead of just “orchestrator” in the explanation above.
That’s because orchestrators are not just for containerized applications.
Orchestration is a quite generic task at its core. Some tools are really focused on a single technology, like containers, others are flexible. Kubernetes for example can orchestrate VMs instead of containers with minimal effort.
Docker & Orchestration
Docker is a container engine. It has jobs it’s responsible for, and orchestration is not one of them.
Which is a good thing! Personally, I’m a big fan of having specialized tools, which do one thing and do it really well.
Eventually, Docker Swarm was added to Docker, but apart from the bundling effort it’s a separate tool. You can use Docker without Swarm, and you’ll be fine.
Why An Orchestrator?
Here’s how the folks from Docker define orchestrators this way:
Tools to manage, scale, and maintain containerized applications are called orchestrators […]
They become useful once you want to distribute your workloads across multiple physical machines, without reinventing all kinds of wheels for yourself.
Orchestrators can make the tasks needed to run containers at scale easier. They provide means to connect, configure and monitor your containers across multiple machines without reinventing the wheel. You can also use an orchestrator (like Kubernetes) on a single node as well. It can bring benefits, if you’re ready to accept a bit more complexity and learning curve.
You don’t need to use an orchestrator to deploy containers though!
It’s fine not to use any of that fancy stuff if you just want to deploy your Docker containers! Docker-compose might be enough. Especially if your app runs fine on a few servers.
What Orchestrators Are There?
A whole bunch! Let’s stick to the ones somewhat-popular for containers.
Here are the ones I’m aware of at the moment, sorted by personal preference:
- Kubernetes (and its many managed/extended incarnations)
- Nomad
- Docker Swarm (whose future is more uncertain than not)
- AWS ECS
They all differ when it comes to the ease of getting started, their complexity, the liveliness of their ecosystem and the usecases they shine at.
Benefits Of Using Kubernetes
If you’re interested in a more detailed information on what an orchestrator like Kubernetes can help you do, this page in the docs is a good read.
Here’s an excerpt of the benefits, which can be had by using Kubernetes from that page:
- Service discovery and load balancing
- Storage orchestration
- Automated rollouts and rollbacks
- Automatic bin packing
- Self-healing
- Secret and configuration management
You see, it’s a lot of things which are really useful when deploying containers, especially if there are a bunch of them. The self-healing part comes due to Kubernetes being a reconciliation engine. Everything else is very useful container-handling glue.
In Conclusion
I hope this article helped you get a high-level understanding of what orchestrators are.
They can be useful. They are not strictly necessary for small deployment. They come at a price (complexity and learning curve being the most expensive ones). However, the ecosystems around orchestrators can be a good-enough reason to start using one! There’s lots of value to be had, especially with Kubernetes.
If you’re interested in getting started with Kubernetes in particular, check out this selection of resources I have compiled for it.