Kubernetes | Cluster Controller
Introduction: When we try to understand the working principle of K8S cluster, the controller must be a difficult point.
This is because there are many controllers, and the specific implementations are quite different; and the implementation of the controller uses some relatively obscure
mechanisms, which are not easy to understand. However, we cannot bypass the controller because it is the "brain" of the cluster.
When we try to understand the working principle of K8S cluster, the controller must be a difficult point. This is because there are many controllers, and the specific implementations are quite different; and the implementation of the controller uses some relatively obscure mechanisms, which are
not easy to understand. However, we cannot bypass the controller because it is the "brain" of the cluster. In today's article,
we analyze the design process of a simple refrigerator to deeply understand the generation, function and implementation of the cluster controller .
Big picture
The following picture shows the core components of the K8S cluster, including the database etcd , scheduler scheduler, cluster entry
API Server, controller Controller, service proxy kube -proxy and kubelet that directly manages specific business containers
. These components can be logically divided into three parts: the core component etc database, the entry component API Server that directly operates etcd , and other components.
The reason why "other components"
can be classified as one category here is that they can all be regarded as the controllers of the cluster.
The theoretical chapter
understands the cluster controller like this, and it works! < 5
Today we are going to talk about the principle of cluster controller.
Controller principle
Although the controller is a relatively complex component in the K8S cluster, the controller itself is not unfamiliar to us
. The washing machines, refrigerators, air conditioners, etc. we use every day all rely on the controller to work properly. In the controller principle section, we understand the
principle of the K8S cluster controller by thinking about the design process of a simple refrigerator.
Simple Refrigerator
This refrigerator consists of five components: the cabinet, the refrigeration system, the lighting system, the thermostat, and the door. The refrigerator has only
two functions: when someone opens the door of the refrigerator, the light in the refrigerator will automatically turn on; when someone presses the thermostat
, the refrigeration system will adjust the temperature in the refrigerator according to the temperature setting.
Unified entrance
For the refrigerator above, we can simply abstract it into two parts: the unified operation entrance and all the
components of the refrigerator. Here, the user can operate the refrigerator only through the entrance. This entrance provides the user with two interfaces:
opening and closing the door and adjusting the thermostat. When the user executes these two interfaces, the entrance will adjust the state of the refrigerator door and the thermostat respectively
.
It is possible to understand the cluster controller in this way! < 7
Controller
The controller is created to solve the above problems. The controller is a bridge between the user's operation and the correct state of each component of the refrigerator : when the user opens the door, the controller observes the change of the door, and it
turns on the light in the refrigerator for the user; when the user presses the temperature When the controller is activated, the controller observes the temperature set by the user, manages the refrigeration system for the user, and adjusts the temperature in the refrigerator.
Controller Manager The
refrigerator has a lighting system and a cooling system. Obviously, it
is a more reasonable choice for us to implement a controller for each component than to manage two components with one controller. At the same time, we implement a controller manager to
maintain all these controllers uniformly to ensure that these controllers are working properly.
8 > If you understand the cluster controller like this, you can do it!
The controller and controller manager on SharedInformer looks pretty good.
But when the function of the refrigerator is increased,
many new controllers are bound to be added. These controllers all need to monitor the status changes of the components they care about through the entrance of the refrigerator .
For example, the lighting system controller needs to monitor the status of the refrigerator door at all times. When a large number of controllers are constantly communicating with the inlet, it increases the pressure on the inlet.
At this time, we hand over the monitoring of the state changes of the refrigerator components to a new module
SharedInformer to implement. SharedInformer acts as an agent of the controller, monitors
the status changes of the refrigerator components for the controller, and notifies the corresponding controller of the status changes of different components according to the controller's preferences.
controller. Through optimization, such a SharedInformer can greatly relieve the pressure on the refrigerator inlet.
This is because there are many controllers, and the specific implementations are quite different; and the implementation of the controller uses some relatively obscure
mechanisms, which are not easy to understand. However, we cannot bypass the controller because it is the "brain" of the cluster.
When we try to understand the working principle of K8S cluster, the controller must be a difficult point. This is because there are many controllers, and the specific implementations are quite different; and the implementation of the controller uses some relatively obscure mechanisms, which are
not easy to understand. However, we cannot bypass the controller because it is the "brain" of the cluster. In today's article,
we analyze the design process of a simple refrigerator to deeply understand the generation, function and implementation of the cluster controller .
Big picture
The following picture shows the core components of the K8S cluster, including the database etcd , scheduler scheduler, cluster entry
API Server, controller Controller, service proxy kube -proxy and kubelet that directly manages specific business containers
. These components can be logically divided into three parts: the core component etc database, the entry component API Server that directly operates etcd , and other components.
The reason why "other components"
can be classified as one category here is that they can all be regarded as the controllers of the cluster.
The theoretical chapter
understands the cluster controller like this, and it works! < 5
Today we are going to talk about the principle of cluster controller.
Controller principle
Although the controller is a relatively complex component in the K8S cluster, the controller itself is not unfamiliar to us
. The washing machines, refrigerators, air conditioners, etc. we use every day all rely on the controller to work properly. In the controller principle section, we understand the
principle of the K8S cluster controller by thinking about the design process of a simple refrigerator.
Simple Refrigerator
This refrigerator consists of five components: the cabinet, the refrigeration system, the lighting system, the thermostat, and the door. The refrigerator has only
two functions: when someone opens the door of the refrigerator, the light in the refrigerator will automatically turn on; when someone presses the thermostat
, the refrigeration system will adjust the temperature in the refrigerator according to the temperature setting.
Unified entrance
For the refrigerator above, we can simply abstract it into two parts: the unified operation entrance and all the
components of the refrigerator. Here, the user can operate the refrigerator only through the entrance. This entrance provides the user with two interfaces:
opening and closing the door and adjusting the thermostat. When the user executes these two interfaces, the entrance will adjust the state of the refrigerator door and the thermostat respectively
.
It is possible to understand the cluster controller in this way! < 7
Controller
The controller is created to solve the above problems. The controller is a bridge between the user's operation and the correct state of each component of the refrigerator : when the user opens the door, the controller observes the change of the door, and it
turns on the light in the refrigerator for the user; when the user presses the temperature When the controller is activated, the controller observes the temperature set by the user, manages the refrigeration system for the user, and adjusts the temperature in the refrigerator.
Controller Manager The
refrigerator has a lighting system and a cooling system. Obviously, it
is a more reasonable choice for us to implement a controller for each component than to manage two components with one controller. At the same time, we implement a controller manager to
maintain all these controllers uniformly to ensure that these controllers are working properly.
8 > If you understand the cluster controller like this, you can do it!
The controller and controller manager on SharedInformer looks pretty good.
But when the function of the refrigerator is increased,
many new controllers are bound to be added. These controllers all need to monitor the status changes of the components they care about through the entrance of the refrigerator .
For example, the lighting system controller needs to monitor the status of the refrigerator door at all times. When a large number of controllers are constantly communicating with the inlet, it increases the pressure on the inlet.
At this time, we hand over the monitoring of the state changes of the refrigerator components to a new module
SharedInformer to implement. SharedInformer acts as an agent of the controller, monitors
the status changes of the refrigerator components for the controller, and notifies the corresponding controller of the status changes of different components according to the controller's preferences.
controller. Through optimization, such a SharedInformer can greatly relieve the pressure on the refrigerator inlet.
Related Articles
-
A detailed explanation of Hadoop core architecture HDFS
Knowledge Base Team
-
What Does IOT Mean
Knowledge Base Team
-
6 Optional Technologies for Data Storage
Knowledge Base Team
-
What Is Blockchain Technology
Knowledge Base Team
Explore More Special Offers
-
Short Message Service(SMS) & Mail Service
50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00