☸️ Day 7: Kubernetes Architecture (Control Plane & Data Plane)

Video Overview

This note dives deep into Kubernetes architecture, covering:

  • Pods & Deployments (foundation)
  • Control Plane vs Data Plane
  • Core components (API Server, Scheduler, etc.)
  • End-to-end deployment workflow

πŸ“Œ This is one of the MOST IMPORTANT topics for CKA.


πŸ“¦ Concept 1: What is a Pod?

Important

A Pod is the smallest deployable unit in Kubernetes

🧠 Definition

  • Pod = Wrapper around container(s)
  • Can contain:
    • 1 container (most common)
    • Multiple containers (advanced use cases)

πŸ“¦ Pod = Container Box

  • Docker β†’ Container
  • Kubernetes β†’ Pod (contains container)

πŸ”— Multi-Container Pods (Sidecar Pattern)

Info

Multiple containers inside a pod follow Sidecar Pattern

Common Use Cases:

  • πŸ“œ Logging β†’ collect logs
  • πŸ“Š Monitoring β†’ send metrics
  • 🌐 Proxy β†’ outbound requests
  • πŸ” Reverse Proxy β†’ handle incoming traffic

🌐 Shared Resources in Pod

Important

Containers inside a pod share:

  • 🌐 Network
    • Same IP
    • Access via localhost
  • πŸ’Ύ Storage
    • Shared volumes

πŸš€ Concept 2: What is a Deployment?

Important

Deployment ensures your app is always running

πŸ”‘ Why not just Pod?

  • If pod dies β†’ no recovery ❌

βœ… Deployment Features:

πŸ“ˆ 1. Replica Management

  • Define number of pods:
    • Example: replicas = 10
  • Kubernetes ensures 10 always run

πŸ”„ 2. Rolling Updates & Rollbacks

  • Update without downtime
  • Rollback if failure

πŸ“œ 3. Declarative Configuration

Quote

You define β€œdesired state” β†’ Kubernetes maintains it


🧠 Concept 3: Kubernetes Architecture Overview

Example

Cluster = Control Plane + Data Plane


🧠 Control Plane (Brain 🧠)

Important

Manages entire cluster

  • Must be Highly Available
  • Responsible for:
    • Decisions
    • Scheduling
    • State management

βš™οΈ Data Plane (Workers)

Important

Runs actual applications (Pods)

  • Contains:
    • Worker Nodes
    • Containers

🧩 Concept 4: Control Plane Components


🌐 API Server

Important

Entry point to Kubernetes

  • All requests go through API Server
  • Handles:
    • Authentication
    • Authorization
    • Validation

πŸ—„οΈ etcd

Important

Key-value database

  • Stores:
    • Cluster state
    • Configurations
  • Must be:
    • Backed up
    • Highly available

βš™οΈ Controller Manager

Important

Maintains desired state

  • Runs multiple controllers:
    • Deployment controller
    • ReplicaSet controller

πŸ“ Scheduler

Important

Assigns pods to nodes

  • Based on:
    • CPU / Memory
    • Rules (e.g., GPU required)

☁️ Cloud Controller Manager

Info

Connects Kubernetes with cloud providers

  • AWS, Azure, GCP integrations

🧩 Concept 5: Data Plane Components


πŸ”„ Kubelet

Important

Node agent

  • Runs on every node
  • Responsibilities:
    • Start containers
    • Monitor health
    • Talk to API Server

βš™οΈ Container Runtime

Info

Runs containers

  • Examples:
    • containerd
    • CRI-O

🌐 kube-proxy

Important

Network traffic manager

  • Handles:
    • Service β†’ Pod routing
    • Load balancing
    • Health checks

🌐 Concept 6: Kubernetes Service

Important

Logical abstraction for pods

❌ Problem:

  • Pods have dynamic IPs

βœ… Solution:

  • Use Service
  • Traffic goes:
    Pod β†’ Service β†’ Target Pod
    

πŸ”Œ Concept 7: CNI (Container Network Interface)

Important

Core networking system in Kubernetes

Responsibilities:

  • Assign IPs to pods
  • Pod-to-Pod communication
  • Network policies
  • IP management

⚑ Advanced Insight

Tip

Some CNI plugins can replace kube-proxy

Examples:

  • Calico
  • Cilium

🧠 Concept 8: Deployment Workflow (VERY IMPORTANT)

End-to-End Flow

Step 1: User Command

kubectl apply -f app.yaml

Step 2: kubectl

  • Validates YAML
  • Sends request to API Server

Step 3: API Server

  • Authenticates user
  • Validates schema
  • Stores in etcd

Step 4: Controller Manager

  • Detects mismatch
  • Creates:
    • Deployment β†’ ReplicaSet β†’ Pods

Step 5: Scheduler

  • Assigns nodes to pods

Step 6: Kubelet

  • Pulls image
  • Starts containers

πŸ” Final Flow Summary

Quote

kubectl β†’ API Server β†’ etcd β†’ Controller β†’ Scheduler β†’ Kubelet β†’ Container Runtime


🧱 Concept 9: Object Hierarchy

Important

Deployment
   ↓
ReplicaSet
   ↓
Pod
   ↓
Container

βž• Concept 10: Kubernetes Add-ons

Info

Extend cluster functionality

πŸ”§ Examples:

  • πŸ“Š Metrics Server β†’ CPU/memory data
  • 🌐 CoreDNS β†’ DNS resolution
  • πŸ”Œ CNI β†’ Networking
  • πŸ’Ύ CSI β†’ Storage
  • πŸ“Š Dashboard β†’ UI for cluster

⚠️ Key Understanding

Important

Kubernetes is modular β†’ supports plugins


🧠 Final Takeaways

Summary

  • Pod = smallest unit
  • Deployment = manages pods
  • Control Plane = brain
  • Data Plane = execution
  • API Server = entry point
  • etcd = source of truth

πŸ“Œ One-Line Summary

Quote

Kubernetes = Brain (Control Plane) + Workers (Data Plane) managing Pods at scale ☸️