Deep Dive into Kubernetes Architecture: How the Pieces Fit Together

M ChidrupM Chidrup
4 min read

Why Kubernetes Architecture Matters

Kubernetes isn't a single application; it's a distributed system composed of loosely coupled components. These components work in unison to manage application lifecycle, resource allocation, networking, and health monitoring.

The architecture is logically split into:

  • Control Plane – The brain of Kubernetes

  • Data Plane – The muscle that executes instructions (the Worker Nodes)


Control Plane (The Brain)

The Control Plane is responsible for maintaining the desired state of your cluster. It includes several components:

1. API Server

  • Central access point for the cluster.

  • Validates and processes REST requests (like kubectl commands).

  • Stores the cluster state in etcd.

2. etcd

  • A key-value store that holds the entire state of the Kubernetes cluster.

  • High availability and consistency are crucial.

  • It stores data like node info, config maps, secrets, and Pod specs.

3. Controller Manager

  • Contains various controllers (Node Controller, ReplicaSet Controller, etc.)

  • Watches for changes via API Server and makes decisions to ensure desired state.

  • E.g., If a Pod crashes, the controller triggers a new one.

4. Scheduler

  • Assigns Pods to available nodes based on resource requirements, affinity/anti-affinity, taints, etc.

  • Works after the API Server stores the Pod definition.


Data Plane (The Workers)

The Data Plane is made of Worker Nodes that run the actual application workloads in the form of Pods.

1. Kubelet

  • Node-level agent that registers the node with the cluster.

  • Communicates with the API Server.

  • Ensures containers are running in a Pod.

2. kube-proxy

  • Maintains network rules for Pod communication.

  • Implements Service discovery and load balancing via iptables or IPVS.

3. Container Runtime

  • Docker, containerd, CRI-O, etc.

  • Actually runs containers inside Pods.


What is a Pod?

A Pod is the smallest deployable unit in Kubernetes. A Pod can contain one or more containers that share:

  • Network (IP address, ports)

  • Storage (volumes)

  • Lifecycle


Kubernetes Networking

Kubernetes uses a flat network model that allows Pods to communicate with each other without NAT. Key layers include:

  • Pod Network: Every Pod gets a unique IP.

  • Service Network: Abstraction that allows Pod discovery via ClusterIP, NodePort, or LoadBalancer.

  • CNI Plugins: Flannel, Calico, Weave, etc., handle Pod-to-Pod connectivity.


Inter-Component Workflow: Pod Creation Example

Let’s walk through what happens when you run:

bashCopyEditkubectl apply -f nginx-pod.yaml

Step-by-Step:

  1. kubectl → API Server

    • Sends a Pod spec via REST to the API Server.
  2. API Server → etcd

    • Stores the desired state in etcd.
  3. API Server → Scheduler

    • Scheduler watches API Server and picks up unscheduled Pods.
  4. Scheduler → API Server

    • Assigns a Pod to a suitable Worker Node and updates etcd.
  5. API Server → Kubelet (on selected Node)

    • Kubelet sees the new Pod spec and pulls required container images using the container runtime.
  6. Kubelet → Container Runtime

    • Starts the container(s) inside the Pod.
  7. kube-proxy configures networking

    • Ensures the Pod is reachable according to Service rules.
  8. Pod is now running

    • Controllers ensure it stays healthy; if not, the cycle repeats.

Kubernetes Components Map

Here’s a diagram (textual version) to visualize:

pgsqlCopyEdit+------------------------+               +-----------------------+
|                        |               |                       |
|     kubectl            |               |       etcd            |
|                        |               |   (cluster state)     |
+-----------+------------+               +-----------+-----------+
            |                                        |
            v                                        ^
+-----------+------------+               +-----------+-----------+
|     API Server          +--------------> Watch / Store / Fetch |
+-----------+------------+               +-----------------------+
            |
            v
+-------------------------+    Watches     +---------------------+
|  Controller Manager     +---------------->  Node Controller    |
+-------------------------+                 +---------------------+
            |
            v
+-------------------------+
|       Scheduler         |
+-------------------------+
            |
            v
+-------------------------+
|     Kubelet (Node)      |
+-------------------------+
            |
            v
+-------------------------+
|   Container Runtime     |
+-------------------------+
            |
            v
+-------------------------+
|          Pod            |
+-------------------------+

Optional Kubernetes Components

Cluster Configuration Generator (CCG)

  • Not a native component but often refers to automation tools like Helm or Kustomize that help in generating manifest files for cluster configuration.

Control Manager

  • General term for managing various controllers inside Kubernetes like:

    • Node Controller

    • Replication Controller

    • Endpoint Controller

    • Job Controller


Conclusion

Kubernetes architecture is a masterpiece of distributed design, where each component has a distinct role but works together to deliver seamless container orchestration. Understanding this internal mechanism empowers developers, SREs, and DevOps engineers to build more robust and scalable systems.

Whether you're debugging Pods or designing high-availability clusters, knowing the architecture is key to mastering Kubernetes.

0
Subscribe to my newsletter

Read articles from M Chidrup directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

M Chidrup
M Chidrup

Certified Azure Cloud Enthusiast and Full Stack Developer with a strong foundation in building secure, scalable cloud-native applications. Passionate about integrating AI and automation in DevOps pipelines and exploring intelligent cloud systems. I specialize in React, Node.js, Azure, Kubernetes, and DevSecOps, and I love solving real-world problems through code, collaboration, and continuous learning.