Kubernetes Architecture
Kubernetes architecture consists of a control plane and worker nodes, each with specific components that work together to run and manage containerized workloads.
Kubernetes follows a master-worker architecture. The control plane is the brain of the cluster — it stores desired state, makes scheduling decisions, and runs reconciliation loops. The worker nodes are where application Pods actually run. Understanding each component and what it does is one of the most common interview topics for any Kubernetes or DevOps role.
Control Plane Components
| Component | Responsibility |
|---|---|
kube-apiserver |
The single front door to the cluster. All kubectl commands, internal controllers, and external tools communicate through this REST API. It validates objects and persists them to etcd. |
etcd |
A distributed, strongly consistent key-value store. Stores the entire cluster state (desired and actual). Only the kube-apiserver reads from and writes to etcd directly. |
kube-scheduler |
Watches for unscheduled Pods and assigns each one to a suitable node, considering resource requests, affinity rules, taints, and tolerations. |
kube-controller-manager |
Runs a collection of control loops (Node controller, ReplicaSet controller, Endpoints controller, etc.). Each loop watches the API server and reconciles actual state to desired state. |
cloud-controller-manager |
Runs cloud-provider-specific controllers (load balancer provisioning, node lifecycle on cloud VMs). Separates cloud logic from the core Kubernetes code. Present only in cloud-managed clusters. |
Worker Node Components
| Component | Responsibility |
|---|---|
kubelet |
An agent that runs on every worker node. It receives Pod specs from the API server and instructs the container runtime to start, stop, and monitor containers. Reports Pod status back to the API server. |
kube-proxy |
Maintains network rules (iptables or IPVS rules) on each node so that traffic addressed to a Service ClusterIP is forwarded to the correct Pod endpoints. |
| Container runtime | The software that actually runs containers. Kubernetes supports any OCI-compatible runtime (containerd, CRI-O). Docker Engine was removed as a supported runtime in Kubernetes 1.24. |
How the Components Interact
A typical flow when you kubectl apply a Deployment:
kubectl → kube-apiserver → etcd (persist)
↓
kube-controller-manager
(Deployment controller creates ReplicaSet,
ReplicaSet controller creates Pods)
↓
kube-scheduler (assigns Pods to nodes)
↓
kubelet on worker node (pulls image, starts container)
↓
kube-proxy (updates iptables rules for Service)
Cluster Topology
kubectl get nodes
# NAME STATUS ROLES AGE VERSION
# control-plane-1 Ready control-plane 10d v1.29.3
# worker-1 Ready <none> 10d v1.29.3
# worker-2 Ready <none> 10d v1.29.3
kubectl get pods -n kube-system
# NAME READY STATUS RESTARTS
# etcd-control-plane-1 1/1 Running 0
# kube-apiserver-control-plane-1 1/1 Running 0
# kube-controller-manager-control-plane-1 1/1 Running 0
# kube-scheduler-control-plane-1 1/1 Running 0
# kube-proxy-xxxx 1/1 Running 0 (per node)
# coredns-xxxx 1/1 Running 0 (DNS add-on)
Add-on Components
These are not part of Kubernetes core but are required for a functional cluster:
- CoreDNS — the cluster DNS server; enables Pod-to-Service name resolution.
- CNI plugin (Calico, Cilium, Flannel) — implements Pod networking so Pods across nodes can communicate.
- Metrics Server — provides CPU and memory metrics used by
kubectl topand the Horizontal Pod Autoscaler.
Common Mistakes
- Confusing
kubeletwithkubectl.kubeletis the node agent that runs on every worker node and communicates with the container runtime.kubectlis the CLI tool used by humans to talk to thekube-apiserver. - Assuming
etcdis backed up automatically.etcdmust be explicitly backed up usingetcdctl snapshot save. Losingetcdwithout a backup means losing all cluster state. - Running control plane components on worker nodes. In production, control plane nodes should have a
NoScheduletaint so user workloads do not run alongsidekube-apiserverandetcd. - Forgetting that
kube-proxyis not a traditional proxy. It programs kernel-level rules (iptables/IPVS) to redirect traffic; it does not act as an HTTP proxy in the path of every request. - Using Docker as the runtime in Kubernetes 1.24+. The
dockershimwas removed. UsecontainerdorCRI-Oinstead.
Best Practices
- Run an odd number of
etcdmembers (3 or 5) for quorum-based high availability. - Use managed Kubernetes (EKS, GKE, AKS) when possible — the control plane is managed and backed up by the cloud provider.
- Monitor
kube-apiserverlatency andetcddisk latency; they are the primary bottlenecks in large clusters. - Keep
kubeletconfiguration consistent across nodes using configuration files rather than flags. - Regularly test disaster recovery by restoring from an
etcdsnapshot in a staging cluster.
Interview Questions
1. What are the components of the Kubernetes control plane?
The control plane consists of kube-apiserver (the REST API gateway), etcd (the cluster state store), kube-scheduler (assigns Pods to nodes), kube-controller-manager (runs all built-in reconciliation loops), and cloud-controller-manager (cloud-provider integration, present on cloud clusters).
2. What does the kubelet do?
The kubelet is an agent on every worker node. It watches the kube-apiserver for Pod specs assigned to its node, instructs the container runtime to start or stop containers, runs liveness and readiness probes, and reports Pod and node status back to the API server.
3. What is etcd and why is it critical?
etcd is the distributed key-value store that is the single source of truth for all cluster state. Every object you create — Deployments, Services, Secrets, ConfigMaps — is persisted in etcd. If etcd is lost without a backup, the entire cluster configuration is gone.
4. What is the role of kube-proxy?
kube-proxy runs on every node and maintains iptables (or IPVS) rules that map a Service ClusterIP/port to the actual Pod IP endpoints. When a Pod sends a request to a Service, the kernel redirects the packet to one of the healthy backing Pods.
5. How does the scheduler decide which node to place a Pod on?
The kube-scheduler runs in two phases: filtering (removes nodes that cannot satisfy the Pod's requirements — insufficient CPU/memory, taints, node affinity rules) and scoring (ranks remaining nodes by factors like available resources and spread). The Pod is assigned to the highest-scoring node.
6. What is the difference between kube-controller-manager and cloud-controller-manager?
kube-controller-manager runs built-in controllers (Node, ReplicaSet, Endpoints, ServiceAccount, etc.) that are cloud-agnostic. cloud-controller-manager runs controllers that require cloud-provider APIs — for example, provisioning a cloud load balancer when a Service of type LoadBalancer is created, or deleting a node object when the underlying cloud VM is terminated.
7. What happens to running Pods if the control plane goes down?
Already-running Pods continue to run. The kubelet keeps containers alive based on the last-known Pod spec. However, no new Pods are scheduled, no failed Pods are replaced, and kubectl commands fail — because all of those require the kube-apiserver. This is why control plane HA (multiple API server instances, multiple etcd members) is essential for production.
Summary
- The control plane (
kube-apiserver,etcd,kube-scheduler,kube-controller-manager) manages desired state and orchestration decisions. - Worker nodes run
kubelet(node agent),kube-proxy(network rules), and a container runtime. etcdis the single source of truth; back it up regularly.- All communication goes through
kube-apiserver; no component talks directly to another component's data store. - Add-ons like CoreDNS and a CNI plugin are required for a fully functional cluster.
Continue Learning
Previous: Kubernetes Introduction | Next: Pod
Was this guide helpful?
CodeWithVenu is free to read, with no paywall. If this guide saved you time or helped you prepare, a small voluntary contribution helps me write more practical tutorials, architecture guides, and interview-prep content.