Kubernetes - Architecture

In this chapter, we will discuss the basic architecture of Kubernetes.

Kubernetes - Cluster Architecture

As seen in the following diagram, Kubernetes follows client-server architecture. Wherein, we have master installed on one machine and the node on separate Linux machines.


The key components of master and node are defined in the following section.

Kubernetes - Master Machine Components

Following are the components of Kubernetes Master Machine.

etcd :-

It stores the configuration information which can be used by each of the nodes in the cluster. 

It is a high availability key value store that can be distributed among multiple nodes. 

It is accessible only by Kubernetes API server as it may have some sensitive information. 

API Server :-

Kubernetes master has an "API Server" which provides all the operation on cluster using the API. 

API server implements an interface, so that different tools and libraries can readily communicate with it. Ex:- Kubeconfig.

Kubeconfig is a package that can be used for communication. It exposes Kubernetes APIs.

Controller Manager :-

This component is responsible to regulate the state of cluster and sends information to API server.

It gets the shared state of cluster and then make changes to bring the current status of the server to the desired state

In general, it can be considered as a daemon which runs in infinite loop and is responsible for collecting and sending information to API server. 

It has different kinds of controller. The key controllers are replication controller, endpoint controller, namespace controller, and service account controller

The controller manager runs different kind of controllers to handle nodes, endpoints, etc.

Scheduler :-

It is a service present in master for distributing the workload among nodes.

It always tracks the workload on cluster nodes and then place the workload on which resources are available. In other words, this is the mechanism to allocate pods to available nodes. 

The scheduler is responsible for workload utilization and allocating pod to new node.

Kubernetes - Node Components

Following are the key components of Node server which are necessary to communicate with Kubernetes master.

Docker :-

The first requirement of each node is Docker which helps in running the application in containers in an isolated and lightweight operating environment.

Kubelet Service :-

This component is an agent service that executes on each worker node. It ensures that the pods and their containers are running smoothly. 

Every kubelet in each worker node communicates with the master node. It also interacts with etcd store to read configuration details and write values.

It also starts, stops, and maintains the containers which are organized into pods directly by the master node.  It manages network rules, port forwarding, etc.

Kubernetes Proxy Service:-

This is a proxy service which runs on each node and  helps in forwarding the request to correct containers and is capable of performing primitive load balancing. 

It makes sure that the networking environment is predictable and accessible and at the same time it is isolated as well. 

It manages pods , volumes, secrets, creating new containers, health checkup, etc.

Pods :-

A pod is a combination of one or more containers which logically execute together on nodes. One worker node can easily execute multiple pods.

Kubernetes - Master and Node Structure

The following illustrations show the structure of Kubernetes Master and Node.