Introduction
- TL;DR: The Kubernetes Controller Manager (
kube-controller-manager) is a core control plane component that acts as the brain for cluster state management. It runs multiple controller processes in a single binary, with each controller responsible for reconciling the “current state” of a resource with its “desired state.” This mechanism, known as a “control loop” or “reconciliation loop,” is what gives Kubernetes its powerful self-healing and automation capabilities.
The Kubernetes Controller Manager is a daemon that embeds the core control loops shipped with Kubernetes. It watches the state of the cluster through the API server and makes changes attempting to move the current cluster state towards the desired state. This is the key principle behind Kubernetes’ declarative nature, where users define what they want, and the controllers figure out how to achieve it.
The Core Principle: The Control Loop
At the heart of every controller is the control loop. This concept is central to how Kubernetes automates operations. Every Kubernetes object has two key fields:
spec: The desired state defined by the user. For instance,replicas: 3in a Deployment object.status: The current state of the object, which is observed and updated by the Kubernetes system.
A controller’s job is to continuously execute a reconciliation loop:
- Watch: It watches for changes to its specific resources via the API server.
- Compare: It compares the
spec(desired state) with thestatus(current state). - Act: If there’s a difference, the controller takes action by making calls to the API server to bring the current state in line with the desired state.
Why it matters: This control loop pattern is the foundation of Kubernetes’ automation and self-healing. It ensures the cluster is always working to correct deviations from the user-defined state, making the system resilient and reducing operational overhead.
Major Built-in Controllers and Their Roles
The kube-controller-manager binary bundles many individual controllers. Understanding their distinct responsibilities is key to mastering Kubernetes workload management.
| Controller | Primary Role | Example Use Case |
|---|---|---|
| Node Controller | Monitors the health of nodes. Evicts pods from nodes that become unresponsive. | Automatically rescheduling applications when a server in the cluster fails. |
| ReplicaSet Controller | Ensures that a specified number of pod replicas are running at all times. | Maintaining high availability by keeping 3 replicas of a web server running. |
| Deployment Controller | Manages ReplicaSets to facilitate rolling updates and rollbacks for stateless applications. | Deploying a new version of an application with zero downtime. |
| StatefulSet Controller | Manages stateful applications, providing stable network IDs and persistent storage. | Running a database cluster like ZooKeeper or etcd that requires stable identity. |
| DaemonSet Controller | Ensures that all (or some) nodes run a copy of a pod. | Deploying a log collector or monitoring agent on every node in the cluster. |
| Job Controller | Manages pods for one-off tasks that are expected to run to completion. | Running a batch job for data processing or a database migration script. |
Why it matters: Each controller is designed for a specific type of workload. Choosing the correct controller (e.g., Deployment for stateless apps, StatefulSet for databases) is crucial for building robust and correctly behaving applications on Kubernetes.
How the Node Controller Works
The Node Controller is critical for cluster reliability. According to its default settings:
- It checks the state of each node every 5 seconds.
- If a node is unresponsive for 40 seconds, it’s marked as
Unreachable. - If the node remains
Unreachablefor an additional 5 minutes, the controller begins to evict the pods from that node. - If those pods were managed by a ReplicaSet, new pods are created on healthy nodes, thus restoring the application.
Relationship with the Cloud Controller Manager
To keep the core Kubernetes code cloud-agnostic, cloud-provider-specific logic has been moved out of the kube-controller-manager and into a separate component: the cloud-controller-manager. This component runs controllers that interact with the underlying cloud provider’s API. Key controllers it manages include:
- Node Controller: For checking the cloud provider to see if a node has been deleted.
- Route Controller: For setting up routes in the cloud provider’s networking infrastructure.
- Service Controller: For creating, updating, and deleting cloud provider load balancers.
Why it matters: This separation allows Kubernetes to run consistently on any cloud or on-premises environment. Cloud providers can develop and maintain their own integrations without contributing provider-specific code to the core Kubernetes project.
Conclusion
The Kubernetes Controller Manager is the unsung hero of cluster automation. It works tirelessly behind the scenes, using a simple yet powerful control loop pattern to ensure the cluster’s reality matches the user’s intent. While you may not interact with it directly, understanding its function is essential for diagnosing issues and appreciating the self-healing, declarative power of Kubernetes.
Summary
- The kube-controller-manager is a core control plane component that runs multiple controller processes.
- Its fundamental operating principle is the control loop, which reconciles the
desired state(spec) with thecurrent state(status). - Key built-in controllers include Node, ReplicaSet, Deployment, StatefulSet, and Job controllers, each managing a specific type of workload.
- The cloud-controller-manager separates cloud-specific logic, allowing Kubernetes to be cloud-agnostic.
References
- kube-controller-manager | Kubernetes | 2025-04-24 | https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/
- Controllers | Kubernetes | 2024-09-01 | https://kubernetes.io/docs/concepts/architecture/controller/
- Cloud Controller Manager | Kubernetes | 2025-02-11 | https://kubernetes.io/docs/concepts/architecture/cloud-controller/
- Kubernetes Controller Manager: A Gentle Introduction | Komodor | 2022-08-31 | https://komodor.com/learn/controller-manager/
- (TIL) Kube Controller Manager in Kubernetes | 간단한 코딩 공간 | 2025-03-09 | https://simple-coding-place.tistory.com/m/74
- [kubernetes] 쿠버네티스의 controller(컨트롤러)란? | 코드몽규의 삽질저장소 | 2022-04-10 | https://codemonkyu.tistory.com/entry/kubernetes