Introduction

A kubernetes cluster is collection of physical or virtual machines and other infrastructure resources that are needed to run your containerized application.

A machine in a cluster is called a Node. There are two node types:

  • Master nodes (control plane).
  • Worker nodes.

K8s manages the state of the cluster from the control plane. The control plane has various components that make the current state of the cluster is the same as the desired state.

Kubernetes components

Control Plane or Master Node

Control plane

The components of the control plane are:

  • Kube-API server
  • Etcd
  • Controller Manager
  • Kube scheduler

Kube-API Server

Exposes the kubernetes API that allows external components and users to interact with the cluster. It also validates and processes requests, then updates the corresponding object state in etcd.

etcd

A distributed key-value store that stores the configuration data of the cluster. It uses the Raft consensus algorithm for consistency across the cluster.

Controller manager

A loop that watches the state of the cluster via the API server and ensures that the current state and the desired state match. It also runs controller processes responsible for handling tasks like node and replication controller management.

Kube scheduler

Assigns pods to nodes bases on the resources availability and constraints. It continoulsy monitors the cluster for chanes and makes choices to optimize workload distribution, improving the efficiency of the entire cluster.

Cloud controller manager

This is an optional component of the Kubernetes control plane. It integrates with the cloud provider APIs to manage resources specific to a particular cloud platform, such as load balancers, storage volumes, and networking.

Worker nodes

These are the Node components that run in every node in the cluster.

Worker node

The components are:

Kubelet

An agent that ensures containers are running in a Pod. It talks to the API server and is responsible for managing resources on the node it’s running on. Communicates with the container runtime using the container runtime interface.

Kube-proxy

A network proxy that handles client requests that are coming in from the external load balancer.

Container runtime

Used to run containers. Supported runtimes are containerd, CRI-O and other implementations of Kubernetes CRI (Container Runtime Interface)

Connection between control plane and worker nodes

  • The kubelet in worker nodes, communicates with the kube-api server. When a new node is added to the cluster, the kubelet informs the kube-api server of it’s resources and checks if there are workloads that need to be placed.

Components of a Kubernetes Cluster

  • Kube-proxy monitors changes that happen to Servive objects and their endpoints. It translates these changes to network rules inside the node effectively managing netwrok rules and routing traffic.