Skip to main content

Kubernetes Architecture

The one-sentence version

Kubernetes is a reconciliation engine: you declare desired state, controllers continuously compare it against actual state, and act to close the gap.

Everything else is a consequence of that loop.

The control loop

This is the idea that makes the rest of Kubernetes make sense.

You never tell Kubernetes to do something. You tell it what should be true, and a controller works continuously to make it so. Delete a pod managed by a Deployment and it comes back — not because deletion failed, but because actual state no longer matched desired state.

Control plane vs nodes

ComponentJob
kube-apiserverValidates and persists all state. Everything talks through it.
etcdDistributed key-value store — the single source of truth
kube-schedulerPicks a node for each unassigned pod
controller-managerRuns the reconciliation loops
kubeletNode agent; ensures its assigned pods are running
kube-proxyImplements Service networking on the node

Two things follow from this shape. The API server is the only component that talks to etcd, which is why it is the security boundary worth hardening. And because the kubelet reports in rather than being pushed to, a node losing contact does not stop its containers — they keep running while the control plane marks the node NotReady.

The workload hierarchy

ObjectGuarantees
PodOne or more containers sharing a network namespace and volumes
ReplicaSetExactly N identical pods exist
DeploymentManages ReplicaSets; rolling updates and rollbacks
StatefulSetStable identity, stable storage, ordered startup
ServiceA stable address for a changing set of pods

Pods are ephemeral — they get new names and new IPs constantly. That is precisely why Services exist: a Service is a fixed name and IP that selects pods by label, so callers never need to know which pods exist right now.

Service types

Each type builds on the previous one.

TypeReachable fromMechanism
ClusterIPInside the cluster onlyVirtual IP, load-balanced by kube-proxy
NodePortOutside, via any node IPClusterIP + a fixed port on every node
LoadBalancerOutside, via a cloud LBNodePort + a provisioned external LB

For HTTP specifically an Ingress is usually the answer instead — one load balancer with host and path routing plus TLS termination, rather than one cloud load balancer per service. Ingress does nothing on its own; it needs a controller such as nginx or Traefik running in the cluster.

Health probes

Two probes with different consequences, and mixing them up causes outages.

ProbeQuestionOn failure
readinessCan this pod serve traffic yet?Removed from Service endpoints
livenessIs this pod still functioning?Container is restarted
startupHas it finished booting?Delays the other probes

A liveness probe that is too aggressive on a slow-starting app produces a restart loop: the app never finishes booting before being killed. That is what startup probes exist to prevent.

Questions

Loading questions…

Learn more