As we will demonstrate later, a central concept of Kubernetes, and the reason why you'd use a Cluster Management Tool in the first place, is that you don't have to manually manipulate the cluster yourself.
Doing so will consist of sending a request to one component, receiving a response, and based on that response, sending another request to another component. This is the imperative approach, and is time-consuming because it requires you to manually write programs to implement this logic.
Instead, Kubernetes allows us to specify the desired state of our cluster using configuration files, and Kubernetes will automatically coordinate the different Kubernetes Components to make it happen. This is the declarative approach and is what Kubernetes recommends.
Linking this to what we already know, the job of the whole Kubernetes system (the Control Plane) then becomes a system that tries to align the current state of the cluster with the desired state.
Kubernetes does this through Controllers. Controllers are the processes that actually carry out the actions of keeping the state of the cluster with the desired state.
There are many types of controllers; here are two examples:
- Node Controllers, for ensuring that the cluster has the desired number of nodes. For example, when a node fails, the Node Controller is responsible for spawning a new node.
- Replication Controllers, for ensuring each application has the desired number of replicas.
The role of controllers for kube-controller-manager become clearer once we've explained Kubernetes Objects and deploy our first service on Kubernetes.