Cloud Notes
Detailed exploration of Kubernetes architecture including control plane components, worker nodes, networking model, and how they work together.
Kubernetes follows a master-worker architecture where the control plane makes global decisions about the cluster while worker nodes run the actual application workloads. Understanding this architecture is fundamental to operating and troubleshooting Kubernetes effectively.
Complete Architecture Diagram
Control Plane Components
1. kube-apiserver
The frontend for the Kubernetes control plane. All communication goes through the API server.
# All kubectl commands go through the API server
kubectl get pods # GET /api/v1/namespaces/default/pods
kubectl create -f deployment.yaml # POST /apis/apps/v1/deployments
# Direct API call
curl -k https://kubernetes-api:6443/api/v1/pods \
--header "Authorization: Bearer $TOKEN"2. etcd
Distributed key-value store that holds all cluster state.
# Check etcd cluster health
etcdctl endpoint health
etcdctl endpoint status --write-out=table
# Backup etcd (critical for disaster recovery)
etcdctl snapshot save /backup/etcd-snapshot.db \
--endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key
# Restore from backup
etcdctl snapshot restore /backup/etcd-snapshot.db3. kube-scheduler
Assigns pods to nodes based on resource requirements and constraints.
# Pod with scheduling constraints
apiVersion: v1
kind: Pod
metadata:
name: gpu-workload
spec:
nodeSelector:
gpu: "true"
tolerations:
- key: "nvidia.com/gpu"
operator: "Exists"
effect: "NoSchedule"
containers:
- name: ml-training
image: tensorflow/tensorflow:latest-gpu
resources:
limits:
nvidia.com/gpu: 14. Controller Manager
Runs controllers that reconcile desired state with actual state:
- Deployment Controller: Manages replica sets
- Node Controller: Monitors node health
- Job Controller: Manages batch jobs
- Service Account Controller: Creates default accounts
Worker Node Components
kubelet
# kubelet status
systemctl status kubelet
# kubelet configuration
cat /var/lib/kubelet/config.yamlkube-proxy
Maintains network rules on nodes for service communication.
# kube-proxy modes
# iptables mode (default)
iptables -t nat -L KUBE-SERVICES
# IPVS mode (better performance at scale)
ipvsadm -L -nKubernetes Networking Model
| Node 1 | Node 2 | |||
|---|---|---|---|---|
| Pod A | ◄──────► | Pod C | Cross-node via | |
| 10.244.1.2 | CNI | 10.244.2.3 | overlay network | |
| (Calico/Flannel/ | ||||
| Pod B | Pod D | Cilium) | ||
| 10.244.1.3 | 10.244.2.4 |
Interview Questions
- Describe the Kubernetes control plane components and their roles.
API Server (REST API gateway, authentication), etcd (distributed state store), Scheduler (pod-to-node assignment), Controller Manager (reconciliation loops maintaining desired state), Cloud Controller Manager (cloud provider integration for LBs, storage).
- What is etcd and why is it critical in Kubernetes?
etcd is a distributed key-value store that holds all cluster state — deployments, services, secrets, configurations. If etcd is lost without backup, the entire cluster state is lost. It uses Raft consensus for consistency across replicas.
- How does the Kubernetes scheduler decide where to place a pod?
Filtering: eliminates nodes that don't meet requirements (resources, taints, affinity). Scoring: ranks remaining nodes by criteria (resource balance, locality). The pod is assigned to the highest-scoring node. Custom schedulers can override this logic.
- Explain how kube-proxy enables service networking.
kube-proxy runs on each node and maintains network rules (iptables or IPVS) that map Service ClusterIPs to pod IPs. When traffic hits a service IP, kube-proxy routes it to a healthy pod backend, providing load balancing and service discovery.
- What happens when a worker node fails in Kubernetes?
The Node Controller (in Controller Manager) detects the node is unresponsive after a timeout period. It marks the node as NotReady. After a grace period, pods on that node are evicted and rescheduled to healthy nodes by the scheduler, maintaining the desired replica count.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Kubernetes Architecture.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Cloud Computing topic.
Search Terms
cloud-computing, cloud computing, cloud, computing, containers, and, orchestration, kubernetes
Related Cloud Computing Topics