tezvyn:

kube-controller-manager: The Cluster's Reconciliation Engine

AI-drafted, machine-checkedSource: kubernetes.ioadvanced
kube-controller-manager: The Cluster's Reconciliation Engine

The kube-controller-manager is Kubernetes' reconciliation engine, running multiple control loops to make the cluster's actual state match your desired state. It handles tasks like ensuring a Deployment has the correct pod count.

WHY IT EXISTS Kubernetes is a declarative system: you define a desired state, and the system makes it happen. The kube-controller-manager is the core component that actively bridges the gap between your declaration and the cluster's live state, ensuring what you asked for is what you have.

THE MENTAL MODEL Think of the kube-controller-manager as a team of tireless, specialized managers watching over a factory floor (your cluster). One manager only watches for broken machines (nodes), another ensures production lines have enough workers (pods per ReplicaSet), and a third updates the company directory when a new worker starts (Endpoints for a Service). They all get their assignments from the main office (the API server) and work independently to correct any deviations they observe.

HOW IT WORKS The kube-controller-manager is a single daemon that bundles many logically independent control loops into one binary. Each controller tracks a specific resource type by watching the API server. When a controller detects a mismatch between the resource's desired state (its spec) and its actual state (its status), it takes corrective action through the API server. For example, if a Deployment requires 3 replicas but only 2 are running, the deployment controller will create a new ReplicaSet, and the ReplicaSet controller will then create a new Pod to close the gap.

WHEN TO USE IT As an end-user, you don't interact with the kube-controller-manager directly. It's a fundamental part of the control plane that runs on master nodes. It's the engine that makes declarative commands like kubectl apply work and enables Kubernetes' self-healing capabilities. Its presence is what makes a collection of nodes into a functioning, responsive cluster.

WHEN NOT TO USE IT You never run your own application logic inside the kube-controller-manager. For custom, application-specific control loops (like managing a database cluster declaratively), the correct pattern is to build a custom controller, often called an Operator. Modifying the core controller manager itself is reserved for those developing Kubernetes.

ONE CANONICAL EXAMPLE The node controller is a prime example. It's responsible for checking the health of nodes in the cluster. If a node stops sending heartbeats (becomes unreachable), the node controller marks it as NotReady. After a configurable timeout, it will evict all the pods from that dead node, allowing them to be rescheduled by the kube-scheduler onto healthy nodes. This is an automatic, non-negotiable part of keeping the cluster healthy.

Read the original → kubernetes.io

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.