Kubernetes Architecture
Kubernetes is a declarative container orchestration platform split into a control plane and worker nodes. Learn which component does what, and how a request travels from kubectl to a running pod.
What is this?
Kubernetes is a declarative container orchestration platform: you describe the desired state (which images, how many replicas, which ports) and the platform works to make reality match that state. A cluster is split into a control plane, which makes global decisions, and worker nodes, which actually run the workloads. Every interaction flows through the kube-apiserver, the single API endpoint that persists cluster state to etcd.
Why do you need it?
- The control plane runs controllers that continuously reconcile the current state toward the declared desired state.
- Every component talks to the API server through a versioned API, which makes the cluster extensible, auditable and scriptable.
- Scheduling, scaling and self-healing happen centrally, so application code does not need to manage infrastructure.
- Knowing the components is the foundation for diagnosing nearly every production incident in Kubernetes.
Mental model
An air traffic control tower
The Kubernetes control plane
Tower controllers coordinate every aircraft and hand off routing instructions; they do not fly the planes. The control plane coordinates every workload and schedules it onto worker nodes, while the kubelet on each node does the actual running.
How it works
- You submit declarative desired state to the kube-apiserver with kubectl or the REST API.
- The API server authenticates and validates the request, then persists the object to etcd.
- The kube-scheduler watches for unassigned pods and picks the best node for each one.
- The kubelet on that node pulls container images and starts the containers, reporting status back through the API.
- Controllers such as the deployment, node and endpoints controllers compare current state to desired state and correct any drift.
How a kubectl request travels through the control plane to a worker node.
Key commands
kubectl cluster-infoShow the control plane and CoreDNS endpoint URLs.
Kubernetes control plane is running at https://192.168.49.2:8443 CoreDNS is running at https://192.168.49.2:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
kubectl get nodes -o wideList nodes with roles, Kubernetes version and container runtime.
kubectl get pods -AList pods across all namespaces.
kubectl describe node minikubeShow capacity, allocatable resources, conditions and taints for a node.
kubectl get events --sort-by=.lastTimestamp -AShow recent cluster events sorted by time, useful for diagnosing failures.
kubectl api-resourcesList every API resource type with its API group, kind and verbs.
Examples
Declarative desired state
apiVersion: v1kind: Podmetadata: name: webspec: containers: - name: nginx image: nginx:1.25This manifest declares a desired state: one nginx pod named web. kubectl apply sends it to the kube-apiserver, which validates it and stores it in etcd. The scheduler assigns a node and the kubelet starts nginx. Because no controller owns this pod, it is not recreated if it dies — controllers such as Deployment add that guarantee.
In production
- Teams run the control plane as a managed service (EKS, GKE, AKS) so they do not patch etcd or API servers by hand.
- Multiple namespaces with RBAC and resource quotas isolate teams on one shared control plane.
- Scaling is declarative: bump replicas and the controllers and scheduler handle the rest.
- Auditability: every change is a versioned API call recorded in etcd and visible through events and audit logs.
Best practices
- Use kubectl apply with GitOps-tracked manifests; avoid imperative kubectl create and kubectl edit in production.
- Back up etcd regularly and rehearse restore drills, since etcd holds the entire cluster state.
- Keep etcd on fast SSD storage with low fsync latency and away from noisy CPU neighbors.
- Use namespaces with RBAC and quotas so permissions and blast radius stay small.
Common mistakes
- Fixing live objects with kubectl edit and losing the git source of truth.
- Assuming the API server is reachable on port 8080 without a kubeconfig.
- Ignoring etcd disk latency, which silently degrades the whole cluster.
- Scheduling workloads on control plane nodes and exhausting their resources.
Common issues
Node status stays NotReadykubelet is down, the node lost network connectivity, or disk pressure set a condition.
Check the node with kubectl describe node, then verify the kubelet service and node network; free disk if pressure is reported.
The connection to the server localhost:8080 was refusedkubectl cannot find or use a kubeconfig, so it falls back to localhost:8080.
Point kubectl at the right config with kubectl --kubeconfig /path/to/config or export KUBECONFIG.
etcdserver: request timed outSlow disk or overloaded etcd node slows every API write.
Check etcd health and disk fsync latency, then move etcd to dedicated nodes with fast SSDs.
Debugging tips
- kubectl describe node <name> shows capacity, conditions and taints for scheduling failures.
- kubectl get events --sort-by=.lastTimestamp -A surfaces controller and kubelet errors.
- kubectl api-resources and kubectl explain <resource> reveal the exact API schema.
- Check kubelet logs (journalctl -u kubelet) when a node reports NotReady.
Interview checkpoint
Quick quiz
Which component is the front door for all API requests?
etcd stores both the desired and the observed state of the cluster.
Which control plane component decides which node a pod runs on?
Cheat sheet
kubectl cluster-infoControl plane + CoreDNS endpointskubectl get nodes -o wideNode roles, versions, runtimekubectl describe node NAMECapacity, conditions, taintskubectl get events --sort-by=.lastTimestamp -ARecent cluster eventskubectl api-resourcesDiscover all API resource types