Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Swarm vs. Kubernetes: Which One Should You Learn?

blog/cards/docker-swarm-vs-kubernetes-which-one-should-you-learn.jpg

Both tools allow you to manage a cluster of servers that run 1 or more services on them. Let's go over both.

Quick Jump: What Does Swarm and Kubernetes Let You Do? | Pros and Cons of Docker Swarm and Kubernetes | Playing with Docker Swarm and Kubernetes

As developers we often find ourselves doing a lot of “vs.” comparisons. Vim vs. Emacs, Sublime Text vs VSCode, tabs vs. spaces, Ruby vs. Python and Chrome vs. FireFox. It never ends.

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:

Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single, virtual host.

Kubernetes:

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.

Docker Swarm

  • 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.yml files 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.

Kubernetes

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.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.


Comments