Kubernetes (k8s) Architecture

Gal Ilinetsky
CodeX
Published in
3 min readMar 14, 2023

--

Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.

How Does k8s manage and deploy containerized applications?

In order to understand that let's go over a few concepts:

  1. Cluster: A set of nodes.
  2. Node: a virtual or physical machine that use to run pods, we have two types of nodes: worker and master.
  3. Pod: the smallest deployment unit in Kubernetes. Host one or more containers and provides shared storage and networking for those containers.

A Kubernetes cluster consists of one master node and several worker nodes. The worker nodes are responsible for running pods that run containers and doing any work assigned to them by the master node. The master node looks after:

  • scheduling and scaling applications
  • maintaining the state of the cluster
  • implementing updates

Master Node

Also, Know as the control plane is made of 4 components:

  • API Server: This is the entry point to the cluster, it exposes a RESTful API that allows clients to interact with the master and submit requests to manage the cluster, such as getting information about the cluster nodes, and pods, or deploying new pods.
  • Controller Manager: Responsible for running controllers that manage the state of the cluster. For example, it monitors the cluster and checks whether a node needs to be repaired or restarted, or if the desired number of replicas of a pod are running.
  • Scheduler: Responsible for pod placement on the worker nodes based on several factors: the information about resources required by the pod and available resources on the worker nodes.
  • etcd: It’s a distributed key-value store. It stores the cluster’s persistent state at any given time (health state, available resources, configuration information) of any node in the cluster. etcd snapshots allow us to recover the whole cluster state, hence it is used in backing up and restoring a cluster.

Worker Nodes

The worker nodes are responsible for deploying the pods, and pulling the images needed for the containers they will run on the pods. They have 3 main components:

  • Kubelet: An agent that runs on each node in the cluster. Responsible for communicating with the master, it receives instructions about which pods to run on the node and ensures that the desired state of the pod is maintained.
  • Container runtime: Responsible for running containers, and pulling the container images from the registry. starting and stopping the container and managing its resources.
  • Kube-proxy: Acts as a network proxy for routing traffic to the appropriate container based on the IP and port number of the incoming request, and supports the service abstraction. It can do primitive load balancing.

Eventually, it looks something like this:

Fun Fact: It is called k8s as a nerdy way of abbreviating long words. The number 8 in k8s refers to the 8 letters between the k and s in Kubernetes.

--

--

Gal Ilinetsky
CodeX
Writer for

Software Engineer, .net development focus. Here to share my knowledge on points of view on software development fields I take interest in.