Skip to content

Latest commit

Β 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

☸️ Kubernetes Engineering Notes

Architecture, production troubleshooting, and AKS β€” documented from hands-on work

Control Plane β€’ Worker Nodes β€’ API Server β€’ etcd β€’ Scheduler β€’ Controllers β€’ kubelet β€’ Container Runtime


πŸ“– About This Repository

This is where I document Kubernetes as I learn and work with it in production β€” starting with architecture, since everything else builds on top of it.

Every time I hit a real issue on a cluster, I come back and add what I learned. The repository grows the same way production experience does: one incident, one concept, one fix at a time.

Kubernetes Architecture
        ↓
Work With Real Clusters
        ↓
Hit a Problem
        ↓
Understand It
        ↓
Document It Here
        ↓
Repository Grows

🎯 Goals

  • πŸ“š Learn Kubernetes deeply β€” from core concepts to production operations
  • 🧠 Build a long-term reference β€” stop re-learning the same concepts from scratch
  • πŸ’Ό Demonstrate production skills β€” architecture, AKS, scaling, networking, troubleshooting, and CI/CD

🧩 What This Repository Covers

  • πŸ—οΈ Kubernetes architecture β€” control plane, worker nodes, and how they communicate
  • ☁️ AKS in production β€” node pools, scaling, and cluster operations on Azure
  • πŸ› Troubleshooting β€” root-causing failed deployments, crash loops, and resource issues
  • πŸ” CI/CD β€” how code goes from a Git push to a running Pod

This is the first piece: Kubernetes Architecture. It's the foundation every other topic here β€” networking, scaling, security, AKS β€” connects back to.

Kubernetes Architecture

πŸ“– What Is Kubernetes?

Kubernetes is a container orchestration platform used to deploy, manage, scale, and maintain containerized applications across a cluster of machines.

Instead of manually managing containers on individual servers, Kubernetes continuously reconciles the application toward a desired state defined by the user.

Application
     ↓
Container
     ↓
Pod
     ↓
Worker Node
     ↓
Kubernetes Cluster

The architecture is mainly divided into two parts:

                    ☸️ Kubernetes Cluster
                            β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                           β”‚
              β–Ό                           β–Ό
        🧠 Control Plane             πŸ–₯️ Worker Nodes
        Manages Cluster              Runs Workloads

πŸ›οΈ Kubernetes Cluster

A Kubernetes Cluster is a group of machines working together to run and manage containerized applications.

The cluster contains:

  • Control Plane β€” responsible for managing the cluster.
  • Worker Nodes β€” responsible for running application workloads.

Worker Nodes can be organized into Node Pools, especially in managed Kubernetes platforms such as AKS.

Kubernetes Cluster
        β”‚
        β”œβ”€β”€ Control Plane
        β”‚
        └── Node Pool
              β”‚
              β”œβ”€β”€ Worker Node
              β”‚     └── Pods
              β”‚
              β”œβ”€β”€ Worker Node
              β”‚     └── Pods
              β”‚
              └── Worker Node
                    └── Pods

🧠 Control Plane

The Control Plane is the management layer of Kubernetes.

It receives instructions, stores the cluster state, decides where workloads should run, and continuously works to maintain the desired state.

Control Plane
β”‚
β”œβ”€β”€ kube-apiserver
β”œβ”€β”€ etcd
β”œβ”€β”€ kube-scheduler
β”œβ”€β”€ kube-controller-manager
└── cloud-controller-manager

Think: The Control Plane is the brain of the Kubernetes cluster.

πŸšͺ kube-apiserver

The API Server is the central entry point into Kubernetes.

When we use commands such as:

kubectl get pods
kubectl apply -f deployment.yaml
kubectl delete pod <pod-name>

the requests are handled through the Kubernetes API.

Developer
    ↓
kubectl
    ↓
API Server
    ↓
Kubernetes Cluster

The API Server also acts as the main communication point between Kubernetes components.

Think: API Server = Front door and communication layer of Kubernetes

πŸ’Ύ etcd

etcd is the distributed key-value store used by Kubernetes to persist cluster state.

It stores information about Kubernetes objects and their configuration β€” Pods, Deployments, Services, Nodes, Namespaces, Secrets, and ConfigMaps.

                    etcd
                     β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό            β–Ό            β–Ό
   Cluster State   Objects     Configuration

The API Server communicates with etcd to store and retrieve cluster information.

Think: etcd = Source of truth for Kubernetes cluster state

πŸ“ kube-scheduler

The Scheduler decides which Worker Node should run a newly created Pod.

New Pod
   ↓
Scheduler
   ↓
Evaluate Nodes
   ↓
Select Suitable Node

The Scheduler considers factors such as available resources and scheduling requirements. It does not run the container itself β€” it only determines where the Pod should run.

Think: Scheduler = Decides WHERE the Pod runs

πŸ”„ kube-controller-manager

Kubernetes uses controllers to continuously compare the desired state with the actual state of the cluster.

Desired State
      ↓
   Controller
      ↓
Actual State

For example:

Desired: 2 Pods
Actual:  1 Pod
      ↓
Controller detects difference
      ↓
Replacement Pod created
      ↓
Actual: 2 Pods

This continuous reconciliation is one of the fundamental ideas behind Kubernetes.

Think: Controllers = Continuously work toward the desired state

☁️ cloud-controller-manager

The Cloud Controller Manager provides integration between Kubernetes and the underlying cloud provider.

Kubernetes
     ↓
Cloud Controller Manager
     ↓
Azure

This becomes particularly important when working with Azure Kubernetes Service (AKS).


πŸ–₯️ Worker Nodes

Worker Nodes are the machines where application workloads actually run.

Worker Node
β”‚
β”œβ”€β”€ kubelet
β”œβ”€β”€ Container Runtime
β”œβ”€β”€ Networking Components
└── Pods

A Kubernetes cluster normally has multiple Worker Nodes so workloads can be distributed across the cluster.

                 Worker Nodes
                      β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό             β–Ό             β–Ό
      Node 1        Node 2        Node 3
        β”‚             β”‚             β”‚
       Pods          Pods          Pods

πŸ”§ kubelet

kubelet is the Kubernetes agent running on every Worker Node.

It communicates with the Control Plane and makes sure that the workloads assigned to its Node are running correctly.

Control Plane
      ↓
  API Server
      ↓
    kubelet
      ↓
Container Runtime
      ↓
     Pod

The kubelet does not decide which Node should receive a Pod β€” that decision is made by the Scheduler.

Think: kubelet = Agent responsible for managing workloads on a Node

πŸ“¦ Container Runtime

The Container Runtime is responsible for actually running containers on the Worker Node. A common runtime used by Kubernetes is containerd.

kubelet
   ↓
Container Runtime
   ↓
Container

Therefore:

Scheduler          β†’ Decides WHERE
kubelet             β†’ Manages the workload
Container Runtime   β†’ Runs the container

πŸ“¦ Pods

A Pod is the smallest deployable unit in Kubernetes. It contains one or more containers that share the same network and storage context.

Worker Node
β”‚
β”œβ”€β”€ Pod
β”‚    └── Container
β”‚
β”œβ”€β”€ Pod
β”‚    └── Container
β”‚
└── Pod
     └── Container

Kubernetes schedules Pods, not individual containers, onto Worker Nodes.


πŸ”„ Complete Kubernetes Flow

When we deploy an application, the major flow can be understood as:

Developer
    ↓
kubectl / API Client
    ↓
API Server
    ↓
etcd
    ↓
Controllers
    ↓
Scheduler
    ↓
Selected Worker Node
    ↓
kubelet
    ↓
Container Runtime
    ↓
Pod
    ↓
Container
    ↓
Application

Each component has a specific responsibility in this process β€” no single piece does everything.


🧩 Complete Architecture

                         ☸️ KUBERNETES CLUSTER
                                  β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚                               β”‚
                  β–Ό                               β–Ό
           🧠 CONTROL PLANE                πŸ–₯️ WORKER NODES
                  β”‚                               β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚          β”‚          β”‚            β”‚       β”‚        β”‚
      API        etcd    Scheduler      kubelet Runtime  Network
     Server
       β”‚
       β–Ό
  Controllers
       β”‚
       └──────────────────────────────┐
                                      β–Ό
                                    Pod
                                      β”‚
                                      β–Ό
                                  Container
                                      β”‚
                                      β–Ό
                                  Application

🧠 Responsibility Map

Component Responsibility
Control Plane Manages the Kubernetes cluster
API Server Handles Kubernetes API requests and communication
etcd Stores cluster state
Scheduler Decides where Pods should run
Controllers Maintain the desired state
Cloud Controller Integrates Kubernetes with cloud infrastructure
Worker Node Provides compute for workloads
kubelet Manages Pods on the Node
Container Runtime Runs containers
Pod Smallest deployable workload unit

πŸ—οΈ Kubernetes Hierarchy

Cloud / Infrastructure
        ↓
Kubernetes Cluster
        ↓
Node Pool
        ↓
Worker Node
        ↓
Namespace
        ↓
Workload
        ↓
Pod
        ↓
Container

For AKS:

Azure Resource Group
        ↓
AKS Cluster
        ↓
Node Pool
        ↓
Worker Nodes
        ↓
Pods
        ↓
Containers

Each layer has a different responsibility and should not be treated as the same thing.


πŸ” Desired State & Actual State

Kubernetes is built around the concept of desired state.

Desired State:
  replicas: 2

Kubernetes continuously works to make the actual cluster state match that requirement.

                 Desired State
                      β”‚
                      β–Ό
                 Kubernetes
                      β”‚
                      β–Ό
                  Actual State

If one Pod fails:

Desired = 2
Actual  = 1
       ↓
Kubernetes detects the difference
       ↓
Works to restore the desired state
       ↓
Desired = 2
Actual  = 2

This reconciliation model is fundamental to understanding Deployments, self-healing, scaling, and most other Kubernetes behavior.


🎯 Core Concepts, In One Line Each

API Server         β†’ Communication
etcd                β†’ Cluster State
Controllers         β†’ Desired State
Scheduler           β†’ Pod Placement
kubelet             β†’ Node Workload Management
Container Runtime   β†’ Container Execution
Pod                 β†’ Application Workload

πŸ“š Roadmap β€” Topics To Be Added

This repository starts with Kubernetes Architecture as the foundation. The following topics will be added progressively as separate sections, each building on the concepts covered here.

☸️ Kubernetes Architecture   βœ… (this section)
        β”‚
        β”œβ”€β”€ Pods & Workloads
        β”œβ”€β”€ Deployments & ReplicaSets
        β”œβ”€β”€ Services & Ingress
        β”œβ”€β”€ Networking & DNS
        β”œβ”€β”€ Scheduling, Affinity & Topology
        β”œβ”€β”€ Scaling (HPA / VPA / Cluster Autoscaler)
        β”œβ”€β”€ Storage (PV / PVC / StorageClass)
        β”œβ”€β”€ Security (RBAC / Secrets / Workload Identity)
        β”œβ”€β”€ Health Probes
        β”œβ”€β”€ Observability (Logs / Metrics / Events)
        β”œβ”€β”€ Troubleshooting Playbooks
        β”œβ”€β”€ Azure Kubernetes Service (AKS)
        β”œβ”€β”€ CI/CD (Azure DevOps β†’ ACR β†’ AKS)
        └── Production Incidents & Lessons Learned

Every topic will follow the same format used here β€” short explanations, mental models, and diagrams β€” so the repository stays consistent as it grows.


πŸš€ Learning Approach

The goal of this repository is not to memorize Kubernetes commands.

The goal is to understand how Kubernetes works internally, apply that knowledge to real environments, troubleshoot problems, and document the solutions for future reference.

Understand Architecture
        ↓
Understand Components
        ↓
Understand Workloads
        ↓
Understand Communication
        ↓
Practice with Kubernetes
        ↓
Troubleshoot Real Problems
        ↓
Apply in AKS
        ↓
Production Kubernetes

☸️ Learn β†’ Understand β†’ Practice β†’ Troubleshoot β†’ Document β†’ Improve

Releases

Packages

Contributors