Docker Swarm vs. Kubernetes: Which One Should You Learn?
Both tools allow you to manage a cluster of servers that run 1 or more services on them. Let's go over both.
And now, you’re probably wondering if you should learn Docker Swarm or Kubernetes.
In this article I’m not going to recommend 1 over the other, but I do enjoy breaking down technologies, using them, thinking about them and reflecting on what I’ve learned.
What I learned over the years is there’s no better way to figure out if you should learn something by just trying it out, so this article will cover a tiny bit of theory / comparisons, and will guide you on how you can quickly try both out for yourself using high quality free learning material.
What Does Swarm and Kubernetes Let You Do?
Here’s how both tools describe themselves.
Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single, virtual host.
Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
Both tools help you deal with things like load balancing, service discovery and rolling restarts (so you can deploy your apps without down time).
But those are all “features”. At the end of the day, both tools let you deploy 1 or more services onto a cluster of servers. Then, you can operate on that cluster instead of individual servers.
It’s basically allowing you to daisy chain a bunch of servers together and pool all of the resources together. Then tools like Docker Swarm and Kubernetes internally figure out where your services should run on the cluster to maximize each server’s resources.
Of course, you could always step in and tell them where you want your services to run too (if you had special high CPU servers for CPU intensive tasks, etc.), but that’s not really important for now. The takeaway is, these tools let you configure that.
And all of above put together is what container orchestration is.
Pros and Cons of Docker Swarm and Kubernetes
I could talk your ear off on comparing the differences between both of them but there are plenty of articles that do that already.
Instead let’s only talk about very high level pros and cons because you’re going to learn a lot more about which one you should use after the next section of this article.
- A lot easier to install and reason about
- Built into the official Docker CLI
- More lightweight and has less moving parts
- Compatibility with
docker-compose.ymlfiles out of the box
- As a container scheduler, it’s losing to Kubernetes in features and popularity
- Less sophisticated web UIs vs. Kubernetes for the open source version
Don’t worry, Docker won’t be ditching Swarm. At DockerCon17, Docker announced that they will offer Kubernetes as an official scheduler, but they still use Swarm for other components of their managed platform.
- Has first class managed solutions available on Google Cloud, AWS and Azure
- More mature due to being out longer (v1.0 came out in July 2015)
- Lots of public success stories using the open source version of K8s (Kubernetes)
- More building blocks and primitives to use in your deployments (such as auto scaling)
- You need to wire up more things yourself to get functionality that Swarm provides
- Use of external conversion tools to get
I mentioned Kubernetes having a managed solution on the 3 big cloud providers but you can also install it on any server you want (just like you can with the open source version of Docker Swarm). I just wanted to clear that up.
Which One Should You Learn?
My honest advice is to try them both out. Not only will you get a solid understanding of how container orchestration works but the skills you learn from one can be carried over to the other, so learning the 2nd one will be much faster and could be beneficial to the other.
You may even decide to use neither because Docker Compose works in production too.
Playing with Docker Swarm and Kubernetes
Spewing a bunch of facts and opinions is nice and all, but in my opinion, the best way to figure out if you should learn something is by playing with it.
You won’t really know how it works, or if you’ll like it or not unless you get your hands dirty and run things on your own. This is why my Dive into Docker course has over 30+ labs and challenges. They are there for you to practice what you learn.
Anyways, my course doesn’t cover Swarm or Kubernetes (it’s more focused on the Docker fundamentals), but lucky for us there’s a lot of free learning material on both Docker Swarm and Kubernetes straight from the people who made them.
They are not super in depth, but that’s not their goal. The goal here is to get familiar with using the technology and seeing if it meshes well with your brain, and for that, they are great.
Getting Started with Docker Swarm
Docker put together a tutorial that exercises using a few components of Docker Swarm and by the end, you will have successfully performed a rolling update on a service to experience a zero down time deploy on a cluster of servers.
Getting Started with Kubernetes
I highly recommend following this tutorial from start to finish to get a taste of using Kubernetes. It covers a few examples and you’ll successfully scale a service on a cluster of servers. It covers quite a bit of ground.
Did you try them out? Which one did you like best? Let me know below.