DEV Community

Shiva Krishna beepeta
Shiva Krishna beepeta

Posted on

Kubernetes Architecture

🚀 Kubernetes Architecture Explained

Before diving into Kubernetes architecture, let's first understand why Kubernetes is preferred for running containerized applications in production environments.


Why Kubernetes Is Preferred Over Docker

Docker is a containerization platform that helps package and run applications inside containers. However, managing hundreds or thousands of containers across multiple servers becomes difficult.

This is where Kubernetes comes into the picture.

Kubernetes is a container orchestration platform that automates the deployment, scaling, networking, and management of containerized applications.

Key Benefits of Kubernetes

✅ Cluster-Level Management

Manage containers across multiple servers (nodes) from a single control plane.

✅ Auto Scaling

Automatically increase or decrease application replicas based on workload demand.

✅ Self-Healing

Automatically recreate failed Pods and maintain the desired state.

✅ Enterprise-Grade Platform

Provides high availability, scalability, security, and strong community support.


Kubernetes Architecture

A Kubernetes cluster consists of two major parts:

  1. Control Plane (Master Node)
  2. Worker Nodes
                  Control Plane
                         |
    ------------------------------------------------
    |                  |                  |
 API Server       Scheduler      Controller Manager
                         |
                       etcd
                         |
--------------------------------------------------------
|                    |                    |
Worker Node 1   Worker Node 2     Worker Node 3
Enter fullscreen mode Exit fullscreen mode

Worker Node Components

Worker Nodes are responsible for running application workloads.

The major components of a Worker Node are:

  • Pod
  • Kubelet
  • Kube-Proxy
  • Container Runtime

Pod

A Pod is the smallest deployable unit in Kubernetes.

A Pod can contain one or more tightly coupled containers that share:

  • Network
  • Storage
  • Lifecycle

Key Characteristics

  • Pods are ephemeral in nature.
  • If a Pod crashes, Kubernetes replaces it with a new identical Pod.
  • Pods are usually managed through a Deployment resource.

Pod Structure

Pod
 ├── Application Container
 └── Sidecar Container (Optional)
Enter fullscreen mode Exit fullscreen mode

Why Pods?

Pods provide an abstraction layer over containers and allow Kubernetes to manage applications more effectively.


Kubelet

Kubelet is an agent that runs on every Worker Node.

Its primary responsibility is to ensure that containers are running according to the specifications defined in Kubernetes.

Responsibilities

  • Receives instructions from the API Server.
  • Creates and manages Pods.
  • Monitors Pod health and status.
  • Mounts storage volumes.
  • Reports the status of Pods and Nodes back to the Control Plane.

Kubelet Workflow

API Server
      |
      v
   Kubelet
      |
      v
     Pods
Enter fullscreen mode Exit fullscreen mode

Think of Kubelet as the node manager that continuously monitors workloads running on a node.


Kube-Proxy

Kube-Proxy is responsible for networking and traffic routing inside the Kubernetes cluster.

Responsibilities

  • Maintains networking rules on each node.
  • Routes traffic to the correct Pod.
  • Enables Service-to-Pod communication.
  • Performs load balancing across Pod replicas.

Traffic Flow

Client Request
       |
       v
    Service
       |
       v
  Kube-Proxy
       |
 ------------------
 |       |        |
Pod-1   Pod-2   Pod-3
Enter fullscreen mode Exit fullscreen mode

Without Kube-Proxy, Services would not be able to route requests to application Pods.


Container Runtime

The Container Runtime is responsible for running containers on Worker Nodes.

Popular container runtimes include:

  • containerd
  • CRI-O

Responsibilities

  • Pulling container images.
  • Creating containers.
  • Starting and stopping containers.
  • Managing container lifecycle operations.
  • Collecting and exposing container logs.

Runtime Flow

Container Image
        |
        v
Container Runtime
        |
        v
Container Creation
        |
        v
Application Running
Enter fullscreen mode Exit fullscreen mode

Control Plane Components

The Control Plane acts as the brain of the Kubernetes cluster.

It is responsible for making decisions about:

  • Scheduling
  • Scaling
  • Cluster management
  • Recovery from failures

The Control Plane consists of:

  • API Server
  • Scheduler
  • etcd
  • Controller Manager

API Server

The API Server is the entry point to the Kubernetes cluster.

Every component communicates through the API Server.

Responsibilities

  • Handles all Kubernetes API requests.
  • Authenticates and authorizes users.
  • Validates configuration changes.
  • Updates cluster state.
  • Communicates with other Control Plane components.

Example

When you execute:

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

The request first reaches the API Server, which retrieves the information and returns the response.

Flow

kubectl
    |
    v
API Server
    |
    v
Cluster Components
Enter fullscreen mode Exit fullscreen mode

Think of the API Server as the central communication hub of Kubernetes.


Scheduler

The Scheduler decides where newly created Pods should be placed.

Whenever a new Pod is created, the Scheduler identifies the most suitable Worker Node.

Factors Considered

  • CPU availability
  • Memory availability
  • Node affinity
  • Taints and tolerations
  • Resource requests and limits

Scheduling Process

New Pod Created
        |
        v
    Scheduler
        |
        v
Select Best Node
        |
        v
     Worker Node
Enter fullscreen mode Exit fullscreen mode

The Scheduler ensures workloads are distributed efficiently across the cluster.


etcd

etcd is a distributed key-value database used by Kubernetes.

It stores the complete state and configuration of the cluster.

Examples of Data Stored in etcd

  • Pods
  • Services
  • Deployments
  • ConfigMaps
  • Secrets
  • Nodes
  • Cluster configurations

Structure

etcd
 ├── Pods
 ├── Services
 ├── ConfigMaps
 ├── Secrets
 ├── Deployments
 └── Nodes
Enter fullscreen mode Exit fullscreen mode

Think of etcd as the single source of truth for the Kubernetes cluster.

If etcd becomes unavailable, the Control Plane cannot function correctly.


Controller Manager

The Controller Manager runs multiple controllers responsible for maintaining the desired cluster state.

Its main job is to continuously compare:

Desired State
      VS
Actual State
Enter fullscreen mode Exit fullscreen mode

and take corrective actions whenever there is a mismatch.

Example

Desired State:

3 Pods Running
Enter fullscreen mode Exit fullscreen mode

Current State:

2 Pods Running
Enter fullscreen mode Exit fullscreen mode

Action Taken:

Controller Manager
        |
        v
Create New Pod
Enter fullscreen mode Exit fullscreen mode

The cluster automatically returns to the desired state of three running Pods.

Responsibilities

  • Replica management
  • Node management
  • Endpoint management
  • Pod lifecycle management
  • Self-healing operations

This continuous reconciliation process is one of the core strengths of Kubernetes.


Putting It All Together

Let's see how all components work together when a Pod is created.

Developer
    |
kubectl apply
    |
    v
API Server
    |
    v
Scheduler
    |
Select Node
    |
    v
Kubelet
    |
Create Pod
    |
    v
Container Runtime
    |
Run Containers
    |
    v
Kube-Proxy
    |
Expose Application Traffic
Enter fullscreen mode Exit fullscreen mode

Final Thoughts

Kubernetes follows a powerful architecture that enables organizations to run applications reliably at scale.

Worker Node Components

  • Pod runs application containers.
  • Kubelet manages Pods on a node.
  • Kube-Proxy handles networking.
  • Container Runtime runs containers.

Control Plane Components

  • API Server acts as the communication hub.
  • Scheduler places workloads on the best node.
  • etcd stores cluster state.
  • Controller Manager ensures the desired state is maintained.

Together, these components provide:

✅ High Availability

✅ Scalability

✅ Self-Healing

✅ Efficient Resource Utilization

✅ Enterprise-Grade Reliability

This is the reason Kubernetes has become the de facto standard for managing containerized workloads in modern cloud-native environments.


💡 Next Article

In the next article, we'll dive deeper into:

  • Pods vs Deployments
  • ReplicaSets
  • Services
  • Ingress
  • ConfigMaps & Secrets
  • Persistent Volumes
  • Kubernetes Networking
  • Kubernetes Troubleshooting ``

Top comments (0)