K8S definition: Kubernetes

In short
  • Kubernetes is an orchestrator that constantly maintains a desired state.
  • It compares the status of objects to its database and corrects any discrepancies.
  • An ecosystem with an API and objects that interact with each other.
  • Quick to learn, slow to master; relevant to various IT skills.

What is Kubernetes?

Kubernetes logo

Click the image to enlarge.

It is a container orchestrator (but potentially extensible to other formats). It continuously ensures that a desired execution state is maintained for a set of resources.

It monitors different objects by comparing their status to a desired state expressed in a database. If any discrepancies are detected, Kubernetes (or K8S) will constantly strive to bring the system back into compliance with the required configuration.

It is also a development and deployment ecosystem, providing an API and a list of objects designed to interact with each other.

Kubernetes allows for both application execution and management of their associated lifecycle.

How does Kubernetes work?

Logical organization

Kubernetes works with the concept of logical objects.

Each object is described and can be manipulated via an API, which includes different branches. These branches represent trees in which these various objects are found.

Example of K8S objects

Click the image to enlarge.

Each object performs a function within the cluster. These objects interact with each other and can be linked through labels.

Example of relationships between objects

Click the image to enlarge.

Each object has a scope of interaction; some are limited to a specific namespace, while others can span the entire cluster.

Each object has its properties, some of which are mandatory and others optional. These objects can be described in YAML files or executed directly from a CLI or SDK.

Manipulation of these objects is subject to access controls based on roles (RBAC or Role-based access control), allowing for fine-grained control over possible actions within the cluster.

An application will be represented by a set of objects, which, once implemented, can enable its proper functioning and exposure.

The API has native objects, but it can be extended with third-party objects that often add a branch to the API and allow for other functions within the cluster.

Composition

Kubernetes relies on a modular composition.

K8S utilizes various components, most of which are in the form of containers, that have specific roles within the cluster.

These components can be distributed across different servers, physical or virtual, and some may be replicated to provide high availability for the associated service.

Among the core modules, you'll find the API, the scheduler, the control manager, and others.

These basic components are usually hosted on the same machine and constitute what is called a control plane.

In production environments, you will find multiple control planes (or masters) working together and sharing the management of the database that hosts the cluster configuration. (Most often, we talk about the etcd solution and a key/value model).

In addition to these control planes, there are execution servers, historically called workers.

These servers contain fewer components, at least one agent named kubelet. These servers are responsible for executing the assets and are managed by the control plane(s). They can be easily added (and removed) to extend the cluster's capabilities if necessary.

K8S architecture

Click the image to enlarge.

The redundancy of applications is directly handled by the cluster, because if a worker fails, its assets will be automatically rescheduled to be re-executed on another node, provided that sufficient resources are available and the remaining nodes are compatible.

It is important to note that each component of a Kubernetes cluster is configurable and adaptable. You should see K8S as a collection of open-source components, with a basic implementation being communicated and recommended, but each can assemble them as they see fit and rewrite the associated code.

Similarly, these components, while enabling the construction of a cluster, are generally not sufficient to offer all the expected features in a production environment.

It is common to extend the cluster with specialized add-ons in certain areas, such as networking or storage, to enable other services within the cluster (flow filtering, load balancing, persistent storage...).

To this end, K8S provides standards that simplify the development of its add-ons and ensure their support by the cluster.

These add-ons can extend the API with new objects.

The choice of the container runtime engine remains with the IT teams. Kubernetes does not execute containers directly, but rather orchestrates runtimes that are compatible with its supported formats.

This modular design, which is extensible thanks to established standards, allows Kubernetes clusters to be deployed in a variety of environments.

Some vendors offer an assembly of these components with automated versioning and addon management, adding support for businesses. This is then referred to as a Kubernetes distribution.

It is also common to rely on installation tools, some of which are officially developed with the core modules, such as kubeadm.

When implementing a cluster using the default configuration, combining minimal modules with their default settings, we refer to this as a Vanilla installation.

Some components can be reviewed and adapted for more specific uses, offering optimized clusters designed for specific execution platforms, such as IoT.

Finally, the major public cloud providers all offer a "Kubernetes As A Service" solution, which usually aims to hide the complexity of managing the control plane.

In most cases, whether it's a Kubernetes distribution (such as OpenShift), a Vanilla installation, an adapted cluster (such as k3s), or a cloud offering (such as AKS), there is a minimum level of compatibility for applications developed on these platforms, simplifying migration or redeployment operations.

Example of a Kubernetes solution

Click the image to enlarge.

CI/CD logic and acquired skills can be applied to any platform based on Kubernetes, making K8S one of the most effective solutions for building hybrid infrastructures.

It should be noted that it is perfectly possible to use a single server, whether virtual or physical, to support all of the Kubernetes components. You will have a node that functions as both a control plane and a worker. This is obviously not a production solution, but it is very useful for development or training, especially through solutions like minikube

Personal notes

Kubernetes is more than just a simple container orchestration infrastructure. Its origins lie with Google, which made its own asset management solution public for use in its products.

Subsequently, it underwent community-driven development through the Cloud Native Computing Foundation. This foundation is managed by The Linux Foundation, making Kubernetes one of the largest open-source projects in the world.

It features a cloud-oriented logic with a modular construction derived from development and microservice architectures (but not only).

The focus is on availability and scalability.

Over the years (Kubernetes celebrated its 10th anniversary in 2024), K8S has been enriched with a rich and constantly evolving ecosystem. New uses have been associated with it.

A standardization has emerged around it, allowing for hybrid architectures and the use of different clusters hosted within various providers, both internal and public.

Its extensible and easily manageable API has enabled the emergence of many tools, both for monitoring, security, and CI/CD.

CNCF landscape

Click the image to enlarge.

While there are competitors, these alternatives, although equally performant and functional, often struggle to compete, and are frequently relegated to specific use cases.

Like any technology, Kubernetes is not magical. It comes with its own set of drawbacks, such as a complexity that can sometimes be perceived as high, with concepts that may seem "surprising" at first, like the pod, a difficult-to-follow pace of evolution, and marketing hype that is sometimes excessive.

However, its growth and importance cannot be denied. It is a fantastic product with which you can build many things. The important thing is to always align your implementation with your needs.

It is better to master its final architecture rather than chasing the latest trendy implementations: driving a Ferrari has never been the most practical way to go down to the shop for bread, especially if you don't have a license.

Kubernetes can be learned quickly, but it takes time to master. It is also a platform that aims to be versatile across IT skills. You will find many infrastructure principles there, such as SDN (Software-defined networking) or (SDS Software-defined storage), deployment strategies like Canary release or Green/Blue, and application architecture models like microservices.

Therefore, it is necessary to combine skills, reduce silos between teams (without necessarily trying to dissolve them), and above all, emphasize common sense and team spirit in order to successfully implement a Kubernetes project.