Interview Prep/Kubernetes/Architecture & Control Plane

What does the kube-controller-manager do?

BeginnerConceptArchitecture & Control Plane
Answer

Short answer

The kube-controller-manager runs many small control loops (controllers). Each one keeps checking whether the actual state of the cluster matches the desired state you asked for, and fixes any difference automatically.

Explained in simple words

Think of an air conditioner with a thermostat. You set the desired temperature to 24°C. The thermostat keeps measuring the room. If it's 27°C, it cools; if it's 22°C, it stops. It never stops checking. Kubernetes controllers work exactly like that thermostat — this is called the reconcile loop, and it's what makes Kubernetes "self-healing".

Examples of built-in controllers

Controller Desired state it maintains
ReplicaSet controller "There should be 3 Pods" — if one dies, it creates a new one
Deployment controller Manages ReplicaSets during rolling updates and rollbacks
Node controller Notices when a node stops responding and moves its Pods
Job controller Runs Pods until a task completes successfully
EndpointSlice controller Keeps the list of Pod IPs behind each Service up to date
Namespace controller Cleans up everything inside a namespace when you delete it

Example — watch self-healing happen

kubectl create deployment web --image=nginx --replicas=3
kubectl get pods                       # 3 Pods running
kubectl delete pod web-xxxxx-abcde     # delete one by hand
kubectl get pods                       # a new Pod appears within seconds

What happened behind the scenes: the ReplicaSet controller noticed "desired 3, actual 2" and created a new Pod to close the gap.

What to say in the interview

"The controller manager runs the built-in controllers, such as the ReplicaSet, Deployment, Node, Job and EndpointSlice controllers. Each controller runs a reconcile loop: it watches the API server, compares the actual state with the desired state in the object's spec, and takes action to close the gap. For example, if a Deployment wants three replicas and one Pod dies, the ReplicaSet controller creates a new one. This reconcile pattern is what makes Kubernetes self-healing and declarative."

Follow-up questions you may get

  • Is the controller manager highly available? Yes — you can run several copies, but only one is active at a time, chosen by leader election.
  • Can you write your own controller? Yes — that's what an operator is: a custom controller that manages a custom resource, such as a database cluster.
All Kubernetes questions Roadmap: Kubernetes core

More on Architecture & Control Plane