Elastic expansion and contraction method and device of container cluster, electronic equipment and medium

By monitoring the data-driven elastic scaling strategy, automatically expanding or shrinking container copies in multiple service clusters, the problem of elastic scaling of containers distributed in multi-cluster scenarios is solved, and high availability and resource optimization of applications are achieved.

CN119690776APending Publication Date: 2025-03-25NEW H3C BIG DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411746720.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the case where the application container is distributed in multi-cluster scenarios, how to achieve elastic scaling of the container is an urgent problem.

Method used

By obtaining monitoring data corresponding to the container copy of the target application from multiple service clusters, it is determined whether the elastic expansion or reduction conditions are met, and the cluster to be expanded or reduced in multiple service clusters is determined according to the pre-configured scheduling policy, and container copy is created or reduced in these clusters.

Benefits of technology

It realizes elastic scaling capabilities across clusters, provides the elastic scaling capabilities of containers for applications, can automatically adapt to changes in resource demand, and improves business stability and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690776A_ABST
    Figure CN119690776A_ABST
Patent Text Reader

Abstract

The invention provides an elastic expansion and contraction method and device of a container cluster, electronic equipment and a medium. The method comprises the following steps: acquiring monitoring data corresponding to a container copy of a target application from a plurality of service clusters; if the monitoring data meets an elastic capacity expansion condition, determining a to-be-expanded cluster in a plurality of service clusters according to an elastic capacity expansion scheduling strategy; creating a new container copy for the target application in the to-be-expanded cluster; if the monitoring data meets the elastic capacity reduction condition, determining a cluster to be subjected to capacity reduction in a plurality of service clusters according to an elastic capacity reduction scheduling strategy; and reducing the container copy of the target application in the cluster to be subjected to capacity reduction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing technology, and in particular to a method, device, electronic device, and medium for elastically scaling a container cluster. Background Art

[0002] With the development of cloud-native container technology, more and more companies or organizations are using containerized applications. Containerized technology enables applications to run consistently in any environment that supports containers, thereby improving the portability, isolation, and deployment efficiency of applications.

[0003] Distributed applications refer to applications deployed based on a distributed architecture. Distributed applications run on multiple nodes and work together to complete a task through the network. Distributed architecture can improve the stability, reliability and disaster recovery capabilities of business operations.

[0004] Based on this, applications can be distributed and deployed in containers in multiple clusters. In the scenario where application containers are distributed in multiple clusters, how to achieve elastic scaling of containers is an urgent problem to be solved. Summary of the invention

[0005] To overcome the problems existing in the related art, this specification provides a method, device, electronic device and medium for elastically scaling a container cluster.

[0006] According to a first aspect of an embodiment of the present specification, a method for elastic scaling of a container cluster is provided, the method comprising: obtaining monitoring data corresponding to a container copy of a target application from multiple business clusters; if the monitoring data meets an elastic expansion condition, determining a cluster to be expanded in the multiple business clusters according to an elastic expansion scheduling strategy; creating a new container copy for the target application in the cluster to be expanded; if the monitoring data meets an elastic reduction condition, determining a cluster to be reduced in the multiple business clusters according to an elastic reduction scheduling strategy; and reducing the container copy of the target application in the cluster to be reduced.

[0007] According to a second aspect of an embodiment of the present specification, an elastic scaling device for a container cluster is provided, including: a data acquisition module, used to obtain monitoring data corresponding to a container copy of a target application from multiple business clusters; a first determination module, used to determine a cluster to be expanded in the multiple business clusters according to an elastic expansion scheduling strategy if the monitoring data meets the elastic expansion condition; an expansion module, used to create a new container copy for the target application in the cluster to be expanded; a second determination module, used to determine a cluster to be shrunk in the multiple business clusters according to an elastic shrinking scheduling strategy if the monitoring data meets the elastic shrinking condition; a shrinking module, used to shrink the container copy of the target application in the cluster to be shrunk.

[0008] According to a third aspect of the embodiments of this specification, there is provided an electronic device, including:

[0009] processor;

[0010] a memory for storing processor-executable instructions;

[0011] The processor is configured to execute the elastic scaling method for a container cluster according to the first aspect or any corresponding embodiment thereof.

[0012] According to a fourth aspect of an embodiment of this specification, a computer-readable storage medium is provided, on which computer instructions are stored, and the computer instructions are used to enable a computer to execute the elastic scaling method for a container cluster according to the above-mentioned first aspect or any corresponding embodiment thereof.

[0013] The technical solutions provided by the embodiments of this specification may have the following beneficial effects:

[0014] According to the elastic scaling method of the container cluster of the embodiment of the present specification, the elastic scaling capability across clusters can be realized, and in the scenario where the application containers are distributed in multiple clusters, the elastic scaling capability of the container can be provided for the application.

[0015] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present specification. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and, together with the description, serve to explain the principles of the specification.

[0017] Figure 1 It is a schematic diagram of a system architecture shown in this specification according to an exemplary embodiment.

[0018] Figure 2 This is a flowchart of a method for elastically scaling a container cluster according to an exemplary embodiment of this specification.

[0019] Figure 3 It is a schematic diagram of another method for elastically scaling a container cluster according to an exemplary embodiment of this specification.

[0020] Figure 4 It is a hardware structure diagram of a computer device where the elastic scaling device of the container cluster in the embodiment of this specification is located.

[0021] Figure 5 This is a block diagram of an elastic scaling device for a container cluster according to an exemplary embodiment of the present specification. DETAILED DESCRIPTION

[0022] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Instead, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the appended claims.

[0023] The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. The singular forms "a", "the" and "the" used in this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0024] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0025] Next, the embodiments of this specification are described in detail.

[0026] The following combination Figure 1 The system architecture of the elastic scaling method and device for container clusters that can be applied in the embodiments of this specification is described. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of this specification can be applied, to help those skilled in the art understand the technical content of this specification, but it does not mean that the embodiments of this specification cannot be used in other devices, systems, environments or scenarios.

[0027] Figure 1 It is a schematic diagram of a system architecture shown in this specification according to an exemplary embodiment.

[0028] like Figure 1 As shown, the system architecture may include, for example, a main control plane cluster (referred to as the main control cluster) and multiple business clusters (also referred to as container clusters).

[0029] The master control cluster can manage multiple business clusters. The master control cluster can distribute resources to each business cluster based on the pre-created resource template, and the business cluster will carry the business. Business clusters can belong to different regions or different data centers. Each business cluster can contain containers. Distributed applications can be deployed in the containers of each business cluster.

[0030] Users can issue corresponding resource declarations (such as yaml resource objects in the k8s cluster) through the main control plane cluster. The main control plane cluster can configure corresponding cluster differentiation strategies and distribution strategies, and synchronize resources to the corresponding business clusters to facilitate management.

[0031] According to an embodiment of the present specification, the main control plane cluster may include an HPA (Horizontal PodAutoscaler) controller component and a monitoring data source component. The HPA controller component of the main control plane cluster can uniformly control the elastic scaling of the container pods of all managed business clusters. Resources such as elastic scaling policies can be sent to the main control plane cluster, and the HPA controller component uniformly determines whether each monitoring data meets the elastic scaling conditions, and schedules the corresponding business clusters for elastic scaling. The monitoring data source component of the main control plane cluster can summarize the monitoring data of each business cluster, and the HPA controller of the main control plane cluster monitors the query, and triggers the elastic scaling operation when the corresponding conditions are met.

[0032] According to the embodiments of the present specification, the monitoring data source component supports custom data sources, and various monitoring data are uniformly summarized based on the monitoring data source component. Each business cluster is scheduled based on the elastic scaling strategy configured based on the HPA controller component. This can ensure the scalability of custom indicators and the version compatibility between business clusters. In addition, it can also support the adaptation of various versions of business clusters.

[0033] The following is a detailed description of the elastic scaling method of the container cluster provided in the embodiments of this specification. Figure 2 As shown, Figure 2 This is a flowchart of a method for elastically scaling a container cluster according to an exemplary embodiment of this specification. The method is applied to a main control plane cluster. The method for elastically scaling a container cluster provided by an embodiment of this specification may include the following steps.

[0034] In step 210, monitoring data corresponding to the container replica of the target application is obtained from multiple business clusters.

[0035] According to an embodiment of the present specification, the target application may be a distributed application. Each of the multiple business clusters may include at least one container replica of the target application. The monitoring data may include both resource dimension indicators and application dimension related indicators. Among them, the resource dimension indicators may include, for example, the CPU usage of the container replica, the memory usage of the container replica, and the like. The application dimension related indicators may be customized by the user, for example, they may include indicators such as request rate and throughput.

[0036] In step 220, it is determined whether the monitoring data meets the elastic expansion condition and the elastic contraction condition. If the monitoring data meets the elastic expansion condition, steps 230 to 240 are executed. If the monitoring data meets the elastic contraction condition, steps 250 to 260 are executed.

[0037] According to an embodiment of the present specification, the elastic expansion condition may include an expansion interval corresponding to each indicator. It can be determined whether each indicator in the monitoring data is in the corresponding expansion interval. If at least one indicator in the monitoring data is in the corresponding expansion interval, it is determined that the monitoring data meets the elastic expansion condition. The range of the expansion interval can be set according to actual needs.

[0038] According to an embodiment of the present specification, the elastic shrinking condition may include a shrinking interval corresponding to each indicator. It can be determined whether each indicator in the monitoring data is in the corresponding shrinking interval. If at least one indicator in the monitoring data is in the corresponding shrinking interval, it is determined that the monitoring data meets the elastic shrinking condition. The range of the shrinking interval can be set according to actual needs.

[0039] In step 230, a cluster to be expanded is determined from among multiple service clusters according to the elastic expansion scheduling strategy.

[0040] According to an embodiment of the present specification, the elastic capacity expansion scheduling strategy can be pre-configured. The elastic capacity expansion scheduling strategy can be used to specify how to select a cluster to be expanded.

[0041] In step 240, a new container replica is created for the target application in the cluster to be expanded.

[0042] According to an embodiment of the present specification, for example, the number of container replicas of the cluster to be expanded may be expanded by calling an API (application programming interface) of the cluster to be expanded.

[0043] In step 250, a cluster to be shrunk is determined from among multiple service clusters according to the elastic shrinking scheduling policy.

[0044] According to an embodiment of the present specification, an elastic scaling-in scheduling strategy may be pre-configured. The elastic scaling-in scheduling strategy may be used to specify how to select a cluster to be scaled-in.

[0045] In step 260, the container replica of the target application in the cluster to be shrunk is reduced.

[0046] According to an embodiment of the present specification, for example, the number of container replicas of the cluster to be shrunk may be shrunk by calling an API of the cluster to be shrunk.

[0047] According to the elastic scaling method of the container cluster of the embodiment of the present specification, the elastic scaling capability across clusters can be realized, and in the scenario where the application containers are distributed in multiple clusters, the elastic scaling capability of the container can be provided for the application.

[0048] According to the embodiments of this specification, when the resources of a container cluster are insufficient, the appropriate business cluster can be automatically selected to expand the container replica, and the elasticity is more flexible. The elastic scaling of multiple container clusters can cope with the sudden increase in business system pressure. In addition, during the elastic scaling process, the business can be guaranteed to be stable and uninterrupted.

[0049] Optionally, when expanding or reducing the capacity of a service cluster, the authentication information can be sent to the cluster for authentication first, and after the authentication is passed, the expansion or reduction operation can be performed, thereby improving the security of the operation. Exemplarily, in this embodiment, the authentication information of each service cluster can be pre-stored in the main control plane cluster.

[0050] Based on this, step 240 may include, for example: sending the first authentication information corresponding to the cluster to be expanded to the cluster to be expanded, so that the cluster to be expanded authenticates the first authentication information and obtains a first authentication result. Receiving the first authentication result sent by the cluster to be expanded. If the first authentication result indicates that the authentication is successful, sending a container replica creation instruction to the cluster to be expanded. If the first authentication result is not received or the first authentication result indicates that the authentication fails, the expansion operation is terminated.

[0051] Correspondingly, step 260 may include, for example: sending the second authentication information corresponding to the cluster to be shrunk to the cluster to be shrunk, so that the cluster to be shrunk authenticates the second authentication information and obtains a second authentication result; receiving the second authentication result sent by the cluster to be shrunk; if the second authentication result indicates that the authentication is successful, sending a container replica reduction instruction to the cluster to be shrunk. If the second authentication result is not received or the second authentication result indicates that the authentication fails, the scaling-in operation is terminated.

[0052] Optionally, after creating a new container copy, a health check can be performed on the new container copy. If the health check passes, the new container copy is brought online and bound to the load balancing device. If the health check fails, the operation of creating a container copy can be re-executed. For example, after creating a new container copy for the target application in the cluster to be expanded, the main control plane cluster can instruct the business cluster to perform a health check on the new container copy, and the main control plane cluster can listen to the results of the health check. If the health check passes, the business cluster is instructed to bring the new container copy online and bind it to the load balancing device.

[0053] Exemplarily, in this embodiment, the health check may include at least one of a survival check, a readiness check, and a startup check. The survival check may be used to determine whether the container is alive. The readiness check may be used to determine whether the container is ready to receive external requests or traffic. The startup check may be used to detect whether the startup of the container application is normal.

[0054] Optionally, the scheduling policy may include, for example, at least one of a priority scheduling policy, a minimum resource scheduling policy, and a same-cluster scheduling policy.

[0055] When the scheduling strategy is configured as a priority scheduling strategy, step 230 may include, for example: obtaining expansion priorities of multiple service clusters; and determining the service cluster with the highest expansion priority among the multiple service clusters as the cluster to be expanded.

[0056] Correspondingly, step 250 may include, for example: obtaining the reduction priorities of multiple service clusters; and determining a service cluster with the highest reduction priority among the multiple service clusters as the cluster to be reduced.

[0057] When the scheduling strategy is configured as the minimum resource scheduling strategy, step 230 includes: obtaining resource utilization rates of multiple service clusters; and determining a service cluster with the lowest resource utilization rate among the multiple service clusters as the cluster to be expanded.

[0058] Correspondingly, step 250 may include, for example: obtaining resource usage rates of multiple service clusters; and determining a service cluster with the highest resource usage rate among the multiple service clusters as the cluster to be shrunk.

[0059] In the case where the scheduling strategy is configured as the same-cluster scheduling strategy, step 230 includes: determining a service cluster corresponding to the monitoring data that is in the elastic expansion interval and satisfies the elastic expansion condition among the multiple service clusters as the cluster to be expanded.

[0060] Correspondingly, step 250 may include, for example: determining, among the multiple service clusters, a service cluster corresponding to the monitoring data that is in the capacity reduction range and meets the elastic capacity reduction condition as the cluster to be reduced.

[0061] like Figure 3 FIG. 1 is a schematic diagram of another method for elastically scaling a container cluster according to an exemplary embodiment. The method for elastically scaling a container cluster may include the following steps:

[0062] Distributed applications are managed through the main control plane cluster. For example. The main control plane cluster can send corresponding container resources to each business cluster according to differentiated configuration and distribution strategy configuration, etc. The business cluster creates a container pod for the distributed application based on the container resources to carry the business corresponding to the distributed application. The pod information and cluster monitoring information in the business cluster can be connected to the monitoring data source component of the main control plane cluster. The information stored in the monitoring data source component may include resource monitoring data and link data, etc. In this embodiment, the monitoring data source component of the main control plane cluster can actively collect information from each business cluster. Alternatively, each business cluster can report its monitoring data information to the monitoring data source component of the main control plane cluster. For example, an agent component can be installed in each business cluster, and the agent component reports the monitoring data information in the business cluster to the monitoring data source component of the main control plane cluster. The monitoring data of the business cluster can be uniformly summarized by the main control plane cluster to achieve standardization of indicators.

[0063] Users can send elastic scaling configurations to the main control plane cluster and record them in the main control plane cluster. For example, elastic scaling configurations may include target application information, elastic expansion conditions, elastic shrinking conditions, maximum number of instances, minimum number of instances, elastic expansion scheduling strategy, elastic shrinking scheduling strategy, etc. Among them, the target application information records all distributed applications that have enabled elastic scaling functions, i.e., target applications. Elastic expansion conditions and elastic shrinking conditions include but are not limited to CPU thresholds, memory thresholds, request rate thresholds, throughput thresholds, etc.

[0064] The HPA controller component can obtain relevant information such as the application of the elastic scaling function required by the user, elastic expansion conditions, elastic expansion scheduling strategy, elastic reduction conditions, elastic reduction scheduling strategy, etc. by reading the elastic scaling configuration.

[0065] like Figure 1 In the example, the distributed application is set up with the elastic scaling function. The distributed application has a pod copy in cluster 1, cluster 2, and cluster 3. The monitoring data information of cluster 1, cluster 2, and cluster 3 is aggregated to the main control plane cluster, and the monitoring data source component obtains the monitoring data through the API.

[0066] When the elastic expansion conditions are met, for example, it is detected that the indicators of the pods in cluster 1 have reached the corresponding thresholds in the elastic expansion conditions (the indicators are not only CPU or memory, but can also be user-defined indicators such as request rate, throughput, etc., as long as the customized indicators are uniformly connected to the monitoring data source). At this time, it is necessary to expand the capacity of the distributed application, that is, to expand the number of pod copies. When expanding the number of pod copies, appropriate cluster resources can be selected for expansion according to the scheduling policy specified in the elastic scaling configuration. The scheduling policy can include, for example, priority scheduling policy, minimum resource scheduling policy, and same cluster scheduling policy.

[0067] For the priority scheduling strategy, you can set the priority for each cluster in advance, select the cluster with the highest priority as the cluster to be expanded according to the priority order, and expand its number of replicas. For example, if cluster 2 is set to have the highest priority, when elastic expansion is triggered, the replicas in cluster 2 will be increased first.

[0068] For the minimum resource scheduling strategy, the HPA component can be used to monitor the monitoring data of different clusters to determine the cluster with the lowest resource utilization. For example, cluster 2 has the lowest resource utilization. When elastically expanding, the number of replicas of cluster 2 is preferentially selected for expansion.

[0069] For the same cluster scheduling strategy, you can prioritize the current cluster expansion. For example, when the pods in cluster 1 meet the expansion conditions, you can prioritize the expansion of the number of pod instances on cluster 1. In particular, if the number of pod instances in cluster 1 has reached the maximum number of instances, you can use other scheduling strategies to select other clusters for expansion.

[0070] In summary, when you need to trigger elastic expansion, you can select a suitable cluster to expand the number of replicas. In addition, you can also determine whether the current number of instances has reached the maximum number of instances. If the maximum number of instances is reached, end this elastic expansion action; otherwise, call the API of the corresponding business cluster to create a new pod instance as a pod replica of the distributed application. After creating a new pod instance, perform a health check on the pod instance. After the health check passes, the new pod instance is launched and bound to the load balancing device. In this way, stable and smooth elasticity can be guaranteed to avoid the load balancing introducing part of the traffic to the new instance when the new instance does not provide normal services, resulting in business interruption.

[0071] When the elastic scaling-in conditions are met, similar to the elastic scaling-out process, you can select a suitable cluster to reduce the number of replicas. The elastic scaling can improve the full utilization rate of the overall multi-container cluster resources.

[0072] Corresponding to the embodiments of the aforementioned methods, this specification also provides embodiments of an elastic scaling device for a container cluster and a terminal used therein.

[0073] The embodiments of the elastic scaling device of the container cluster in this specification can be applied to computer devices, such as servers or terminal devices. The device embodiments can be implemented by software, hardware, or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory and running them. From the hardware level, such as Figure 4 The figure is a hardware structure diagram of a computer device where the elastic expansion device of the container cluster in the embodiment of this specification is located, except Figure 4 In addition to the processor 410, memory 430, network interface 420, and non-volatile memory 440 shown, the server or electronic device where the device 431 is located in the embodiment may also include other hardware according to the actual function of the computer device, which will not be described in detail.

[0074] like Figure 5 As shown, Figure 5 This is a block diagram of an elastic scaling device for a container cluster according to an exemplary embodiment of the present specification, and the device includes:

[0075] A data acquisition module 510, used to acquire monitoring data corresponding to the container replica of the target application from multiple business clusters;

[0076] A first determination module 520 is configured to determine a cluster to be expanded from among multiple business clusters according to an elastic expansion scheduling strategy if the monitoring data meets the elastic expansion condition;

[0077] An expansion module 530 is used to create a new container replica for the target application in the cluster to be expanded;

[0078] A second determination module 540 is configured to determine a cluster to be shrunk from among multiple business clusters according to an elastic shrinking scheduling strategy if the monitoring data meets the elastic shrinking condition;

[0079] The shrinking module 550 is used to shrink the container replicas of the target application in the cluster to be shrunk.

[0080] Optionally, the expansion module may include:

[0081] A first authentication submodule, configured to send first authentication information corresponding to the cluster to be expanded to the cluster to be expanded, so that the cluster to be expanded authenticates the first authentication information and obtains a first authentication result;

[0082] A first receiving submodule, used to receive a first authentication result sent by the cluster to be expanded;

[0083] A first instruction sending submodule, configured to send a container replica creation instruction to the cluster to be expanded if the first authentication result indicates that the authentication is successful;

[0084] Optionally, the module to be reduced in capacity may include:

[0085] A second authentication submodule, configured to send second authentication information corresponding to the cluster to be shrunk to the cluster to be shrunk, so that the cluster to be shrunk authenticates the second authentication information and obtains a second authentication result;

[0086] A second receiving submodule is used to receive a second authentication result sent by the cluster to be scaled down;

[0087] The second instruction sending submodule is used to send a container replica reduction instruction to the cluster to be reduced if the second authentication result indicates that the authentication is successful.

[0088] Optionally, the device may further include:

[0089] The check module is used to perform a health check on the new container copy after creating the new container copy;

[0090] The online module is used to bring the new container copy online and bind it to the load balancing device if the health check passes.

[0091] Optionally, the monitoring data includes at least one of the following indicators: processor occupancy, memory occupancy, request rate and throughput. The device may also include:

[0092] The expansion judgment module is used to determine whether each indicator in the monitoring data is in the corresponding expansion interval. If at least one indicator in the monitoring data is in the corresponding expansion interval, it is determined that the monitoring data meets the elastic expansion condition;

[0093] The shrinkage judgment module is used to determine whether each indicator in the monitoring data is in a corresponding shrinkage interval. If at least one indicator in the monitoring data is in the corresponding shrinkage interval, it is determined that the monitoring data meets the elastic shrinkage condition.

[0094] Optionally, the elastic expansion scheduling strategy includes a priority scheduling strategy, a minimum resource scheduling strategy, or a same-cluster scheduling strategy;

[0095] In the case where the elastic expansion scheduling strategy includes a priority scheduling strategy, the first determination module may include: a first priority acquisition submodule, used to obtain the expansion priorities of multiple business clusters; a first cluster determination submodule, used to determine the business cluster with the highest expansion priority among the multiple business clusters as the cluster to be expanded;

[0096] In the case where the elastic expansion scheduling strategy includes a minimum resource scheduling strategy, the first determination module may include: a first usage rate acquisition submodule, used to obtain resource usage rates of multiple business clusters; a second cluster determination submodule, used to determine a business cluster with the lowest resource usage rate among the multiple business clusters as the cluster to be expanded;

[0097] When the elastic expansion scheduling strategy includes the same cluster scheduling strategy, the first determination module may include: a third cluster determination submodule, configured to determine a service cluster corresponding to monitoring data satisfying the elastic expansion condition as the cluster to be expanded.

[0098] Optionally, the elastic scaling-down scheduling strategy includes a priority scheduling strategy, a minimum resource scheduling strategy, or a same-cluster scheduling strategy;

[0099] In the case where the elastic shrinking scheduling strategy includes a priority scheduling strategy, the second determination module may include: a second priority acquisition submodule, used to obtain the shrinking priorities of multiple business clusters; a fourth cluster determination submodule, used to determine the business cluster with the highest shrinking priority among the multiple business clusters as the cluster to be shrunk;

[0100] In the case where the elastic shrinking scheduling strategy includes a minimum resource scheduling strategy, the second determination module may include: a second utilization rate acquisition submodule, used to obtain resource utilization rates of multiple business clusters; a fifth cluster determination submodule, used to determine a business cluster with the highest resource utilization rate among the multiple business clusters as the cluster to be shrunk;

[0101] When the elastic shrinking scheduling strategy includes the same cluster scheduling strategy, the second determination module may include: a sixth cluster determination submodule, configured to determine a service cluster corresponding to monitoring data satisfying the elastic shrinking condition as the cluster to be shrunk.

[0102] According to the elastic scaling method of the container cluster of the embodiment of the present specification, the elastic scaling capability across clusters can be realized, and in the scenario where the application containers are distributed in multiple clusters, the elastic scaling capability of the container can be provided for the application.

[0103] Correspondingly, the present specification also provides an electronic device, which includes a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to: obtain monitoring data corresponding to the container copy of the target application from multiple business clusters; if the monitoring data meets the elastic expansion condition, determine the cluster to be expanded in the multiple business clusters according to the elastic expansion scheduling strategy; create a new container copy for the target application in the cluster to be expanded; if the monitoring data meets the elastic reduction condition, determine the cluster to be reduced in the multiple business clusters according to the elastic reduction scheduling strategy; and reduce the container copy of the target application in the cluster to be reduced.

[0104] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0105] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0106] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0107] Those skilled in the art will readily appreciate other embodiments of the specification after considering the specification and practicing the invention claimed herein. The specification is intended to cover any variations, uses or adaptations of the specification that follow the general principles of the specification and include common knowledge or customary techniques in the art that are not claimed in the specification. The specification and examples are to be considered exemplary only, and the true scope and spirit of the specification are indicated by the following claims.

[0108] It should be understood that the present description is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.

[0109] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.

Claims

1. A container cluster elastic scaling method, applied to a main control plane cluster, characterized in that: The method comprises: Obtain monitoring data corresponding to container replicas of target applications from multiple business clusters; If the monitoring data meets the elastic expansion condition, determining a cluster to be expanded from the multiple business clusters according to the elastic expansion scheduling strategy; creating a new container copy for the target application in the cluster to be expanded; If the monitoring data meets the elastic shrinking condition, a cluster to be shrunk is determined from the multiple business clusters according to the elastic shrinking scheduling strategy; and the container copy of the target application in the cluster to be shrunk is reduced.

2. The method according to claim 1, characterized in that: The creating a new container replica for the target application in the cluster to be expanded includes: Sending first authentication information corresponding to the cluster to be expanded to the cluster to be expanded, so that the cluster to be expanded authenticates the first authentication information and obtains a first authentication result; Receiving a first authentication result sent by the cluster to be expanded; If the first authentication result indicates that the authentication is successful, sending a container replica creation instruction to the cluster to be expanded; The reducing the container replica of the target application in the cluster to be reduced includes: Sending the second authentication information corresponding to the cluster to be shrunk to the cluster to be shrunk, so that the cluster to be shrunk authenticates the second authentication information and obtains a second authentication result; Receiving a second authentication result sent by the cluster to be scaled down; If the second authentication result indicates that the authentication is successful, a container replica reduction instruction is sent to the cluster to be reduced.

3. The method according to claim 1, characterized in that After creating the new container copy, the method further includes: Perform a health check on the new container replica; If the health check passes, the new container copy is brought online and bound to the load balancing device.

4. The method according to claim 1, characterized in that: The monitoring data includes at least one of the following indicators: processor occupancy, memory occupancy, request rate and throughput; The method further comprises: Determine whether each indicator in the monitoring data is in a corresponding expansion interval, and if at least one indicator in the monitoring data is in the corresponding expansion interval, determine that the monitoring data meets the elastic expansion condition; It is determined whether each indicator in the monitoring data is in a corresponding shrinking interval. If at least one indicator in the monitoring data is in the corresponding shrinking interval, it is determined that the monitoring data meets the elastic shrinking condition.

5. The method according to any one of claims 1 to 4, characterized in that The elastic expansion scheduling strategy includes a priority scheduling strategy, a minimum resource scheduling strategy or a same cluster scheduling strategy; In the case where the elastic capacity expansion scheduling strategy includes a priority scheduling strategy, determining the cluster to be expanded among the multiple business clusters according to the elastic capacity expansion scheduling strategy includes: obtaining the capacity expansion priorities of the multiple business clusters; determining the business cluster with the highest capacity expansion priority among the multiple business clusters as the cluster to be expanded; In the case where the elastic capacity expansion scheduling strategy includes a minimum resource scheduling strategy, determining the cluster to be expanded among the multiple business clusters according to the elastic capacity expansion scheduling strategy includes: obtaining resource utilization rates of the multiple business clusters; determining the business cluster with the lowest resource utilization rate among the multiple business clusters as the cluster to be expanded; In the case where the elastic expansion scheduling strategy includes the same cluster scheduling strategy, determining the cluster to be expanded from the multiple business clusters according to the elastic expansion scheduling strategy includes: determining a business cluster corresponding to the monitoring data that meets the elastic expansion conditions as the cluster to be expanded.

6. The method according to any one of claims 1 to 4, characterized in that The elastic capacity reduction scheduling strategy includes a priority scheduling strategy, a minimum resource scheduling strategy or a same cluster scheduling strategy; In the case where the elastic shrinking scheduling strategy includes a priority scheduling strategy, determining the cluster to be shrunk from the multiple business clusters according to the elastic shrinking scheduling strategy includes: obtaining the shrinking priorities of the multiple business clusters; determining the business cluster with the highest shrinking priority among the multiple business clusters as the cluster to be shrunk; In the case where the elastic shrinking scheduling strategy includes a minimum resource scheduling strategy, determining the cluster to be shrunk from the multiple business clusters according to the elastic shrinking scheduling strategy includes: obtaining resource utilization rates of the multiple business clusters; determining the business cluster with the highest resource utilization rate among the multiple business clusters as the cluster to be shrunk; When the elastic shrinking scheduling strategy includes the same cluster scheduling strategy, determining the cluster to be shrunk from the multiple service clusters according to the elastic shrinking scheduling strategy includes: determining a service cluster corresponding to the monitoring data that meets the elastic shrinking condition as the cluster to be shrunk.

7. An elastic expansion device for a container cluster, characterized in that: The device comprises: A data acquisition module, used to acquire monitoring data corresponding to the container replicas of the target application from multiple business clusters; A first determination module is configured to determine a cluster to be expanded from among the multiple business clusters according to an elastic expansion scheduling strategy if the monitoring data meets an elastic expansion condition; An expansion module, used to create a new container copy for the target application in the cluster to be expanded; A second determination module is configured to determine a cluster to be shrunk from among the multiple service clusters according to an elastic shrinking scheduling strategy if the monitoring data meets an elastic shrinking condition; The shrinking module is used to shrink the container replica of the target application in the cluster to be shrunk.

8. The device according to claim 7, characterized in that The expansion module comprises: A first authentication submodule, configured to send first authentication information corresponding to the cluster to be expanded to the cluster to be expanded, so that the cluster to be expanded authenticates the first authentication information and obtains a first authentication result; A first receiving submodule, configured to receive a first authentication result sent by the cluster to be expanded; A first instruction sending submodule, configured to send a container replica creation instruction to the cluster to be expanded if the first authentication result indicates that the authentication is successful; The module to be reduced in capacity comprises: A second authentication submodule, configured to send second authentication information corresponding to the cluster to be shrunk to the cluster to be shrunk, so that the cluster to be shrunk authenticates the second authentication information and obtains a second authentication result; A second receiving submodule, used to receive a second authentication result sent by the cluster to be scaled down; The second instruction sending submodule is used to send a container replica reduction instruction to the cluster to be reduced if the second authentication result indicates that the authentication is successful.

9. An electronic device, comprising: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 6.