Kubernetes Architecture
The Control Plane — API Server, etcd, Scheduler, Controller Manager
The brain of a Kubernetes cluster.
Interview: This is a key interview area. Expect detailed questions on each component's function, particularly: Why is etcd's quorum mathematical calculation important? How does the scheduler pick node targets? What is the controller manager's reconciliation loop? Remember, the API Server is the only component that directly talks to etcd.
Introduction
A Kubernetes cluster consists of two main types of nodes: the Control Plane (the cluster manager) and the Worker Nodes (which run the actual container workloads). The Control Plane maintains the desired state of the cluster.
Why It Matters
If the control plane components fail, the cluster loses its ability to schedule new pods, auto-scale, react to node failures, or process API commands. Understanding the boundaries and failover characteristics of these components is crucial for cluster reliability.
Real-World Analogy
Think of the Control Plane like the airport control tower:
• The API Server is the radio communications operator—the only one authorized to talk directly to everyone.
• etcd is the flight log logbook recording the location of every plane.
• The Scheduler is the traffic controller directing which gate and runway planes should park in.
• The Controller Manager is the supervisor constantly checking if flights match the scheduled departures list.
How It Works
The control plane components act asynchronously. When a client requests pod creation:
- kube-apiserver: Authenticates the request and records the spec to etcd.
- kube-scheduler: Polls the API Server, filters nodes, scores options, and updates the target node field in etcd.
- kube-controller-manager: Monitors states and schedules resources.
Internal Architecture
The core components of the Control Plane run as static Pods or system services:
- kube-apiserver: Scale horizontally. It is stateless.
- etcd: High availability database that uses the Raft consensus algorithm. It requires a quorum.
For etcd to survive, you need a majority. A 3-node cluster can survive 1 failure; a 5-node cluster can survive 2 failures.
Visual Explanation
Practical Example
Here is how to query control plane component health statuses directly using kubectl:
Common Mistakes
1. Direct etcd Modification: Trying to write values directly into etcd bypasses API Server validations, leading to corrupt cluster states.
2. Split-Brain etcd: Deploying an even number of etcd nodes (e.g. 4 nodes). If a network partition cuts the cluster into two equal halves (2 and 2), neither side can establish quorum, locking cluster administration.
Quick Quiz
Q1: Which Control Plane component is the only one that directly writes to etcd?
A) kube-scheduler
B) kube-apiserver
C) kube-controller-manager
Answer: B — For security and integrity, the API Server acts as the gatekeeper; no other component has database access credentials.
Scenario-Based Challenge
Scenario:
Your etcd cluster is deployed with 3 replica nodes. A hardware partition splits node C off from nodes A and B. Can the cluster continue to write state changes? What if another node (node B) also crashes?
View SolutionWith 3 total nodes, the quorum requirement is 2 nodes. If node C is partitioned, A and B can communicate and establish quorum (2/3), so the cluster functions. If node B also crashes, only A remains active. Since 1 node is less than the quorum threshold of 2, the cluster locks, blocking any new state updates.
Debugging Exercise
Failure Case:
You run kubectl apply -f pod.yaml. The command returns success, and kubectl get pods shows the Pod in a Pending state, but it never starts.
How would you debug this?
View SolutionFix: Check if the kube-scheduler is healthy or running. Check the pod events using:
Interview Questions
1. Explain the two phases the scheduler uses to place a Pod on a node.
The scheduler uses Filtering (Predicates) to eliminate nodes that lack resources or violate constraints. It then uses Scoring (Priorities) to rank the remaining nodes and binds the Pod to the highest-scoring host.
2. What is the role of the kube-controller-manager?
It compiles and runs the background controller loops (Node Controller, Job Controller, Deployment Controller) that constantly reconcile the difference between the desired state and the observed cluster state.
Production Considerations
Always backup etcd directories regularly. Because etcd records every resource manifest and configuration in the cluster, a catastrophic storage failure on etcd will result in cluster data loss.