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
| Component | Role | Key architectural details |
|---|---|---|
kube-apiserver | Front door of the control plane | Exposes the entire Kubernetes REST API to kubectl, optional Web UI, and every cluster component; scales horizontally by adding instances |
etcd | Cluster 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-scheduler | Pod placement matchmaker | Watches 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-manager | Core reconciliation loops | Compiles 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-manager | Cloud-provider bridge | Runs 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:
kubelet: The node agent. ReadsPodSpecs 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 tokube-apiserver. (Manages only containers created by Kubernetes.)kube-proxy: Implements theServiceabstraction locally by maintaining host network rules (legacy userspace mode or kernel space viaiptables) for connection forwarding and load balancing.- 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 webserverinstead of10.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:
kubectl→ API Server: User submits aDeployment;kube-apiservervalidates and persists it inetcd.- Deployment Controller (watches
Deployment): Reacts to the new Deployment and writes aReplicaSetback to the API Server. - ReplicaSet Controller (watches
ReplicaSet): Reacts to the new ReplicaSet and createsPodobject(s) with no node assigned yet. kube-scheduler(watches unassignedPod): Picks a suitable Worker Node and creates aBindingobject in the API Server.kubeleton the selected Worker Node (watchesBinding): Detects the Pod bound to its node and calls the Container Runtime (via CRI) to pull the image and start container(s).- Runtime →
kubelet→ API Server: The runtime updates container state, andkubeletupdatesPod.statusin the API Server. - Status ripples upward:
ReplicaSet Controllersees updatedPod.statusand updatesReplicaSet.status;Deployment Controllersees updatedReplicaSet.statusand updatesDeployment.status.
Common confusions
- Control loops are hub-and-spoke, not peer-to-peer:
ReplicaSet Controllernever sends an RPC tokubelet;kube-apiserver+etcddecouples every step so crashed controllers simply resume from persisted state. etcdvs.kube-apiserver: Onlykube-apiservertalks directly toetcd; every other component reads/watches state throughkube-apiserver.
Retrieval
- Why doesn’t the
ReplicaSet Controllercontact a worker node’skubeletdirectly after creating a Pod, and which two control-plane components sit in between?
Kubernetes components communicate only throughkube-apiserver(backed byetcd), never directly. AfterReplicaSet Controllerwrites an unassignedPodtokube-apiserver,kube-schedulerwatches for unassigned Pods, selects a node, and writes aBindingback tokube-apiserver—only then does that node’skubeletsee the binding and start the container. - Suppose
kube-proxycrashes on Worker Node #2 whilekubeletremains healthy. What continues working on Node #2, and what breaks?
kubeletkeeps starting, monitoring, and reporting liveness for containers assigned to Node #2 normally, butServicevirtual-IP forwarding and load balancing (iptablesrules forClusterIP/NodePort) fail on Node #2.
Source: Lecture 11 - Kubernetes, PDF pages 43–57 (printed slides 49–65).