Kubernetes Architecture, Control Plane, and Scheduling Flow

Control Plane vs. Worker Nodes

A Kubernetes cluster splits cleanly into two sets of machines:

  • Control Plane (Master Components): Stores cluster state, exposes the API, schedules workloads, and runs reconciliation loops when cluster state changes.
  • Worker Nodes (formerly Minions): Runs assigned Pods, enforces Service networking rules, and manages containers on the host OS.

Users and automation interact with the cluster via REST API calls (even with curl), usually through the kubectl CLI authenticated by a kubeconfig identity file.

Control Plane components

ComponentRoleKey architectural details
kube-apiserverFront door of the control planeExposes the entire Kubernetes REST API to kubectl, optional Web UI, and every cluster component; scales horizontally by adding instances
etcdCluster state store (“distributed /etc”)Distributed key-value store supporting Watches, TLS security, REST API, fast writes (~10K writes/s), and the Raft consensus algorithm
kube-schedulerPod placement matchmakerWatches unassigned Pods and picks a node based on resource requirements, hardware/software/policy constraints, affinity/anti-affinity, data locality, and interference; holds Pods pending if no node fits
kube-controller-managerCore reconciliation loopsCompiles logically separate controllers into one binary: Node Controller (handles node failures), Replication Controller (maintains replica counts), Endpoints Controller (links Services & Pods), Service Account & Token Controllers (defaults per namespace)
cloud-controller-managerCloud-provider bridgeRuns cloud-dependent loops (disabled in kube-controller-manager) so cloud vendor code evolves independently of K8s core: Node (checks if dead node was deleted in cloud), Route (native datacenter routes), Service (cloud load balancers), Volume (attach/mount cloud storage)

Worker Node components and Addons

Every Worker Node runs three components:

  1. kubelet: The node agent. Reads PodSpecs assigned to its node, instructs the container runtime to keep containers running and healthy, mounts shared volumes, handles secrets, and reports Pod and node liveness back to kube-apiserver. (Manages only containers created by Kubernetes.)
  2. kube-proxy: Implements the Service abstraction locally by maintaining host network rules (legacy userspace mode or kernel space via iptables) for connection forwarding and load balancing.
  3. Container Runtime: Pulls images (from a registry such as Docker Registry) and executes containers—supporting Docker, rkt, runc, or any OCI runtime-spec implementation.

Optional Addons run as standard Pods inside the kube-system namespace:

  • Cluster DNS: Resolves Service/Pod names (ping webserver instead of 10.0.0.1); Kubernetes automatically configures every container’s DNS resolver to point to it.
  • Web UI (Dashboard), Container Resource Monitoring (time-series metrics DB + UI), and Cluster-level Logging (central searchable log store).

Deployment scheduling flow (PDF p. 57 / printed 65)

A defining architectural rule of Kubernetes is that components do not call each other directly. Instead, every component interacts only with kube-apiserver: passively watching for object changes and actively creating or updating objects.

Trace what happens when you create a Deployment:

  1. kubectl → API Server: User submits a Deployment; kube-apiserver validates and persists it in etcd.
  2. Deployment Controller (watches Deployment): Reacts to the new Deployment and writes a ReplicaSet back to the API Server.
  3. ReplicaSet Controller (watches ReplicaSet): Reacts to the new ReplicaSet and creates Pod object(s) with no node assigned yet.
  4. kube-scheduler (watches unassigned Pod): Picks a suitable Worker Node and creates a Binding object in the API Server.
  5. kubelet on the selected Worker Node (watches Binding): Detects the Pod bound to its node and calls the Container Runtime (via CRI) to pull the image and start container(s).
  6. Runtime → kubelet → API Server: The runtime updates container state, and kubelet updates Pod.status in the API Server.
  7. Status ripples upward: ReplicaSet Controller sees updated Pod.status and updates ReplicaSet.status; Deployment Controller sees updated ReplicaSet.status and updates Deployment.status.

Common confusions

  • Control loops are hub-and-spoke, not peer-to-peer: ReplicaSet Controller never sends an RPC to kubelet; kube-apiserver + etcd decouples every step so crashed controllers simply resume from persisted state.
  • etcd vs. kube-apiserver: Only kube-apiserver talks directly to etcd; every other component reads/watches state through kube-apiserver.

Retrieval

  1. Why doesn’t the ReplicaSet Controller contact a worker node’s kubelet directly after creating a Pod, and which two control-plane components sit in between?
    Kubernetes components communicate only through kube-apiserver (backed by etcd), never directly. After ReplicaSet Controller writes an unassigned Pod to kube-apiserver, kube-scheduler watches for unassigned Pods, selects a node, and writes a Binding back to kube-apiserver—only then does that node’s kubelet see the binding and start the container.
  2. Suppose kube-proxy crashes on Worker Node #2 while kubelet remains healthy. What continues working on Node #2, and what breaks?
    kubelet keeps starting, monitoring, and reporting liveness for containers assigned to Node #2 normally, but Service virtual-IP forwarding and load balancing (iptables rules for ClusterIP/NodePort) fail on Node #2.

Source: Lecture 11 - Kubernetes, PDF pages 43–57 (printed slides 49–65).