Sub topic 4
The big picture: control plane and worker nodes
This chapter assumes you know what containers and images are, can use a Linux shell, and can read YAML. It maps the components of a Kubernetes cluster. Later chapters cover each component in detail.
Two halves of a cluster
A Kubernetes cluster is a set of machines split into two roles.
- The control plane makes decisions. It stores the cluster's desired state, decides where Pods run, and runs the controllers that correct drift.
- Worker nodes do the work. Each node is a machine, physical or virtual, that runs your Pods.
Small clusters often run control plane components and workloads on the same machines. Production clusters usually keep them apart, and managed services such as EKS, GKE, and AKS run the control plane for you.
Components and their jobs
| Component | Runs on | Role |
|---|---|---|
| kube-apiserver | Control plane | The front door. Every client and component talks to it. |
| etcd | Control plane | The key-value store that holds cluster state. |
| kube-scheduler | Control plane | Picks a node for each new Pod. |
| kube-controller-manager | Control plane | Runs controllers that make reality match the spec. |
| kubelet | Every node | Starts and monitors the Pods assigned to its node. |
| Container runtime | Every node | Runs the containers, through the Container Runtime Interface (CRI). |
| kube-proxy | Every node | Programs network rules so Service traffic reaches Pods. |
How the pieces connect
The API server sits at the center. The scheduler, the controllers, and the kubelets never talk to each other directly. Each one reads and writes state through the API server, and only the API server talks to etcd.
This hub design keeps each component simple. The scheduler only needs to find Pods with no node and assign one. The kubelet only needs to watch for Pods assigned to its node.
Seeing it on a real cluster
You can list the nodes and the system Pods that make up these components:
kubectl get nodes
kubectl get pods -n kube-systemThe first command shows each node and its role. The second lists system Pods in the kube-system namespace. Depending on how the cluster was built, you will usually see entries for the API server, etcd, the scheduler, the controller manager, and kube-proxy. On managed clusters the control plane Pods are hidden from you, so you may see only add-ons such as DNS and kube-proxy. The kubelet normally runs as a system service on the node, not as a Pod.
Common mistakes
- Thinking the control plane runs your containers. It only records and decides. Containers run on nodes.
- Expecting components to call each other. If you trace a request, every hop goes through the API server.
- Treating etcd as an application database. It holds cluster state only. Store application data elsewhere.
- Assuming the control plane is always visible. On managed services you cannot list its Pods.
Exercise
A new Pod has been created but has no node assigned. Which control plane component notices this, and how does it record its decision?
Show answer
The kube-scheduler notices it by watching the API server for Pods with no node. It picks a node and writes the assignment back through the API server, which stores it in etcd. The kubelet on that node then sees the Pod and starts it.
Exercise
Why can you not find a kubelet Pod when you run kubectl get pods -n kube-system?
Show answer
The kubelet normally runs as a system service on each node, not as a Pod. It has to be running before it can start any Pods.