What is Kubernetes?
Kubernetes is an orchestration tool that provides many important features like: scaling, scheduling, self-healing, load balancing, cluster management and monitoring to a container solution, usually Docker. “What th-?” If you’re about to say that, this is the right place to learn what Kubernetes truly is about.
Containers, developers and applications
Containers have brought a bunch of fresh air in the world of software programming. It used to happen quite a lot in the past:
- Bob the developer creates his fancy new application(s), everything works fine,
- client is uber-happy about the new applications, bring it NOW!
- Bob transfer the app to its new environment, it doesn’t work.
- Now Bob has to spend more hours trying to get his new app to work.
I have seen this scene too many times during my work as a developer to crack a joke on it. Application environments are hellish. And when the solution is composed of multiple applications/languages/databases it is just a few more meters to hell itself.
Thanks to containers, and especially Docker, developers have been able to define application environments in easy-to-read files and build images upon such files. This process enables developers (and sysadmins) to produce identical environments both on the developer machine and on server. No more Bob/Client situations! But here comes another problem…
So you’ve probably been playing with Docker and containers for a while, deployed it a few times, maybe on few servers. But you soon realize this is time consuming. If you deploy your application on three different servers it may seem easy, but think about deploying your application on one thousand servers! Not so excited anymore?
The problem with Docker is that there’s just the bare minimum to get running. Need to connect containers? There are Docker Networks. Need to store permanent data? There are Docker Volumes. So, let me flip the board. What if you needed to connect two containers on two different machines? And here’s your problem! But, fear not! We’ve also got a solution: Kubernetes.
For the swift-minded ones who might say “Wait a minute Mark! If you need to do that there is Docker Swarm!“. Docker Swarm does (at a higher level) what Kubernetes do, but they have their own set of features and top of all, Docker Swarm is tied to Docker, Kubernetes can be used to manage other solutions like Rocket containers (and maybe in the future LXC).
What can Kubernetes do?
Now that you’re focused on the problem and know what the solution is, let’s see what Kubernetes can actually do for you:
- Cluster management: Kubernetes uses a single machine (either physical or virtual), called Master and many slave machines (again physical or virtual) called nodes. This effectively creates a “container cluster“. This cluster is an abstraction and allows an administrator to orchestrate multiple containers over multiple machines.
- Scheduling: not all machines are born the same. You might want a container to run on a specific machine or a machine that matches specific requirements. This is surely possible when doing things with Docker alone, but it soon becomes tedious. Kubernetes can do this for you by matching machines using user-defined criteria.
- Scaling: thanks to Kubernetes clustering capabilities you can now effectively scale applications (remember, there’s no magic! The application must be written accordingly). Imagine you need a (containerized) web server, now you need two, tomorrow you will need one hundred. You will instruct Kubernetes to create more replicas, and it will spin more of them on multiple nodes. But why would you want to do this?
- Load balancing: sometimes one server isn’t enough, and you can’t just add more RAM or CPUs; that’s what load balancing is for. Kubernates can distribute the traffic over multiple container instances.
- Monitoring and self-healing: your app is running smoothly, until… one container is down. Panic all over the place, in the past you had to fix it manually. Kubernetes is constantly monitoring your containers and is able to detect failures and spin up replacements allowing the application to continue living.
- Networking & Storage: Kubernetes will handle networking and volumes (data persistence) using a modular approach. There are multiple backends available such as OpenVSwitch for networking and Ceph for storage.
Latest posts by mark (see all)
- Developing on Kubernetes: my workflow for taming K8S on Windows - 25 March 2020
- Fedora 32 new features: a bunch of updates - 18 March 2020
- Ubuntu 20.04 LTS new features: Focal Fossa with GNOME 3.36 - 11 March 2020