No history yet

Kubernetes Architecture

The Control Plane: Kubernetes' Brain

At the heart of any Kubernetes cluster is the control plane. Think of it as the central nervous system that makes all the decisions. It's not a single machine but a collection of processes that work together to maintain the desired state of your applications. When you interact with your cluster using a tool like kubectl, you're talking directly to the control plane. It's responsible for everything from scheduling your applications to responding when a server fails.

The control plane's main job is to constantly check the cluster's current state against the state you've requested, and then work to make them match.

This orchestration is handled by four key components working in concert: the API Server, etcd, the Scheduler, and the Controller Manager. Let's look at each one.

API Server The API server is the front door to the control plane. Every single request to view or change the state of the cluster goes through it. It exposes a REST API that lets you query and manipulate Kubernetes objects like pods, services, and deployments. The API server authenticates and validates requests, and then retrieves or updates the corresponding data in etcd. It's the only component that talks directly to etcd, acting as a gatekeeper for the cluster's state.

etcd If the control plane is the brain, etcd is its memory. It is a highly-available, consistent key-value store that holds all cluster data. This isn't just configuration; it's the single source of truth for the entire cluster's state at any given moment. This includes everything you've configured (the desired state) and the observed status of all running resources (the actual state). Because of its critical role, etcd is designed for reliability and is typically run as a redundant cluster itself.

Scheduler The scheduler has one specific job: it decides which worker node should run a newly created pod. It's an intelligent matchmaker. When a request to create a pod comes in, the scheduler finds the best possible home for it based on a variety of factors. These include the pod's resource requests (CPU and memory), any policies you've set (like keeping certain pods apart), and the current resource usage of each node. The scheduler simply decides on the placement; it doesn't actually run the pod.

Controllers Controllers are the workhorses that turn your requests into reality. Kubernetes runs a master process called the controller manager, which manages various individual controllers. Each controller is responsible for a specific resource and runs a continuous "reconciliation loop." It watches the API server for changes, compares the desired state with the actual state, and takes action to close the gap. For example, if a deployment specifies it needs three replicas of a pod but only two are running, the replication controller will notice and create a third. If a node goes offline, the node controller will mark it as unhealthy and begin moving its workloads.

The Worker Nodes

While the control plane makes the decisions, the worker nodes are where your applications actually run. These are the physical servers or virtual machines that provide the computing, memory, and storage resources for your containers. Each worker node in the cluster is managed by the control plane and runs a couple of essential processes to do its job.

The primary component on every worker node is the kubelet. It's the bridge between the node and the control plane.

Kubelet

noun

An agent that runs on each worker node in the cluster. It ensures that containers described in PodSpecs are running and healthy.

The kubelet is the local agent for Kubernetes on each node. It receives pod specifications (called PodSpecs) from the API server and ensures that the containers described in those specs are running and healthy. It doesn't manage pods that weren't created by Kubernetes.

In addition to the kubelet, each worker node also runs a container runtime (like Docker or containerd) which is responsible for pulling container images and running the containers. A third component, kube-proxy, manages network rules on the node, enabling communication to your pods from inside or outside the cluster.