Skip to main content
  1. Posts/

Kubernetes for developers: The basics

·3 mins
Kubernetes Backend Architecture Devops
Clément Sauvage
Author
Clément Sauvage
I like to make softwares

In this article about Kubernetes, we’ll hover the main concepts in Kubernetes and the most important details you should know as a developer to use it. I attempt to avoid concepts that would not be as important for the developers as for the Dev-ops or the infrastructure architects.

What is Kubernetes #

Kubernetes, a.k.a K8s, is one of the most popular open source containers orchestration tool. It was originally developed by Google, but was then delegated to the Cloud Native Computing Foundation.

With the rise of microservices, the usage of containers is also growing, which means that applications now are composed of dozens, hundreds if not thousands of containers. We need Kubernetes to orchestrate our architecture efficiently. Some of the main issues solved being the application availability (with multiple replicas for example) or the scalability (scaling up and down is easier).

By using Kubernetes, your architectures also become more agnostic to the platform it is deployed on. For instance, there would be very little, if no different in deploying your applications with Kubernetes on AWS EKS, Azure AKS, or GC GKE.

All these tasks are made easy to execute on Kubernetes, since they would be extremely laborious to do with simple home-made scripts.

Kubernetes architecture #

As Kubernetes is the tool to orchestrate your whole architecture, the big picture of it, is a set of machines that communicate together to host the applications and the configurations. The machines are called nodes, and the set of all the nodes is called a cluster.

In a cluster, there is at least one control plane, which is connected to all the nodes. Its role is to be the interface to interact with the cluster.

Kubernetes components #

Kubernetes base architecture
Kubernetes base architecture

In the above schema from the Kubernetes doc, we can identify the following components:

  • Nodes are either physical machines or virtual machines. The are the infrastructure on which will be ran the containers

    • kubelets are agents running on each nodes. They are responsible to maintain the desired states of the containers of their node, and communicate these states to the control plane.
    • kube-proxies are network policies running on each nodes. They allow network communication of the pods to each others inside of a cluster.
  • The Control plane is centrale to the cluster as it makes global decisions to orchestrate it. It can be ran on any machine in a cluster, but as its availability is prime to keep acess to the cluster, a best practice is the run it across multiple machines.

    • The API server is the component that expose the cluster with a RESTful API for communication with various components of the system.
    • The scheduler is the component that allocate newly created pods to a node. It makes it possible to balance the cluster workload, allowing applications to run and scale smoothly.
    • The etcd is simply a highly available key-value store for the cluster’s data.
    • The kube-controller-manager is a central component running multiple controller processes like the node controller which monitor the state of the nodes, or also, the job controller, which is responsible for the jobs executions.