Guide

Kubernetes is a set of programs that watch objects you store in one API. Each program compares what the object asks for with what is actually running, and acts to close the gap. This page covers the parts and the loop that makes the cluster heal itself.

Concept

A reconciliation loop is a controller that repeatedly checks desired state (what you wrote to the API) against observed state (what is running). When they differ, it takes an action. A deleted pod is replaced because the loop sees one fewer pod than it should.

The big idea

You never tell a node to start a container. You write an object, and the controllers do the rest. If something breaks later, the same loops notice and repair it.

The loop only heals what it can fix. A pod stuck in Pending or CrashLoopBackOff is still in the desired state, but the loop cannot make it run. Those states are your signal to look closer.

The parts

ComponentRuns onJob
API serverControl planeThe only front door. Authenticates, validates and stores objects.
etcdControl planeStrongly consistent store for cluster state. If it is unhealthy, the cluster cannot safely change.
SchedulerControl planePicks a node for each pod with no node yet, and binds it.
Controller managerControl planeRuns built-in loops such as Deployment, ReplicaSet and Node controllers.
kubeletEach worker nodeStarts and stops containers for pods bound to its node. Reports status.
Container runtimeEach worker nodeRuns the container image, usually containerd.

Walking through a deployment

Say you apply a Deployment with replicas: 3. Here is what happens:

  1. The API server authenticates you, checks permissions, and stores the Deployment in etcd.
  2. The Deployment controller creates a ReplicaSet with a desired count of 3.
  3. The ReplicaSet controller creates three Pod objects. None has a node yet, so each is Pending.
  4. The scheduler finds a node with room for each pod and writes the node name into the pod.
  5. The kubelet on that node pulls the image and starts the container.
  6. The pod reports Ready, and traffic can flow to it.

If step 5 fails, the pod stays in a visible state such as ImagePullBackOff or CrashLoopBackOff. The API is the source of truth. kubectl get only reads it.

Managed services (EKS, GKE, AKS) run this control plane for you. You still own the worker nodes and everything you deploy.

Common mistakes

  • Thinking kubectl is the cluster. It is a client. The state lives in the API and etcd.
  • Ignoring intermediate states. Pending, ContainerCreating and ImagePullBackOff each point to a different layer.
  • Running etcd yourself without a reason. Its health gates every change to the cluster.

Check yourself

  1. You delete one pod owned by a ReplicaSet with 3 replicas. What happens? The ReplicaSet controller sees 2 pods, creates a replacement, and the scheduler places it.
  2. Why does a new pod sit in Pending? It has no node name yet, so the scheduler has not found a node that fits it.

Key takeaways

  • Kubernetes is a set of reconciliation loops over desired state in the API.
  • Controllers create objects, the scheduler places pods, and kubelets start containers.
  • A visible intermediate state tells you which step is stuck.

Further learning

Next, learn which workload object fits your app in pods and workload objects. The official overview is the reference.

Kubernetes concepts (official docs)The Concepts section helps you learn about the parts of the Kubernetes system and the abstractions Kubernetes uses to represent your cluster, and helps you obtain a deeper understanding of how Kubernetes works.Kubernetes