Kube Controller Manager

Overview

In Kubernetes, a controller acts like a department in an organization—each controller is tasked with handling a specific responsibility. For instance, one controller might monitor the health of nodes, while another ensures that the desired number of pods is always running. These controllers constantly observe system changes to drive the cluster toward its intended state.

The Node Controller, for example, checks node statuses every five seconds through the Kube API Server. If a node stops sending heartbeats, it is not immediately marked as unreachable; instead, there is a grace period of 40 seconds followed by an additional five minutes for potential recovery before its pods are rescheduled onto a healthy node.

Example: Checking Node Statuses

kubectl get nodes
NAME         STATUS   ROLES    AGE   VERSION
worker-1     Ready    <none>   8d    v1.13.0
worker-2     Ready    <none>   8d    v1.13.0

In the case where a node fails to recover, the output might look like this:

kubectl get nodes
NAME         STATUS     ROLES    AGE   VERSION
worker-1     Ready      <none>   8d    v1.13.0
worker-2     NotReady   <none>   8d    v1.13.0

Another essential controller is the Replication Controller, which ensures that the specified number of pods is maintained by creating new pods when needed. This mechanism reinforces the resilience and reliability of your Kubernetes cluster.

How Controllers Are Packaged

All individual controllers are bundled into a single process known as the Kubernetes Controller Manager. When you deploy the Controller Manager, every associated controller is started together. This unified deployment simplifies management and configuration.

Installing and Configuring the Kube Controller Manager

To install and view the Kube Controller Manager, follow these steps:

  1. Download the Kube Controller Manager from the Kubernetes release page.

  2. Extract the binary and run it as a service.

  3. Review the configurable options provided, which allow you to tailor its behavior.

Downloading the Controller Manager

Sample Service Configuration

Below is an example of a service file (kube-controller-manager.service) used to run the Controller Manager:

This configuration includes additional options for the Node Controller, such as node monitor period, grace period, and eviction timeout. Additionally, you can control which controllers are enabled through the --controllers flag.

Example of Specifying Controllers

Viewing the Controller Manager in Action

Depending on your cluster setup, the Controller Manager may run as a pod in the kube-system namespace (if set up using kubeadm) or as a system service. In kubeadm-based clusters, you can inspect the pod definition located in the /etc/kubernetes/manifests directory.

Service Configuration Example (Non-Kubeadm Environments)

Checking the Running Process

To verify that the Kube Controller Manager is running and to inspect its active options, execute the following command on the master node:

An example output might be:

Last updated