Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
Over the decades of its existence, the IT industry gave birth to many operating systems, myriads of programming languages (here is a list of 117 languages, Wikipedia seems to have more) and thousands of ways to configure your company’s tech stack (check out e.g. this 14 Examples of Data Pipelines to see a tip of the iceberg for an average company).
It’s 2019, we have first self-driving cars emerging in mass-market, our cellphones long surpassed computers from the 90s in processing power, VR seems to be at the doorstep. The brightest minds spearheaded the industry to bring joy and order to the world.
So, how about some joy?
We have a huge population of systems that don’t really get along with each other. Sleepless dev-ops engineers are constantly forced to come up with more and more sophisticated ways to make warring technologies start cooperating.
In the past, specialists had to spend hours figuring out how to make two applications with different requirements work on the same server (sure enough, the accounting department would never give money to buy the second server). This seemingly perpetual suffering eventually gave birth to a brilliant idea — virtualization.
Let’s not waste time-solving software compatibility issues. Instead, let’s teach computers to run several operating systems at once to provide a comfortable environment for the execution of any application we want.
The three reasons we love virtualization
- It’s easy to manage operating systems. The advent of virtualization allowed to run a Windows application to manage your warehouse along with a web-based e-commerce application for Linux.
- Enhanced security. Even if the application (say, e-commerce app) is hacked, the hacker will remain inside the virtual machine and still won’t have access to your system. Getting out of such a “sandbox” will be very difficult or even impossible.
- Flexibility in choosing a technology stack. For example, you can hire 30 programmers who write in three different languages. Ten programmers use Java, the other ten use Python and the rest use C sharp. Seem like a problem? Not at all. You just use different virtual machines to run three different parts of one large application on the same server and these parts will work fine together on parts of the common task. Before virtualization, you would need to search for those 30 Java programmers at once and write the entire application in Java. It is much more difficult than finding 30 people with experience in different languages.
However, like everything else, virtualization has its nuance.
The three reasons we don’t like virtualization (and rightfully so)
- It takes up a lot of disk space. You need to have several operating systems installed at once and have enough space for a good bunch of files necessary for work.
- Virtualization eats up A LOT of resources. In order for all systems to work smoothly, the parent OS must run multiple virtual operating systems, interact with each one in real-time and ensure there are no errors. And all this requires a huge amount of processing power. It is like bringing a group of 20 kindergarteners to the beach. You try to make sure everyone is having fun, but also watch out for them so that no one drowns, gets lost or eats a jellyfish by accident.
- The software in the virtual machine runs slow. Large files, limited hardware resources and the need to run a bunch of tasks simultaneously make the parent OS switch between processes more slowly.
These reasons forced the evolution of virtualization technologies and we can now talk about virtual containers.
C for Containerization
Containers allow you to run guest operating systems, but they do it much faster and you won’t need to store large files on disk storage.
The most popular standard container is Docker. With these containers, you can, say, write an application in the Go language, shove it in Debian Linux and run it on a Windows server. The size of the base container will only be 15Mb. The launch and deployment time of such a container will be minimal and it will only take up 1-3% of the additional processing power of your machine.
Why put everything in a container?
Admins and developers took the new approach with a great deal of enthusiasm and started packing everything into containers.
Does it make sense?
Yes, and here's why:
- You can pack stable and predictable code execution environments into containers. Let's say you started rewriting your old Python application v2.7 to v3.7. Parts of the application have already been rewritten, and some — not. We take two containers, pack all the dependencies in both of them. We then take different parts of the code, different versions of programming languages and pack in each container accordingly.Boom! We have two operating containers and everything works fine on the same machine.
- Software no longer crashes or fails after updates. You can now forget it like a bad dream. This will never happen again. I bet it sounds familiar to many of us: you have just updated an important software on the server, it pulled up more updates, and so on. In the end, a lot of things were updated, but your software overloaded and died. Not anymore.
- Performance management is now easier than restarting Windows. Not so long ago you could have 2 containers handling your customers. Now, what did you do when the traffic increased dramatically out of blue? You suffered choking on your own tears. What are you doing now? In one simple move, you deploy ten additional copies of the application and (in seconds) increase the ability of your system to process incoming requests.
So do you have a big infrastructure?
Now imagine that you are running a system consisting of a dozen parts and five servers. That’s what Kubernetes was invented for.
Kubernetes is a container orchestration system that:
- always knows how and when to launch containers and what to do with them later
- enables and disables containers on demand
- changes their number and allows them to communicate with each other
- allows you to scale from a small system to a powerhouse processing millions of requests from users in just a couple of simple moves
Life without an orchestration system is like a cabin with an outhouse and no water supply.
Life with Kubernetes is like a five-star hotel with chic furniture and room service.