Browse Courses

Kubernetes Architecture

This document provides an overview of the Kubernetes architecture, including its components and how they interact to manage containerized applications.

This document explores the architecture of Kubernetes, describing the structure and function of clusters, the control plane, worker nodes, and their core components. It covers how Kubernetes manages containerized applications, maintains desired state, and integrates with cloud providers.


Kubernetes Architecture Overview

A Kubernetes deployment is called a cluster, consisting of a control plane (master node) and one or more worker nodes. The control plane manages the cluster state, making decisions and responding to events, while worker nodes run containerized applications.

{{< kroki _type=“mermaid”_name=“diagrams/course/09/02m/004/01-k8s-architecture.mmd” >}}


Control Plane Components

The control plane is responsible for maintaining the desired state of the cluster. It makes global decisions, such as scheduling workloads and responding to cluster events. The main components are:

ComponentDescription
API Server (kube-apiserver)Serves as the front-end for the control plane, exposing the Kubernetes API for communication
etcdDistributed key-value store holding all cluster data and configuration
Scheduler (kube-scheduler)Assigns newly created pods to nodes based on resource availability and scheduling policies
Controller ManagerRuns controller processes to monitor and reconcile cluster state
Cloud Controller ManagerIntegrates with cloud provider APIs, enabling cloud-agnostic operations

The API server is horizontally scalable, allowing multiple instances to balance traffic. Etcd stores the desired and actual state, ensuring consistency. The scheduler selects optimal nodes for workloads, while controller managers ensure the cluster state matches the intended configuration.

Kubernetes Control Plane

Worker Node Components

Worker nodes are the machines (virtual or physical) that run user applications. Each node is managed by the control plane and contains essential services for running containers.

ComponentDescription
KubeletCommunicates with the API server, manages pod lifecycle, and reports pod status
Container RuntimeDownloads images and runs containers; supports pluggable runtimes (e.g., Docker, Podman)
Kube-proxyMaintains network rules for pod communication within and outside the cluster
PodsSmallest deployable unit, containing one or more containers sharing resources

The kubelet ensures pods are running as specified and reports their health. The container runtime handles image management and container execution. Kube-proxy manages networking, enabling communication between pods and external services.


How Kubernetes Maintains Cluster State

Kubernetes uses a declarative model: the desired state is defined (e.g., via deployment configuration), and the control plane works to ensure the actual state matches. For example, when an application is deployed, the configuration is stored in etcd, and controllers act to create or update resources as needed.

{{< kroki _type=“mermaid”_name=“diagrams/course/09/02m/004/02-k8s-control-plane.mmd” >}}

The control plane acts like a thermostat, continuously monitoring and adjusting the cluster to maintain the specified state.


Cloud Provider Integration

Kubernetes is designed to be cloud-agnostic. The cloud controller manager allows Kubernetes and cloud providers to evolve independently, supporting a wide range of infrastructures. Nodes are provisioned by the cloud provider and then managed by Kubernetes.


Summary Table: Control Plane vs Worker Node Components

Control Plane ComponentsWorker Node Components
API Server (kube-apiserver)Kubelet
etcdContainer Runtime
Scheduler (kube-scheduler)Kube-proxy
Controller ManagerPods
Cloud Controller Manager(not applicable)

Conclusion

Kubernetes architecture separates cluster management (control plane) from application execution (worker nodes). The control plane ensures the cluster operates as intended, while worker nodes run containerized workloads. This modular design enables scalability, reliability, and cloud-agnostic deployment of modern applications.


FAQ

The control plane maintains the desired state of the cluster by making global decisions, such as scheduling workloads and responding to events, ensuring the actual state matches the intended configuration.

The API server (kube-apiserver) acts as the front-end for the control plane, exposing the Kubernetes API for all cluster communication.

Etcd is a distributed key-value store that holds all cluster data and configuration, storing both the desired and actual state of the cluster.

  1. API Server
  2. Kubelet
  3. Scheduler
  4. Controller Manager
(2) Kubelet is a component of the worker node, not the control plane.

The scheduler selects the most optimal node for new pods based on scheduling principles, configuration options, and available resources within the cluster.

The kubelet communicates with the API server, manages the pod lifecycle, ensures pods are running as specified, and reports their health and status to the control plane.

Kube-proxy maintains network rules on each node, enabling communication between pods and with external services inside and outside the cluster.

ComponentRole
A. API Server1. Maintains network rules for pod communication
B. etcd2. Assigns pods to nodes
C. Scheduler3. Stores cluster data and configuration
D. Kubelet4. Exposes the Kubernetes API
E. Kube-proxy5. Manages pod lifecycle on worker nodes
A-4, B-3, C-2, D-5, E-1.

The cloud controller manager allows Kubernetes and cloud providers to evolve independently, supporting a wide range of infrastructures and enabling cloud-agnostic operations.

The smallest deployable entity in Kubernetes is a pod, which can contain one or more containers.

True. Pods are the smallest deployable units in Kubernetes and may include one or more containers sharing resources.

The control plane will detect the failure, and may attempt to reschedule pods to other healthy nodes to maintain the desired cluster state.