Docker & Containers' Kubernetes lesson showed you how to write a Pod, a Deployment, and a Service — this lesson is about what's actually running the show underneath `kubectl apply`, since every object this domain covers is really just a request handed to this same machinery.
3 min read
A Kubernetes cluster is made of two categories of machines with completely different jobs:
kubectl apply doesn't talk to etcd or the scheduler
directly — it sends a request to the API server, which is the only
component every other piece of the system (and every kubectl command)
actually talks to.kubectl outputkubectl get pods and kubectl apply -f deployment.yaml are really just
API-server requests — every single kubectl command is a REST call against
that same central API. Understanding this reframes what's actually
happening when you write a Deployment YAML file and run kubectl apply:
you're not directly telling any machine to do anything. You're writing
desired state into etcd via the API server, and a controller (running
continuously, watching for exactly this kind of change) notices the gap
between desired and actual state and starts working to close it. Every
object covered in the rest of this domain — ConfigMaps, Ingress, autoscalers,
StatefulSets — is just a different kind of desired state written to the
same etcd, reconciled by a different controller watching for that kind.
A Pod stuck Pending almost always means the scheduler can't find a node
with enough resources — checking node capacity, not application code, is
the correct first move. A Pod's status not updating means either the
kubelet on its node is unreachable or the API server itself is degraded —
very different problems from an application bug, and kubectl describe node (not kubectl logs) is the right tool to start with. Knowing which
component is responsible for which kind of failure is what turns "the
cluster is being weird" into a specific, diagnosable problem.
Check your understanding
A quick comprehension check — not tracked, not graded, just for you.
1. Why does every kubectl command ultimately talk to the API server, rather than directly to etcd or the scheduler?
2. What does etcd actually store, and why is it described as the cluster's 'source of truth'?
3. What is the kubelet's role on a worker node?
Kubernetes