Kubernetes changed everything about how we deploy applications. Yet many people struggle to understand the essence of Kubernetes. I’ve assembled the 10 most important things I believe everyone should know about Kubernetes.
1. Kubernetes vs. k8s
The cool kids abbreviate Kubernetes with “k8s” which stands for, you might have guessed it, Kubernetes. Simply drop the eight (8) letters between the first letter “K” and the last letter “s”, et voila.
2. Google, Kubernetes, and the Cloud Native Foundation
Google open-sourced Kubernetes in 2015 and partnered with the Linux Foundation to create the Cloud Native Computing Foundation. Kubernetes was the first project at the Cloud Native Foundation. Kubernetes is licensed under the permissive Apache 2.0 license.
Kubernetes was not made out of thin air. Its design is based on a container orchestration technology called Borg, to this date being developed and used internally at Google.
3. Kubernetes killed YARN, Mesos, and Docker Swarm
Kubernetes was not the first of its kind. Before Kubernetes came out, there were other cluster management systems in the open-source:
- Apache Hadoop YARN (Yet Another Resource Negotiator)
- Apache Mesos (incl. Marathon)
- Docker Swarm
It is fair to say that Kubernetes superseded all of these systems. The reasons are manifold but to summarize: Mesos tried to be platform for solving all kinds of problems including fine-grained resource allocation and non-containerized applications. YARN was too tightly integrated into the Hadoop ecosystem. On other hand, Docker Swam was much like Kubernetes in the sense that it focused on container deployments but it lacked too many features that Kubernetes came with out-of-the-box.
4. Kubernetes manages containers
Kubernetes focuses on managing container deployments in a computer cluster, including their communication with each other. Think of a container as a portable and reproducible instance of a software environment including its dependencies.
Typically, the container format used is the Docker container format. More formats like containerd are supported and new ones can be plugged in as needed using Kubernetes’ Container Runtime Interface (CRI).
Kubernetes smallest operational unit is a Pod. Pods hold one or more containers. Usually Pods are not created by hand but by so called Deployments.
5. Kubernetes is declarative
Kubernetes takes a different approach than many other systems when it comes to creating the desired deployments.
Instead of specifying how the application should be deployed, users specify what should be deployed. Kubernetes then ensures that the declared requirements are met. Some examples of what can be declared:
- A container image and its startup arguments
- Minimum / maximum resources such as CPU, memory
- Number of instances to create
- Volumes to be mounted
- Environment variables or configuration
- Ports to communicate with other services
- Credentials or secrets to be loaded
All this is specified via YAML. There is no code involved. Previously, one had to write code to achieve this (infrastructure as code), but with Kubernetes infrastructure is data. We have shifted from “how” to “what” and leave the rest to Kubernetes.
6. Kubernetes is fault-tolerant and self-healing
Over time, failures are inevitably in computer clusters. Failures can occur due to hardware issues but also due to software bugs or upgrades.
Kubernetes is designed to continue to work in the presence of failures. From Kubernetes’ point of view, a failure is just a deviation of the declared specification. Kubernetes will simply strive to restore the desired state.
To be able to do that, Kubernetes replicates its own state. By doing that, it can tolerate failures of its own nodes. It implements health checks on nodes and containers to be able to tell apart a healthy from an unhealthy entity. If a container is detected to be unhealthy, it will be removed and a new version of the container will be started.
7. Kubernetes is ubiquitous
A major reason for the success of Kubernetes is its availability in the modern cloud. All the major cloud providers (Amazon AWS, Microsoft Azure, Google Cloud) have managed Kubernetes offerings. Kubernetes can easily be integrated with the storage and networking implementations of any cloud provider.
Since Kubernetes is available in many cloud offerings, there is little to no vendor lock-in.
8. Kubernetes comes with batteries included
Kubernetes comes with powerful abstractions but it’s not only a tool for experts. It has been built with decades of practical experience in cluster deployments in mind. It includes proven, easy-to-use recipes for working with containers, storage, configuration, secrets, service discovery, networking, etc.
9. Kubernetes is extensible
Besides the included resource types, Kubernetes allows to create custom resource types and custom operators which help to realize the resource specifications.
For example, if you were to run an application on Kubernetes that required custom state management which cannot be expressed by Kubernetes deployments, you could define your own resource type alongside with an operator which creates this custom resource. Oftentimes, the operator can compose this new resource in terms of the included Kubernetes resource types, which allows to write an operator with relatively little code.
10. Kubernetes is efficient
Kubernetes is great at ensuring efficient resource usage. It has built-in load balancing which is able to balance load across all containers associated with a deployment.
Kubernetes packs its computing nodes with containers such that the containers and their computing needs maximize the utilization of each node. It regularly performs de-fragmentation by migrating containers to other nodes in order to achieve maximum utilization.
Kubernetes provides resource isolation and resource usage limitation by leveraging the container options for resource limits for CPU or memory (via Linux’s cgroups).
Thank you for reading this post. I hope I could shed some light on Kubernetes. If you found the article helpful, please send it to a friend or feel free to share it on social media.
If you want to learn more about Kubernetes, the official Kubernetes docs are a great place to start: https://kubernetes.io/docs/