Docker Swarm or Kubernetes?
Docker Swarm and Kubernetes are very popular nowadays. I’ve used them both for a while now and I came with neat metaphor to compare them. Docker Swarm is like Nokia 3310 and Kubernetes is more like new and blingy iPhone X10plus.
Nokia 3310 or iPhone X10plus?
In the world of mobile phones it’s kind of easier to look at differences between two mentioned devices.
The first, and the most important thing, is that both will allow you to make calls and text. One has smaller screen but it doesn’t really matter when you talk. right? Big screen, FaceID and step counter isn’t really improving the quality of your calls. Long lasting battery is nice as you need to look at your battery bar approximately one every month to keep it running.
On other hand FaceID makes your phone more secure (probably) and having full access to the internet and all the apps you can imagine makes life so much easier nowadays. The price to pay is the knowledge. To effectively use any smartphone you need to know how to configure internet connection, where in menu is camera and what is the best app to manage your inbox.
This is in my opinion the difference between Kubernetes and Docker Swarm – both are doing their job, one in simple way where you’re up and running in no time and second being superior in functionality but requiring a lot of knowledge to really leverage the benefits.
Let’s start with the Nokia of container orchestration 😉 It’s plain and simple and if you use docker-compose and building docker images, even for Kubernetes, you basically know how to use it straight away. There is just a few new terms to learn. For example service and stack and that they represent app instance and the whole app with dependencies. That’s it. You can now take you docker-compose file used for development and use it to run your app on production (nearly).
With simplicity you have access to config and secret objects inside docker. Those solve the production configuration and secret management issues you can face. If you haven’t heard of them it’s two pages of read and you’re ready to go.
In the same time the spectrum of tooling for Docker Swarm is very good. There is a tool available for all the common tasks like monitoring, UIs for cluster management etc. You can use ingress-like service in docker to keep your services secure but it require a bit of work with designing where your apps will be and how they will communicate.
Just like with Nokia, with Docker Swarm you have all the functionality you may need for dealing with containers on production. You can’t play Candy Crush in the same time but if you go camping you should be alright without 10 power banks.
Now we’re in impossible is nothing category. Kubernetes architecture is IMO amazing and allows you to implement any type of topology for your applications. Pods, deployments, services to manage instances, all powerful RBAC to manage permissions in the cluster, crons, batch jobs, everything you’d think about while using normal bare server but all you need to do is to call REST API endpoint.
With great set of features comes great learning curve so It takes some time to understand how the abstraction of pods and services translates to running your application. Consequently different format of manifests is another thing you need to learn. Then we need additional services running in the background you need to be aware of. Therefore it’s a lot of knowledge and it takes time to learn. In addition keep in mind that you need to keep up with changes as features are coming and going. Today’s monitoring solution may be outdated next week and you need to learn about yet another abstraction in few days.
The flexibility of Kubernetes is immense and when you have time and resources to set it up is worth every penny. It has it’s price as you probably need a team of devops to run it effectively. It’s way harder to run with one developer having one hour a week to look at the infrastructure.
So who wins? Kubernetes or Docker Swarm?
Both are winning but in different categories.
First of all if you want to run it for cheap and with knowing just docker it’s Docker Swarm. I’d say it great for small to medium setups and when you don’t have time and resources for Kubernetes. Also if you’re like me, mostly developer and less ops, and ease of use is worth more than 5000 features I’ll never use.
If you have time and resources got for Kubernetes. Hands down it will make your life way easier on daily basis for the upfront cost of setting up. Be aware tho that Kubernetes is designed to deal with very large deployments so if you have one app on one server I’d say it may be overkill.
In short both solutions are great. Both do their job. One does just the basics. The other will allow you to do basics and order dinner in the same time. Therefore the choice is yours if you better like Docker Swarm or Kubernetes. It always depends on what you do and you should choose the best tool to solve your problems. Not to solve your problem with one tool.
For personal projects I’ve chosen Docker Swarm as it’s simpler and cheaper to run. Kubernetes requires quite a lot of resources to run while Docker Swarm can run on a calculator and all resources are on your disposal.
Let me know in the comments what do you think about this comparison and what’s your experience with those two tools.