Kubernetes Architecture.

Yashod Perera
5 min readSep 20, 2021
Photo by Louis Reed on Unsplash

Kubernetes is a container orchestration tool from google and it is the most popular container orchestration tool currently which is provided by most of the cloud service provided as well. There are some more such as Docker Swam, Nomad, OpenShift. It is important to understand the Kubernetes architecture to understand the underline functionalities of it.

There are two kind of terminologies that you need to understand before deep dive to k8s architecture which are nodes and cluster.

  • Node — It is a physical or virtual machine where we deploy our pods. (In k8s we define our deployments as pods. pods and containers are not same). There are two types of nodes which are master nodes and worker node. All the controlling part is done in the master node which is the brain and actual work is done in the worker node which is the muscle.
  • Cluster — Cluster contains multiple nodes which consists of multiple deployments.

Kubernetes architecture contains following main components

  • Api server
  • Schedular
  • Controller manager
  • Cloud controller manager
  • Cluster store (etcd)
  • Kubelet
  • K-proxy
  • Container Runtime

Let’s simplify the k8s architecture using an example. There is a company called ABC and in this company there is a mother company which handles all the operations and there are two factories called Q and P as follows.

There are 5 employees in the mother company (Master Node) naming Asoke(api server), Eric(cluster store), Shikar(Schedular), Collin(Controller manager), Chiran(Cloud controller manager) and there are two operation factories(worker nodes) caller P and Q.

Let’s ask one by one about their roles.

  • Asoke(Api-server) handles all the incoming request to the mother company and pass it to the relevant employee. All the internal commination happen through Asoke.
  • Shikar(Schedular) check the operation factory statuses and check which factory is available for the next task and allocate it or check is there any overloaded work and allocate those work to the other factory or if one factory is having trouble he will take care of it. When Shikar need to assign a task he will give instructions to Kamal(Kubelet) or Kelum(Kubelet) in relevant factory.
  • Collin(Controller manager) Check all the orders that the mother company have and keep track whether those are in processing in and if there is any issue he will inform Shikar(Scheduler) to allocate that task to someone else.
  • Chiran(Cloud controller manager) take care of outsourcing tasks and keep track whether those are on going or else he will inform Shikar.
  • Eric(Cluster store) stores all the company information and provide those to Shikar, Collin or Chiran for decision making.
  • Kamal(Kubelet) responsible for the his operation factory and he will get which process to start.
  • Paul(K-Proxy) responsible for the internal communication of the operation factory and providing communication medium.
  • Rahul(Container runtime) is the process operator who supervise and run all the processors.

Hope this example make sense up to some extends. Kubernetes is like a collection of factories which is mentioned above. Each component in the k8s have its own task.

Let’s go to full explanation.

Api server

  • Api server is the main interface which communicate to the outside world. If we want to do a deployment we need to call api server.
  • All the communication done through the api server. It will expose restful API on port 443.
  • It will handle authentication and authorisation — Work as a gatekeeper.

Cluster store

  • Cluster store stores all the data related to the cluster(nodes, deployments, services etc) and etcd is used to store these data.
  • etcd is a distributed key value store.

Schedular

  • Schedular allocate our deployments in the relevant node.
  • Schedular checks nodes health, resource availability, port availability etc. All these information is retrieved from the cluster store.
  • As given in the above example when the schedular gets a deployment it will check nodes resource availability which is in the cluster store and decide which node to use for the next deployment.

Controller manager

  • This will watch all the desired deployments and current deployments with the help of cluster store. If there is any mismatch controller manager will inform the schedular to do the deployment.

Cloud controller manager

  • This will check the deployments in the cloud service providers such as google, amazon or azure which does the same task as controller manager.

Kubelet

  • Kubelet is the main agent in every worker node and it will act as the Api server for the worker node as well.
  • This will interact with the container runtime and instruct about the deployments which receives through the Api server.
  • Report the node and pod state to the master node.

Container runtime

  • Container runtime is responsible of pulling imagers from container registries such as docker hub, ACR, GCR and run those.
  • There are many container runtimes such as docker, containerd etc.

K-Proxy

  • K-proxy responsible for local networking and communication between pods through the load balancer.

In the next post we will talk about pods and how to do a deployment.

If you have found this helpful please hit that 👏 and share it on social media :)

--

--

Yashod Perera

Technical Writer | Tech Enthusiast | Open source contributor