K8s architecture

Josué Carvajal
3 min readDec 6, 2021

In my last article we discussed a little bit about an introduction to Kubernetes components. In this post I’ll be sharing a little bit of its own architecture.

Kubernetes architecture

There are two ways in which we can interact with the K8s API: 1- UI (Kubernetes dashboard) 2- CLI (Kubectl). These two interfaces interacts with the API using a declarative model in which you specify the desired state. In the other hand we have our minions or nodes and also the images registry in which all the images are stored, so the nodes can retrieve the images to update/create new pods.

Image #1. General overview of the k8s architecture

What happens if my nodes die?

One question that arrives in while using clusters is what happens if my node dies or if my master dies? Well, if a node dies it is replaced with a new one, if the master node dies you may want to know that your cluster will not be down it will be like a chicken without a head, everything will be working as expected but your wont be able to use any interface of the API to interact and orchestrate your cluster. But if you faced this problem we have two options: 1- Having other master nodes in the cluster, if our leader dies another one takes its place, it uses the raft algorithm to select the next leader. 2- Having a full backup of our cluster to recover from there. More of this later in other articles

Details of the k8s architecture

Looking a little bit in details we have some important components that we need to know:

Master components (Control plain)

API Server: Here is were both interfaces are connected (UI/CLI) and it uses the raft algorithm to select the next master if the master node dies. It is the brain of the cluster and what get lost when we lost the master

Scheduler: Orchestrates the scheduled jobs in the pods and tracks the resource consumption

Controller manager: Uses control loops and it based on a declarative modes to reach out to a desired stated. There are a few types of managers such has the replica, service and deployment manager.

etcd: It is a highly available database based on key-value store.

Node infrastructure

Container Runtime: In the latest versions of kubernetes it uses dockerd which is the core of docker

Kubelet: It is Kubernetes Agent that connects to the control plane (Master node), requests and monitor resources to run in the nodes and also updates the control plane with the state of the nodes.

Kube-proxy: Load balance in our container to send it to the less loaded node.

Nodes = Minions:

Image #2. K8s Architecture

Thanks for reading!
More content soon!

--

--

Josué Carvajal

Sr. Security software engineer working in the DevSecOps area. CompTIA Sec+, C|EH