Cloud component management method and device, medium and equipment

By deploying node executors on service nodes, it automatically compares and adjusts the monitoring parameters of Kubernetes cluster components, solving the problems of complex cluster management and Ansible performance bottlenecks, and achieving high efficiency and flexibility in component management.

CN118714033AActive Publication Date: 2024-09-27SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD

Patent Information

Application Number
CN202410713990.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-09-27
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

The complexity of component management in Kubernetes clusters and the performance bottleneck of the Ansible tool when the number of nodes increases.

Method used

Deploy the node executor on the service node, and obtain and compare the expected and actual values ​​of the monitoring parameters of the component deployment instance. If there is continuous inconsistency, it will be marked as parameter inconsistency, and an update action will be triggered to adjust the actual value of the monitoring parameter to the expected value to achieve component management. automation and flexibility.

Benefits of technology

It effectively avoids the management bottleneck caused by the increase in the number of nodes in the Kubernetes cluster, realizes the automatic update and status consistency of component deployment instances, and improves the efficiency and scalability of cluster management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118714033A
    Figure CN118714033A
Patent Text Reader

Abstract

The invention provides a cloud component management method and device, a medium and equipment. The method comprises the following steps: acquiring a monitoring parameter expected value; running the first monitoring process to enable the first monitoring process to periodically obtain the actual value of the monitoring parameter of the component deployment instance; comparing the actual value of the monitoring parameter with the expected value of the monitoring parameter; if N consecutive comparison results are inconsistent, marking the parameter state of the component deployment instance as parameter inconsistency, so that after a controller deployed on the control node captures the change of the parameter state of the component deployment instance, a management mark of the component deployment instance is set to be updated, and a node actuator is notified; and when the notification message is received, executing an updating action on the component deployment instance, so that the actual value of the monitoring parameter of the component deployment instance is adjusted towards the direction of the expected value of the monitoring parameter. According to the embodiment of the invention, the problem of management bottleneck of the Kubernetes cluster caused by increase of the number of nodes in the Kubernetes cluster is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of container technology, and in particular to a cloud component management method, device, medium, and equipment. Background Art

[0002] With the development and widespread popularity of Docker container technology, cloud-native applications and container scheduling and management system technologies have also gradually evolved. Kubernetes is an open source container cluster management system that, based on Docker technology, provides a series of functions such as deployment and operation, resource scheduling, service discovery, and dynamic scaling for containerized applications, improving the convenience of large-scale container cluster management.

[0003] A Kubernetes cluster is usually composed of a distributed storage system etcd, service nodes, and control nodes. All cluster states are stored in etcd. Control components that manage the cluster are deployed on control nodes, while service nodes are nodes that actually run application containers. Node agent components are running on each service node, which communicate with the control component to pull and run the node's container.

[0004] The large number of components in a Kubernetes cluster complicates the deployment and upgrade of the Kubernetes cluster. Ansible is an automated operation and maintenance tool that can realize automated deployment and management of components in a Kubernetes cluster. However, as the number of nodes in a Kubernetes cluster increases, Ansible's management of cluster components encounters performance bottlenecks. Summary of the invention

[0005] In response to at least one of the above technical problems, an embodiment of the present invention provides a cloud component management method, apparatus, medium, and equipment.

[0006] In a first aspect, a cloud component management method provided by an embodiment of the present invention is executed by a node executor deployed on a service node, and the method includes:

[0007] Obtaining expected values ​​of monitoring parameters predefined for a component deployment instance of the cloud component to be managed on the service node;

[0008] Running a first monitoring process so that the first monitoring process periodically calls a parameter acquisition interface of the component deployment instance to obtain an actual value of a monitoring parameter of the component deployment instance;

[0009] After obtaining the actual value of the monitoring parameter each time, comparing the actual value of the monitoring parameter with the expected value of the monitoring parameter;

[0010] If the comparison results for N consecutive times are all inconsistent, the parameter state of the component deployment instance is marked as parameter inconsistency, so that the controller deployed on the control node sets the management flag of the component deployment instance to update after capturing the change in the parameter state of the component deployment instance, and notifies the node executor; wherein N is a first preset threshold;

[0011] Upon receiving a notification message from the controller indicating that the management flag of the component deployment instance is set to update, an update action is performed on the component deployment instance to adjust the actual value of the monitoring parameter of the component deployment instance toward the expected value of the monitoring parameter.

[0012] In one embodiment, the predefined expected value of the monitoring parameter is in the form of a structure, and the structure of the expected value of the monitoring parameter includes a common part and an additional part; the common part is used to define the parameters that need to be monitored for different component deployment instances of the cloud component to be managed; the additional part is used to define the parameters, parameter acquisition method or parameter calculation method that need to be monitored for the component deployment instances that meet the preset conditions in each component deployment instance of the cloud component to be managed, and the additional part includes selection parameters for matching component deployment instances and parameters, parameter value acquisition method or parameter value calculation expression that need to be monitored for the matched component deployment instances, the selection parameters are used to determine whether the component deployment instance meets the preset conditions, the parameter value acquisition method is used to define the acquisition source of the expected value of the monitoring parameter, and the parameter value calculation expression is used to define the calculation expression of the expected value of the monitoring parameter;

[0013] A component deployment instance of the cloud component to be managed is deployed on a service node, and different component deployment instances of the cloud component to be managed are deployed on different service nodes.

[0014] In one embodiment, before running the first monitoring process, the method further includes:

[0015] Detecting whether the component deployment instance on the node executor maintains a connection with the controller based on a heartbeat detection mechanism;

[0016] If it is detected that the connection is not maintained, the controller marks the component deployment instance as not ready and resets the node executor where the component deployment instance marked as not ready is located, so that the component deployment instance on the node executor is reconnected to the controller.

[0017] In one embodiment, the detecting whether the component deployment instance on the node executor maintains a connection with the controller based on a heartbeat detection mechanism includes:

[0018] Performing an election operation on each component deployment instance on the service node so that the component deployment instance on the service node is elected as a leader;

[0019] renewing the lease of said leader;

[0020] The controller periodically detects whether the lease of the leader on the node executor has expired. If it is detected that the lease has expired and has not been renewed, the leader is marked as having expired and not been renewed, and the time when the lease expiration and non-renewal are detected is used as a first timestamp; within a tolerance period after the first timestamp, if the controller detects that the lease has been renewed, the mark of lease expiration and non-renewal is cleared; if no renewal is detected after the tolerance period, the component deployment instance is marked as not ready to indicate that the component deployment instance on the node executor is not connected to the controller.

[0021] In one embodiment, the method provided by the embodiment of the present invention further includes:

[0022] Obtaining an instance deployment state expected value predefined for the component deployment instance of the cloud component to be managed on the service node;

[0023] Running a second monitoring process so that the second monitoring process periodically calls an instance deployment information query interface to query the instance deployment status corresponding to the component deployment instance. If the status code queried M times in succession indicates that the instance deployment status does not exist, the instance deployment status of the component deployment instance is set to not found, so that after the controller captures the change of the instance deployment status corresponding to the component deployment instance, the management flag of the component deployment instance is set to reset and the node executor is notified; wherein M is a second preset threshold;

[0024] Upon receiving a notification message sent by the controller indicating that the management flag of the component deployment instance is set to reset, a reset action is performed on the component deployment instance so that the component deployment instance is initialized to the expected value of the instance deployment state.

[0025] In one embodiment, the method provided by the embodiment of the present invention further includes:

[0026] During the deployment process of the component deployment instance, the instance deployment information corresponding to the component deployment instance is written into a local file; wherein the instance deployment information includes the instance deployment state;

[0027] When the local file changes, reload the instance deployment information in the local file and provide an instance deployment information query interface;

[0028] Among them, when the instance deployment information query interface is called, if the instance deployment status exists in the local file, the first status code indicating the existence of the instance deployment status and the instance deployment status are returned; if the instance deployment status does not exist in the local file, the second status code indicating the non-existence of the instance deployment status is returned.

[0029] In one embodiment, the method provided by the embodiment of the present invention also includes: pre-defining a reset script corresponding to the reset action in the metadata resources of the cloud component to be managed; correspondingly, performing the reset action on the component deployment instance includes: executing the reset script on the component deployment instance.

[0030] According to a second aspect, a cloud component management device provided by an embodiment of the present invention is deployed on a node executor of a service node, and the device includes:

[0031] A first acquisition module is used to acquire an expected value of a monitoring parameter predefined for a component deployment instance of a cloud component to be managed on the service node;

[0032] A first running module, used for running a first monitoring process, so that the first monitoring process periodically calls the parameter acquisition interface of the component deployment instance to obtain the actual value of the monitoring parameter of the component deployment instance;

[0033] A first comparison module, configured to compare the actual value of the monitoring parameter with the expected value of the monitoring parameter each time the actual value of the monitoring parameter is obtained;

[0034] A first marking module is used to mark the parameter state of the component deployment instance as inconsistent if the comparison results for N consecutive times are all inconsistent, so that the controller deployed on the control node sets the management flag of the component deployment instance to update after capturing the change in the parameter state of the component deployment instance, and notifies the node executor; wherein N is a first preset threshold;

[0035] The update processing module is used to perform an update action on the component deployment instance upon receiving a notification message sent by the controller indicating that the management flag of the component deployment instance is set to be updated, so as to adjust the actual value of the monitoring parameter of the component deployment instance toward the expected value of the monitoring parameter.

[0036] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method provided in the first aspect.

[0037] According to a fourth aspect, an embodiment of the present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.

[0038] The cloud component management method, apparatus, medium, and device provided in the embodiments of the present invention predefine corresponding expected values ​​of monitoring parameters for component deployment instances of the cloud components to be managed on service nodes. The node executor runs a first monitoring process, so that the first monitoring process periodically calls the parameter acquisition interface of the component deployment instance to obtain the actual values ​​of the monitoring parameters of the component deployment instance, compares the expected values ​​of the monitoring parameters with the actual values ​​of the monitoring parameters, and if the comparison results are inconsistent for N consecutive times, then the parameter status of the component deployment instance is marked as inconsistent parameters. After capturing the changes in the parameter status of the component deployment instance, the controller sets the management flag of the component deployment instance to update and notifies the node executor. The node executor that receives the notification performs an update action on the component deployment instance, so that the actual values ​​of the monitoring parameters of the component deployment instance are adjusted in the direction of the expected values ​​of the monitoring parameters. It can be seen that since the method provided by the embodiment of the present invention is executed by the node executor deployed on the service node, the node executor on each service node is responsible for updating the component deployment instance on the service node. Even if the number of nodes in the Kubernetes cluster increases, the actual value of the monitoring parameter of the component deployment instance will be adjusted toward the expected value of the monitoring parameter, thereby avoiding management bottleneck problems in the Kubernetes cluster due to the increase in the number of nodes in the Kubernetes cluster. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a flowchart of a cloud component management method according to an embodiment of the present invention;

[0040] Figure 2 It is a structural block diagram of a cloud component management device in one embodiment of the present invention. DETAILED DESCRIPTION

[0041] With the emergence of custom resource + controller technology for Kubernetes clusters, the performance bottleneck in Ansible's management of cluster components has been broken. Based on custom resource + controller technology, each component in the Kubernetes cluster is abstracted as a custom resource, and the controller completes the management of the entire life cycle of the component, including deployment, expansion, reduction, upgrade, deletion, and update.

[0042] On this basis, in a first aspect, an embodiment of the present invention provides a cloud component management method, which is executed by a node executor deployed on a service node, see Figure 1The method comprises the following steps S110 to S150:

[0043] S110, obtaining expected values ​​of monitoring parameters predefined for a component deployment instance of the cloud component to be managed on the service node;

[0044] Among them, the cloud component to be managed is an abstract concept. When it is deployed on a service node, it is called a component deployment instance. One component deployment instance of the cloud component to be managed is deployed on one service node, and different component deployment instances of the cloud component to be managed are deployed on different service nodes.

[0045] Among them, a node executor is also deployed on each service node. The node executor can be called an Agent. The Agent on each service node is responsible for the management of the component deployment instance on the service node, including update, reset, etc.

[0046] Among them, it is necessary to pre-define monitoring information for the component deployment instance of the cloud component to be managed on each service node, and the monitoring information includes expected values ​​of monitoring parameters, expected values ​​of instance deployment status, etc. Specifically, the definition of expected values ​​of monitoring parameters can be introduced in the component deployment instance resource, and the definition of expected values ​​of instance deployment status can be introduced in the cloud component metadata resource. For example, the expected values ​​of monitoring parameters can be introduced in the structure in the component deployment instance resource, and the expected values ​​of instance deployment status can be introduced in the structure in the cloud component metadata resource.

[0047] In one embodiment, the predefined expected value of the monitoring parameter can be in the form of a structure, and the structure of the expected value of the monitoring parameter includes a common part and an additional part; the common part is used to define the parameters that need to be monitored for different component deployment instances of the cloud component to be managed; the additional part is used to define the parameters that need to be monitored, the parameter acquisition method or the parameter calculation method of the component deployment instances that meet the preset conditions in each component deployment instance of the cloud component to be managed, and the additional part includes selection parameters for matching component deployment instances and the parameters that need to be monitored by the matched component deployment instances, the parameter value acquisition method or the parameter value calculation expression, the selection parameter is used to determine whether the component deployment instance meets the preset condition, the parameter value acquisition method is used to define the acquisition source of the expected value of the monitoring parameter, and the parameter value calculation expression is used to define the calculation expression of the expected value of the monitoring parameter.

[0048] It can be seen that in order to realize the flexible monitoring of component deployment instances by Agent, the structure of monitoring parameter expected values ​​includes a common part and an additional part.

[0049] The common part defines the parameters that should be monitored by different component deployment instances of the same cloud component. This field can be declared as all according to the application scope, and the type can be an array. The elements of the array are the parameters to be monitored and their expected values.

[0050] The additional part can define the parameters that need to be monitored for component deployment instances that meet preset conditions, the parameter acquisition method or the parameter calculation method. Therefore, the additional part may include selection parameters and expected values ​​of monitoring parameters. The selection parameters are used to select component deployment instances that meet preset conditions, and the expected values ​​of monitoring parameters are the expected values ​​of the parameters that need to be monitored for component deployment instances obtained by screening the selection parameters. The additional part may also include a parameter value acquisition method to determine the acquisition source of the expected values ​​of the monitoring parameters, because the expected values ​​of the monitoring parameters can also be stored in different databases. The additional part may also include a parameter value calculation expression to calculate the expected values ​​of the monitoring parameters. The additional part can be declared as Extra according to the scope of application, and its type is a custom structure.

[0051] The parameter value calculation expression, for example, uses the template technology in the programming language, and the first monitoring process run by the Agent executes the template rendering program to calculate the corresponding parameter value.

[0052] In one embodiment, before executing S120, the embodiment of the present invention may further include:

[0053] Detecting whether the component deployment instance on the node executor maintains a connection with the controller based on a heartbeat detection mechanism;

[0054] If it is detected that the connection is not maintained, the controller marks the component deployment instance as not ready and resets the node executor where the component deployment instance marked as not ready is located, so that the component deployment instance on the node executor is reconnected to the controller.

[0055] The controller is deployed on the control node and can be called an Operator or a Controller. The controller is used to manage the component deployment instances of each cloud component running in the K8s cluster throughout the life cycle.

[0056] That is to say, before executing S120 and subsequent steps, it is necessary to ensure that the Agent and the controller are connected. Specifically, the heartbeat detection mechanism is used to detect whether the component deployment instance and the controller are connected. If the connection is maintained, S120 is executed directly. If the connection is not maintained, the component deployment instance is marked as not ready, that is, NotReady. The controller will reset the node executors where all component deployment instances marked as NotReady are located. After the reset, the component deployment instances on the node executors are reconnected to the controller.

[0057] Furthermore, the detecting whether the component deployment instance on the node executor maintains a connection with the controller based on a heartbeat detection mechanism may include S111 to S112:

[0058] S111, performing an election operation on each component deployment instance on the service node, so that the component deployment instance on the service node is elected as a leader;

[0059] S112, renewing the lease of the leader;

[0060] The controller periodically detects whether the lease of the leader on the node executor has expired. If it is detected that the lease has expired and has not been renewed, the leader is marked as having expired and not been renewed, and the time when the lease expiration and non-renewal are detected is used as a first timestamp; within a tolerance period after the first timestamp, if the controller detects that the lease has been renewed, the mark of lease expiration and non-renewal is cleared; if no renewal is detected after the tolerance period, the component deployment instance is marked as not ready to indicate that the component deployment instance on the node executor is not connected to the controller.

[0061] That is to say, the Agent conducts leader election based on the election mechanism of the K8s cluster. The difference between the competitive election when an Operator has multiple instance copies is that the Agent has only one instance copy and no other instance competes with it for the leader. In other words, the component deployment instance of the cloud component to be processed on a service node is a leader, that is, the component deployment instance elects itself as the leader. When the leader election of the Agent is completed, the lease is renewed according to the configured leader term renewal cycle, so that the lease is extended for one cycle. The controller will detect whether the lease of the leader on each service node has expired at regular intervals. If it is detected that the lease of a leader has expired and has not been renewed, the leader will be marked and marked as expired and not renewed, and the detection time will be recorded as the first timestamp. Then, within the tolerance period after the first timestamp, it is detected whether the leader has renewed its lease. If it has renewed its lease, the mark will be cleared. If the leader is not detected to have renewed its lease at the end of the tolerance period, the leader is marked as unready, which indicates that the leader is not connected to the controller and a disconnection occurs.

[0062] S120: Run a first monitoring process so that the first monitoring process periodically calls a parameter acquisition interface of the component deployment instance to obtain an actual value of a monitoring parameter of the component deployment instance;

[0063] The first monitoring process is a process for monitoring parameters, and the second monitoring process is subsequently involved. The second monitoring process is a process for monitoring the status of component deployment instances.

[0064] S130, after obtaining the actual value of the monitoring parameter each time, comparing the actual value of the monitoring parameter with the expected value of the monitoring parameter;

[0065] That is, in S120, an agent on a service node will run the first monitoring process, and the first monitoring process will periodically call the parameter acquisition interface of the component deployment instance to obtain the actual value of the monitoring parameter of the component deployment instance. Then, in S130, the actual value of the monitoring parameter is compared with the expected value of the monitoring parameter. After multiple cycles, multiple comparison results can be obtained.

[0066] Among them, the service node is a cloud computing facility.

[0067] S140, if the comparison results for N consecutive times are all inconsistent, the parameter state of the component deployment instance is marked as parameter inconsistency, so that the controller deployed on the control node sets the management flag of the component deployment instance to update after capturing the change in the parameter state of the component deployment instance, and notifies the node executor; wherein N is a first preset threshold;

[0068] Wherein, N can be the instance monitoring failure threshold configured by the Agent or the failure threshold defined in the instance monitoring information.

[0069] S150. Upon receiving a notification message from the controller indicating that the management flag of the component deployment instance is set to update, an update action is performed on the component deployment instance to adjust the actual value of the monitoring parameter of the component deployment instance toward the expected value of the monitoring parameter.

[0070] That is, if the comparison results for N consecutive times are inconsistent, the Agent will mark the parameter status of the component deployment instance as inconsistent parameters. After the controller learns that the parameter status of the component deployment instance is marked as inconsistent parameters, it sets the management flag of the component deployment instance to update, and then notifies the node executor corresponding to the component deployment instance. After receiving the notification, the node executor performs an update action on the component deployment instance. The purpose of the update action is to adjust the actual value of the monitoring parameter of the component deployment instance toward the direction of the expected value of the monitoring parameter, so that the actual value of the monitoring parameter of the component deployment instance is consistent with the expected value of the monitoring parameter.

[0071] In one embodiment, the method provided by the embodiment of the present invention may further include the following S210 to S230:

[0072] S210, obtaining an expected value of instance deployment state predefined for the component deployment instance of the cloud component to be managed on the service node;

[0073] The expected value of the instance deployment state may also be predefined in the form of a structure.

[0074] There are multiple instance deployment states, such as installing, updating, upgrading, running, deleting, etc.

[0075] S220, running a second monitoring process, so that the second monitoring process periodically calls the instance deployment information query interface to query the instance deployment status corresponding to the component deployment instance, if the status code queried M times in succession indicates that the instance deployment status does not exist, then setting the instance deployment status of the component deployment instance to not found, so that after the controller captures the change of the instance deployment status corresponding to the component deployment instance, it sets the management flag of the component deployment instance to reset and notifies the node executor; wherein M is a second preset threshold;

[0076] Where M is the instance monitoring failure threshold configured by the Agent or the failure threshold defined in the instance monitoring information.

[0077] S230: upon receiving a notification message from the controller indicating that the management flag of the component deployment instance is set to reset, performing a reset action on the component deployment instance so that the component deployment instance is initialized to the expected value of the instance deployment state.

[0078] That is to say, the Agent will run the second monitoring process, and the second monitoring process will periodically call the instance deployment information query interface, for example, call the instance deployment information query interface of the service module on the service node, and the instance deployment information query interface will return the query result. If the query results for M consecutive times are all status code 404 indicating that the instance deployment status does not exist, then the instance deployment status of the component deployment instance is set to not found. After the controller captures that the instance deployment status corresponding to the component deployment instance is set to not found, it sets the management flag of the component deployment instance to reset and notifies the node executor. After receiving the notification, the Agent will perform a reset action on the component deployment instance. Specifically, the reset can be achieved by executing a reset script. After the reset, the component deployment instance will be initialized to the expected value of the instance deployment status.

[0079] In actual scenarios, the Agent is prefabricated in the system image as a service. When the service node where the Agent is located is expanded to the Kubernetes cluster, the controller will call the Agent's interface to complete the configuration of the Agent so that the Agent can connect to the service module in the Kubernetes cluster. When the service node running the Agent is reset due to some reason, the Agent will lose the connection with the Kubernetes cluster where the controller is located, and the Agent will be reset by the controller because it cannot continue to renew the Leader lease. Due to the system reset, the local file used to record component deployment information will be lost, and the Agent will report the status of the component deployment instance to the service module as NotFound, and finally complete the reset operation of the component deployment instance.

[0080] Regardless of Ansible technology or custom resource + controller technology, when the parameters of the components deployed on the node are manually changed, or the node is reset due to the loss of node virtual machine data, it will cause the node component in the Kubernetes cluster to fail or become unavailable. In the embodiment of the present invention, when the virtual machine data running on the cloud computing facility is lost, the component deployment instance deployed on the cloud computing facility, especially the Xinchuang cloud computing facility, will be initialized to the expected value of the instance deployment state, so that the actual state of the component deployment instance is consistent with the expected state.

[0081] In one embodiment, the method provided by the embodiment of the present invention may further include:

[0082] During the deployment process of the component deployment instance, the instance deployment information corresponding to the component deployment instance is written into a local file; wherein the instance deployment information includes the instance deployment state;

[0083] When the local file changes, reload the instance deployment information in the local file and provide an instance deployment information query interface;

[0084] Among them, when the instance deployment information query interface is called, if the instance deployment status exists in the local file, the first status code indicating the existence of the instance deployment status and the instance deployment status are returned; if the instance deployment status does not exist in the local file, the second status code indicating the non-existence of the instance deployment status is returned.

[0085] That is to say, during the deployment process of the component deployment instance, the instance deployment information corresponding to the component deployment instance is written into a local file. At this time, the local file changes, so the instance deployment information in the local file is reloaded, and an instance deployment information query interface is provided to the outside world so that when the second monitoring process is running, the second monitoring process can call the instance deployment information query interface.

[0086] When the instance deployment information query interface is called, it will query the local file. If the instance deployment status is found, the status code 200 and the corresponding instance deployment status will be returned. If the instance deployment status is not found, the status code 404 will be returned.

[0087] The instance deployment information includes resource name, namespace, UID uniquely identifies the component, instance deployment status, etc. When the queried information exists, the status code returns 200. Existence means that the key information record of the component instance exists and the content is consistent. When the content of any field value in the information is inconsistent, it should be regarded as non-existent.

[0088] In one embodiment, the method provided by the embodiment of the present invention may also include: pre-defining a reset script corresponding to the reset action in the metadata resources of the cloud component to be managed; correspondingly, performing the reset action on the component deployment instance includes: executing the reset script on the component deployment instance.

[0089] That is, a reset script is predefined, and when a reset action needs to be performed on the component deployment instance, the reset script can be executed to complete the reset operation.

[0090] The reset action is a series of actions used to reset the component deployment instance, including obtaining parameter values, environment variables, template file rendering required for component instance deployment, defining the entry of the action, and arranging the sequence of actions.

[0091] The present invention provides a method for realizing automatic update or reset of cloud components based on a state machine in a trusted innovation environment. Based on the custom resource + controller technology of the Kubernetes cluster, the expected value of monitoring information is defined in the cloud component metadata and cloud component instance resources, and the actual value of the monitoring information of the component deployment instance running on the cloud computing facility is obtained, and then a comparison is performed, and the component deployment instance is processed accordingly according to the comparison result. For example, after the cloud computing facility is offline or reset due to a fault, the component deployment instance running on the original facility can be quickly reset, thereby quickly restoring the service status. It has strong practicality, a wide range of applications, and is easy to promote.

[0092] In view of the current cloud platform based on custom resource + controller technology, cluster cloud components are abstracted as custom resources, and the controller completes the management of the entire life cycle of component deployment, expansion, reduction, upgrade, deletion, update, etc. The expected parameter values ​​and actual parameter values ​​of the component deployment instances of the custom cloud components are monitored and compared. When inconsistency occurs, the status of the component deployment instance is set to parameter inconsistency, triggering the update of the component deployment instance so that the actual value is adjusted in the direction of the expected value. The instance deployment status of the custom component deployment instance is monitored. When the instance deployment status is not queried, the instance deployment status of the component deployment instance is set to not found, thereby triggering the reset of the component deployment instance, so that the cloud computing facility deploys the component deployment instance according to the reset state.

[0093] In summary, since the method provided by the embodiment of the present invention is executed by the node executor deployed on the service node, the node executor on each service node is responsible for updating or resetting the component deployment instance on the service node. Even if the number of nodes in the Kubernetes cluster increases, the actual value of the monitoring parameter of the component deployment instance will be adjusted toward the expected value of the monitoring parameter, and the actual value of the instance deployment status will also be adjusted toward the expected value of the instance deployment status, thereby avoiding management bottleneck problems in the Kubernetes cluster due to the increase in the number of nodes in the Kubernetes cluster.

[0094] In a second aspect, an embodiment of the present invention provides a cloud component management device, wherein the device is deployed on a node executor of a service node, see Figure 2 , the device 100 comprises:

[0095] A first acquisition module 110 is used to acquire an expected value of a monitoring parameter predefined for a component deployment instance of a cloud component to be managed on the service node;

[0096] A first running module 120, configured to run a first monitoring process, so that the first monitoring process periodically calls a parameter acquisition interface of the component deployment instance to obtain an actual value of a monitoring parameter of the component deployment instance;

[0097] A first comparison module 130 is used to compare the actual value of the monitoring parameter with the expected value of the monitoring parameter each time the actual value of the monitoring parameter is obtained;

[0098] The first marking module 140 is used to mark the parameter state of the component deployment instance as parameter inconsistency if the comparison results for N consecutive times are all inconsistent, so that the controller deployed on the control node sets the management flag of the component deployment instance to update after capturing the change in the parameter state of the component deployment instance, and notifies the node executor; wherein N is a first preset threshold;

[0099] The update processing module 150 is used to perform an update action on the component deployment instance upon receiving a notification message sent by the controller indicating that the management flag of the component deployment instance is set to be updated, so as to adjust the actual value of the monitoring parameter of the component deployment instance toward the expected value of the monitoring parameter.

[0100] In one embodiment, the predefined expected value of the monitoring parameter is in the form of a structure, and the structure of the expected value of the monitoring parameter includes a common part and an additional part; the common part is used to define the parameters that need to be monitored for different component deployment instances of the cloud component to be managed; the additional part is used to define the parameters, parameter acquisition method or parameter calculation method that need to be monitored for the component deployment instances that meet the preset conditions in each component deployment instance of the cloud component to be managed, and the additional part includes selection parameters for matching component deployment instances and parameters, parameter value acquisition method or parameter value calculation expression that need to be monitored for the matched component deployment instance, the selection parameter is used to determine whether the component deployment instance meets the preset condition, the parameter value acquisition method is used to define the acquisition source of the expected value of the monitoring parameter, and the parameter value calculation expression is used to define the calculation expression of the expected value of the monitoring parameter; wherein, a component deployment instance of the cloud component to be managed is deployed on a service node, and different component deployment instances of the cloud component to be managed are deployed on different service nodes.

[0101] In one embodiment, the apparatus further comprises:

[0102] A heartbeat detection module is used to detect whether the component deployment instance on the node executor and the controller maintain a connection based on a heartbeat detection mechanism before the first running module runs the first monitoring process; wherein, if it is detected that the connection is not maintained, the controller marks the component deployment instance as not ready, and resets the node executor where the component deployment instance marked as not ready is located, so that the component deployment instance on the node executor is reconnected to the controller.

[0103] In one embodiment, the heartbeat detection module includes:

[0104] A leader election unit, configured to perform an election operation on each component deployment instance on the service node, so that the component deployment instance on the service node is elected as a leader;

[0105] A lease renewal unit, used to renew the lease of the leader;

[0106] The controller is used to: periodically detect whether the lease of the leader on the node executor has expired; if it is detected that the lease has expired and has not been renewed, mark the leader as having expired and not been renewed, and use the time when the lease expiration and non-renewal were detected as a first timestamp; within a tolerance period after the first timestamp, if the controller detects that the lease has been renewed, clear the mark of lease expiration and non-renewal; if no renewal is detected after the tolerance period, mark the component deployment instance as not ready to indicate that the component deployment instance on the node executor is not connected to the controller.

[0107] In one embodiment, the device provided by the embodiment of the present invention further includes:

[0108] A second acquisition module is used to acquire an instance deployment state expected value predefined for the component deployment instance of the cloud component to be managed on the service node;

[0109] A second operation module is used to run a second monitoring process, so that the second monitoring process periodically calls the instance deployment information query interface to query the instance deployment status corresponding to the component deployment instance. If the status code queried M times in succession indicates that the instance deployment status does not exist, the instance deployment status of the component deployment instance is set to not found, so that after the controller captures the change of the instance deployment status corresponding to the component deployment instance, the management flag of the component deployment instance is set to reset and the node executor is notified; wherein M is a second preset threshold;

[0110] The reset processing module is used to perform a reset action on the component deployment instance when receiving a notification message sent by the controller indicating that the management flag of the component deployment instance is set to reset, so that the component deployment instance is initialized to the expected value of the instance deployment state.

[0111] In one embodiment, the device provided by the embodiment of the present invention further includes:

[0112] An information writing module, used to write instance deployment information corresponding to the component deployment instance into a local file during the deployment process of the component deployment instance; wherein the instance deployment information includes the instance deployment status;

[0113] An information loading module is used to reload the instance deployment information in the local file when the local file changes, and provide an instance deployment information query interface; wherein, when the instance deployment information query interface is called, if there is an instance deployment status in the local file, a first status code indicating the existence of the instance deployment status and the instance deployment status are returned; if there is no instance deployment status in the local file, a second status code indicating the non-existence of the instance deployment status is returned.

[0114] It is understandable that the explanation of the relevant contents, specific implementation methods, beneficial effects, examples, etc. in the system provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0115] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.

[0116] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.

[0117] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0118] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.

[0119] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0120] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0121] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0122] In a fourth aspect, an embodiment of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any embodiment of the specification.

[0123] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0124] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0125] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0126] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A cloud component management method, characterized in that: The method is executed by a node executor deployed on a service node, and the method includes: Obtaining expected values ​​of monitoring parameters predefined for a component deployment instance of the cloud component to be managed on the service node; Running a first monitoring process so that the first monitoring process periodically calls a parameter acquisition interface of the component deployment instance to obtain an actual value of a monitoring parameter of the component deployment instance; After obtaining the actual value of the monitoring parameter each time, comparing the actual value of the monitoring parameter with the expected value of the monitoring parameter; If the comparison results for N consecutive times are all inconsistent, the parameter state of the component deployment instance is marked as parameter inconsistency, so that the controller deployed on the control node sets the management flag of the component deployment instance to update after capturing the change in the parameter state of the component deployment instance, and notifies the node executor; wherein N is a first preset threshold; Upon receiving a notification message from the controller indicating that the management flag of the component deployment instance is set to update, an update action is performed on the component deployment instance to adjust the actual value of the monitoring parameter of the component deployment instance toward the expected value of the monitoring parameter.

2. The method according to claim 1, characterized in that The predefined expected value of the monitoring parameter is in the form of a structure, and the structure of the expected value of the monitoring parameter includes a common part and an additional part; the common part is used to define the parameters that need to be monitored for different component deployment instances of the cloud component to be managed; the additional part is used to define the parameters, parameter acquisition method or parameter calculation method that need to be monitored for the component deployment instances that meet the preset conditions in each component deployment instance of the cloud component to be managed, and the additional part includes selection parameters for matching component deployment instances and parameters, parameter value acquisition method or parameter value calculation expression that need to be monitored for the matched component deployment instances, the selection parameters are used to determine whether the component deployment instance meets the preset conditions, the parameter value acquisition method is used to define the acquisition source of the expected value of the monitoring parameter, and the parameter value calculation expression is used to define the calculation expression of the expected value of the monitoring parameter; A component deployment instance of the cloud component to be managed is deployed on a service node, and different component deployment instances of the cloud component to be managed are deployed on different service nodes.

3. The method according to claim 1, characterized in that Before running the first monitoring process, the method further includes: Detecting whether the component deployment instance on the node executor maintains a connection with the controller based on a heartbeat detection mechanism; If it is detected that the connection is not maintained, the controller marks the component deployment instance as not ready and resets the node executor where the component deployment instance marked as not ready is located, so that the component deployment instance on the node executor is reconnected to the controller.

4. The method according to claim 3, characterized in that The detecting whether the component deployment instance on the node executor maintains a connection with the controller based on a heartbeat detection mechanism includes: Performing an election operation on each component deployment instance on the service node so that the component deployment instance on the service node is elected as a leader; renewing the lease of said leader; The controller periodically detects whether the lease of the leader on the node executor has expired. If it is detected that the lease has expired and has not been renewed, the leader is marked as having expired and not been renewed, and the time when the lease expiration and non-renewal are detected is used as a first timestamp; within a tolerance period after the first timestamp, if the controller detects that the lease has been renewed, the mark of lease expiration and non-renewal is cleared; if no renewal is detected after the tolerance period, the component deployment instance is marked as not ready to indicate that the component deployment instance on the node executor is not connected to the controller.

5. The method according to claim 1, characterized in that: Also includes: Acquire an instance deployment state expected value predefined for the component deployment instance of the cloud component to be managed on the service node; Running a second monitoring process so that the second monitoring process periodically calls an instance deployment information query interface to query the instance deployment status corresponding to the component deployment instance. If the status code queried M times in succession indicates that the instance deployment status does not exist, the instance deployment status of the component deployment instance is set to not found, so that after the controller captures the change of the instance deployment status corresponding to the component deployment instance, the management flag of the component deployment instance is set to reset and the node executor is notified; wherein M is a second preset threshold; Upon receiving a notification message sent by the controller indicating that the management flag of the component deployment instance is set to reset, a reset action is performed on the component deployment instance so that the component deployment instance is initialized to the expected value of the instance deployment state.

6. The method according to claim 5, characterized in that Also includes: During the deployment process of the component deployment instance, the instance deployment information corresponding to the component deployment instance is written into a local file; wherein the instance deployment information includes the instance deployment state; When the local file changes, reload the instance deployment information in the local file and provide an instance deployment information query interface; Among them, when the instance deployment information query interface is called, if the instance deployment status exists in the local file, the first status code indicating the existence of the instance deployment status and the instance deployment status are returned; if the instance deployment status does not exist in the local file, the second status code indicating the non-existence of the instance deployment status is returned.

7. The method according to claim 5, characterized in that Also includes: Predefine a reset script corresponding to the reset action in the metadata resource of the cloud component to be managed; Correspondingly, performing a reset action on the component deployment instance includes: executing the reset script on the component deployment instance.

8. A cloud component management device, characterized in that: The device is deployed on a node executor of a service node, and includes: A first acquisition module is used to acquire an expected value of a monitoring parameter predefined for a component deployment instance of a cloud component to be managed on the service node; A first running module, used for running a first monitoring process, so that the first monitoring process periodically calls the parameter acquisition interface of the component deployment instance to obtain the actual value of the monitoring parameter of the component deployment instance; A first comparison module, configured to compare the actual value of the monitoring parameter with the expected value of the monitoring parameter each time the actual value of the monitoring parameter is obtained; A first marking module is used to mark the parameter state of the component deployment instance as inconsistent if the comparison results for N consecutive times are all inconsistent, so that the controller deployed on the control node sets the management flag of the component deployment instance to update after capturing the change in the parameter state of the component deployment instance, and notifies the node executor; wherein N is a first preset threshold; The update processing module is used to perform an update action on the component deployment instance upon receiving a notification message sent by the controller indicating that the management flag of the component deployment instance is set to be updated, so as to adjust the actual value of the monitoring parameter of the component deployment instance toward the expected value of the monitoring parameter.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.

10. A computing device, characterized in that The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Cluster monitoring method and device and electronic equipment

    CN114363175A

  • Monitoring method and device for containers in cluster and computer readable storage medium

    CN114911677A

  • Block chain deployment method and device based on Kubernetes

    CN115016893A

  • Deployment method and device of Nacos cluster and electronic equipment

    CN117834430A

  • Method for automatically updating Kubernetes scheduler

    CN117857343A

Cited By

  • Modularized logistics system data analysis method and system

    CN120634406A

  • Modular logistics system data analysis method and system

    CN120634406B