Controller Manager: Maintaining Desired State
What You'll Learn
You'll learn how the kube-controller-manager continuously watches your cluster and takes action to ensure your declared configuration matches reality.
The Persistent Guardian of Your Cluster
Think of the controller manager as a tireless building superintendent. You tell them "I want 3 copies of this application always running," and they constantly check to make sure exactly 3 are running. If one crashes? They immediately start a replacement. Too many running? They remove the extras.
The kube-controller-manager is a single binary that runs multiple controllers—specialized loops that each watch a specific type of resource. These controllers communicate with the API Server (the gateway you learned about earlier) to observe current state and compare it against the desired state stored in etcd (the cluster database).
How Controllers Work
Each controller follows a simple pattern called the control loop or reconciliation loop:
- Observe: Watch the cluster's current state via the API Server
- Compare: Check if current state matches desired state
- Act: If there's a difference, take corrective action
- Repeat: Continuously loop forever
For example, the ReplicaSet Controller ensures the right number of pod replicas exist. The Node Controller monitors node health. The Endpoint Controller maintains service endpoint lists. Dozens of controllers run together inside this single manager process.
Why This Matters
This continuous reconciliation is what makes Kubernetes self-healing. You declare what you want once, and controllers work tirelessly to maintain it—even as conditions change, failures occur, or manual interventions happen.
Key Takeaway: The kube-controller-manager runs multiple controllers that constantly reconcile the cluster's actual state with your desired configuration, making Kubernetes self-healing and resilient.