Kubernetes Architecture - CKA

Kubernetes Architecture - CKA

Kubernetes is a powerful open-source platform for managing containerized applications. It provides a way to deploy, scale, and manage applications across multiple clusters of computers.

In this blog post, we will explain the architecture of Kubernetes. We will also discuss the different components of Kubernetes and how they work together.

Kubernetes Architecture

The Kubernetes architecture consists of two main components: the control plane and the worker nodes.

Control Plane / Master Node

The Control Plane is the brain of the Kubernetes cluster. It manages the overall state of the cluster and is responsible for making global decisions about the cluster, such as scheduling, scaling, and responding to cluster events.

  • API Server: The API server is the front door to the Kubernetes cluster. It is responsible for receiving and processing requests from clients.

  • Scheduler: The scheduler is responsible for assigning pods to worker nodes. It considers factors such as resource availability and affinity rules when making its decisions.

  • Controller Manager: The controller manager is a set of controllers that are responsible for managing different Kubernetes resources. For example, the replication controller is responsible for ensuring that a desired number of pods are running for a given application.

  • etcd: etcd is a distributed key-value store that is used to store the state of the Kubernetes cluster.

Worker Nodes

Worker Nodes are the machines where the actual application containers run. Each node contains the following components:

  • Kubelet: The kubelet is a process that runs on each worker node. It is responsible for communicating with the control plane and managing pods on the node.

  • Kube-proxy: The kube-proxy is a process that runs on each worker node. It is responsible for managing the network for the pods on the node.

  • Container Runtime: The container runtime is a process that is responsible for running containers on the worker nodes. There are several different container runtimes that can be used with Kubernetes, such as Docker and containerd.

Node is just like a VM in which we have installed the components of each role as per the cluster.

The flow of the diagram is as follows:

  1. The user types a Kubectl command in the terminal.

  2. The Kubectl client sends the command to the Kubernetes API server.

  3. The Kubernetes API server processes the command and sends it to the appropriate component.

  4. The component completes the task and sends the results back to the Kubernetes API server.

  5. The Kubernetes API server sends the results back to the Kubectl client.

  6. The Kubectl client displays the results to the user.

How Kubernetes Works

When you create a Kubernetes resource, such as a deployment, the API server receives the request and stores it in etcd. The scheduler then assigns the deployment to a worker node. The kubelet on the worker node creates the pods specified in the deployment. The kube-proxy configures the network for the pods. The container runtime starts the containers in the pods.

Difference Between kubectl and Kubelets

  • kubectl: kubectl is the command-line tool used to interact with the Kubernetes API server. It allows users to manage Kubernetes resources, deploy applications, and inspect cluster resources. Essentially, it acts as the user interface for communicating with the cluster.

  • kubelet: The kubelet is a component that runs on each worker node in the Kubernetes cluster. It ensures that the containers specified in the PodSpec are running and healthy. The kubelet communicates with the API server to receive updates and report the status of the node.

The Role of the API Server

The API server is a critical component of the Kubernetes Control Plane, acting as the front-end for the Kubernetes control plane. It exposes the Kubernetes API, which is a RESTful interface used by all other components to communicate with each other and by external users to manage the cluster. The API server handles all the requests, validates them, and then processes them by updating the etcd store or dispatching the necessary tasks to other components, such as the scheduler or controller manager.

Follow me on Linkedin.