Service scheduling system and method of multi-cluster architecture and related device
By introducing a global synchronization controller and registration discovery tools into a multi-cluster architecture, cross-cluster service instance state synchronization and scheduling are achieved, solving the problems of convenience and reliability of service registration and discovery in a multi-cluster architecture, and improving the efficiency and reliability of service scheduling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2026-03-10
AI Technical Summary
In a multi-cluster architecture, existing technologies make it difficult to perform service registration and discovery conveniently, resulting in inconvenient service scheduling and an inability to guarantee the reliability of scheduling.
The service scheduling system adopts a multi-cluster architecture, including multiple Kubernetes clusters and a global synchronization controller. It registers service instances with the registry center through a registration discovery tool and uses a synchronization agent to synchronize service instances to the global synchronization controller, maintaining a global service registry to achieve cross-cluster service instance state synchronization and scheduling.
It improves the convenience and reliability of service scheduling, enabling service registration and discovery through a third-party registry center, and selecting the optimal instance to respond to requests based on the service instance status, thus ensuring the efficiency and reliability of service scheduling.
Smart Images

Figure CN121636080A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of microservices technology, and in particular to a service scheduling system, method and related apparatus with a multi-cluster architecture. Background Technology
[0002] With the widespread adoption of microservices and containerization technologies, Kubernetes clusters have become widely used. However, the shortcomings of single-cluster architectures in disaster recovery, availability, and resource management have rendered them inadequate for meeting the ever-growing demands of business services. As a result, multi-cluster architectures have become the mainstream in service scheduling. However, multi-cluster architectures typically still rely on Kubernetes' built-in interfaces for unified service registration and discovery, which is inconvenient and leads to unreliable service scheduling. Therefore, improving the convenience and reliability of service scheduling has become a pressing issue. Summary of the Invention
[0003] The main technical problem addressed in this application is to provide a service scheduling system, method, and related apparatus with a multi-cluster architecture, which can improve the convenience and reliability of service scheduling.
[0004] To address the aforementioned technical problems, this application provides a service scheduling system with a multi-cluster architecture. The system includes multiple Kubernetes clusters and a global synchronization controller. Each Kubernetes cluster includes: a registry center; multiple service instances and their matching registration discovery tools; wherein the service instances register with the registry center through the registration discovery tools and are capable of providing business services; and a synchronization proxy, used to obtain the service instances registered on the registry center and synchronize them to the global synchronization controller, so that the global synchronization controller maintains a global service registry corresponding to all service instances on the Kubernetes clusters, obtains the latest global service registry from the global service controller, determines the status of each service instance, and synchronizes it to the registry center; wherein, when a Kubernetes cluster receives a request to obtain a business service, the registration discovery tool obtains a list of service instances for the business service from the global service registry of the registry center, and schedules the service instances responding to the request based on the status of the service instances in the service instance list.
[0005] To address the aforementioned technical problems, a second aspect of this application provides a service scheduling method for a multi-cluster architecture, applied to the service scheduling system for the multi-cluster architecture described in the first aspect. The method includes: responding to a service instance in a Kubernetes cluster registering with a registry center via a matching registration discovery tool; using a synchronization proxy to obtain the service instances registered on the registry center and synchronizing them to the global synchronization controller; using the global synchronization controller to maintain a global service registry corresponding to all service instances on the Kubernetes cluster; using the synchronization proxy to obtain the latest global service registry from the global service controller and determine the status of each service instance, synchronizing it to the registry center; responding to a request from the Kubernetes cluster to obtain a business service; using the registration discovery tool to obtain a list of service instances for the business service from the global service registry of the registry center; and scheduling service instances responding to the request based on the status of the service instances in the service instance list.
[0006] To address the aforementioned technical problems, a third aspect of this application provides an electronic device comprising: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described in the second aspect above.
[0007] To address the aforementioned technical problems, a fourth aspect of this application provides a computer-readable storage medium storing program data thereon, wherein the program data, when executed by a processor, implements the method described in the second aspect above.
[0008] The beneficial effects of this application are as follows: Unlike existing technologies, the multi-cluster architecture service scheduling system of this application includes multiple Kubernetes clusters and a global synchronization controller. Each Kubernetes cluster includes a registry center, multiple service instances, and their matching registration discovery tools and synchronization agents. Service instances register with the registry center through the registration discovery tool, thereby registering the service instances on their local Kubernetes clusters. These service instances can provide corresponding business services. The synchronization agent retrieves the service instances registered on the registry center and synchronizes the locally registered service instances to the global synchronization controller. This allows the global synchronization controller to maintain a global service registry corresponding to all service instances on all Kubernetes clusters, thus aggregating the latest service instances on all Kubernetes clusters at the global synchronization controller level. The synchronization agent retrieves the latest global service registry from the global service controller and determines the status of each service instance, synchronizing it to the registry center. This ensures that the registry center of each Kubernetes cluster records the service instances in other Kubernetes clusters and their corresponding statuses. When a Kubernetes cluster receives a request to obtain a business service, it uses the registration discovery tool to retrieve a list of service instances for the business service from the global service registry of the registry center. Based on the status of the service instances in the service instance list, it schedules the service instance responding to the request from the service instance list. Therefore, a multi-cluster architecture service scheduling system can register and discover services through a third-party registry center, improving the convenience of service scheduling. Furthermore, the registry center includes service instances in other Kubernetes clusters and their corresponding statuses, thereby selecting the optimal service instance to respond to requests based on the status of the service instance, thus improving the reliability of service scheduling. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a schematic diagram of one embodiment of the service scheduling system with a multi-cluster architecture of this application; Figure 2 This is a schematic diagram of another implementation of the service scheduling system with a multi-cluster architecture of this application; Figure 3 This is a schematic diagram of one implementation of the service scheduling method for a multi-cluster architecture in this application; Figure 4 This is a schematic diagram of the structure of one embodiment of the electronic device of this application; Figure 5 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0010] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments, and different implementation methods can be adaptively combined. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0011] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.
[0012] Please see Figure 1 , Figure 1 This is a schematic diagram of one embodiment of the service scheduling system 1 with a multi-cluster architecture according to this application. The service scheduling system 1 with a multi-cluster architecture includes multiple Kubernetes clusters 10 and a global synchronization controller 11. Each Kubernetes cluster 10 includes a registry center 101, multiple service instances 102, and their matching registration discovery tools 103 and synchronization agents 104. Service instances 102 register with the registry center 101 through the registration discovery tool 103 and are able to provide business services. The synchronization agent 104 is used to obtain the service instances 102 registered on the registry center 101 and synchronize them to the global synchronization controller 11. This allows the global synchronization controller 11 to maintain a global service registry corresponding to all service instances 102 on the Kubernetes clusters 10, obtain the latest global service registry from the global service controller, determine the status of each service instance 102, and synchronize it to the registry center 101.
[0013] Specifically, service instance 102 registers with registration center 101 through registration discovery tool 103, thereby registering service instance 102 in local Kubernetes cluster 10, and service instance 102 can implement corresponding business services.
[0014] Understandably, the registration discovery tool 103 is matched with the service instance 102, and the registration discovery tool 103 is connected to the registry center 101 on the local Kubernetes cluster 10. The service instance 102 registers with the registry center 101 on the local Kubernetes cluster 10 through the registration discovery tool 103.
[0015] Alternatively, the registration discovery tool 103 is typically a software development kit (SDK).
[0016] Furthermore, the synchronization agent 104 is used to obtain the service instance 102 registered on the registration center 101 and synchronize the locally registered service instance 102 to the global synchronization controller 11. This enables the global synchronization controller 11 to maintain a global service registry corresponding to the service instance 102 on all Kubernetes clusters 10, thereby aggregating the latest service instance 102 on all Kubernetes clusters 10 at the global synchronization controller 11. Specifically, the global synchronization controller 11 maintains the global service registry based on the service instance 102 synchronized by the synchronization agent 104 of all Kubernetes clusters 10.
[0017] In one implementation, after the synchronization agent 104 obtains the service instance 102 from the registration center 101, it feeds back the information corresponding to the service instance 102 registered on the registration center 101 to the global synchronization controller 11. The global synchronization controller 11 uses the information fed back by the synchronization agents 104 of all Kubernetes clusters 10 to maintain the global service registry.
[0018] In one implementation, the synchronization agent 104 monitors service instances 102 that have been adjusted on the registry center 101 and feeds back the information corresponding to the adjusted service instances 102 to the global synchronization controller 11. The global synchronization controller 11 uses the adjustment information of service instances 102 on the Kubernetes cluster 10 to maintain a global service registry. Adjustments include adding, removing, and modifying services.
[0019] In addition, the synchronization agent 104 obtains the latest global service registry from the global service controller and determines the status of each service instance 102 and synchronizes it to the registry center 101 so that the registry center 101 of each Kubernetes cluster 10 records the service instances 102 in other Kubernetes clusters 10 and their corresponding statuses.
[0020] It should be noted that each Kubernetes cluster 10 has its own service instance 102 configured. Any two Kubernetes clusters 10 can include the same service instance 102, or they can include independent service instances 102.
[0021] In one implementation, the global service controller maintains a version of the global service registry. When a service instance 102 on any Kubernetes cluster 10 is adjusted, the version of the global service registry is updated. The global service controller notifies the synchronization agent 104 on each Kubernetes cluster 10 to obtain the latest version of the global service registry. The synchronization agent 104 probes the service instances 102 on other Kubernetes clusters 10 to determine the status of the service instances 102 on other Kubernetes clusters 10.
[0022] In one embodiment, the synchronization agent 104 obtains the global service registry maintained on the global synchronization controller 11 at preset time intervals, determines the heartbeat signal of the cluster from other Kubernetes clusters 10, and determines the status of the service instance 102 on other Kubernetes clusters 10 based on the heartbeat signal.
[0023] It is understandable that the global service registry should at least include the instance information corresponding to the latest service instance 102 on each Kubernetes cluster 10. The instance information should at least include the instance ID, service name, and cluster ID. In some scenarios, the instance information may also include the IP address, port, and status.
[0024] It should be noted that when the Kubernetes cluster 10 receives a request to obtain a business service, the registration discovery tool 103 obtains a list of service instances 102 of the business service from the global service registry of the registry center 101, and schedules the service instance 102 that responds to the request based on the status of the service instance 102 in the list of service instances 102.
[0025] Specifically, when the Kubernetes cluster 10 receives a request to obtain a business service, it uses the registration discovery tool 103 to obtain a list of service instances 102 of the business service from the global service registry of the registry center 101, and schedules the service instance 102 that responds to the request from the list of service instances 102 based on the status of the service instances 102 in the list of service instances 102.
[0026] In some implementation scenarios, the registration discovery tool 103 obtains the current global service registry from the registry center 101, uses the global service registry to determine a list of service instances 102 corresponding to the business service on different Kubernetes clusters 10, and selects the service instance 102 that will respond to the request based on the status of the service instances 102 in the list of service instances 102. Specifically, the status of the service instance 102 on the local Kubernetes cluster 10 is directly obtained by the registration discovery tool 103, which selects the service instance 102 that will respond to the request from the service instances 102 that are in a normal state.
[0027] In some implementation scenarios, requests are sent to Kubernetes cluster 10 according to load balancing principles. Kubernetes cluster 10 includes service instances 102 that can implement corresponding business services. The registration and discovery tool 103 matched by the corresponding service instance 102 obtains the current global service registry from the registry center 101. It uses the global service registry to determine the list of service instances 102 that correspond to the business service on different Kubernetes clusters 10. It obtains the status of the service instances 102 on the local Kubernetes cluster 10 and the status of the service instances 102 on other Kubernetes clusters 10 from the registry center 101. When the status of the local service instance 102 is normal, the local service instance 102 is selected to respond to the request. When the status of the local service instance 102 is abnormal, other service instances 102 in the service instance 102 list that are in normal status respond to the request.
[0028] Understandably, the multi-cluster architecture service scheduling system 1 can register and discover services through a third-party registry 101, thereby improving the convenience of service scheduling. Furthermore, the registry 101 includes service instances 102 in other Kubernetes clusters 10 and their corresponding statuses, thus selecting the optimal service instance 102 to respond to requests based on the status of the service instance 102, thereby improving the reliability of service scheduling.
[0029] The above scheme, the service scheduling system 1 with multi-cluster architecture includes multiple Kubernetes clusters 10 and a global synchronization controller 11. The Kubernetes clusters 10 include a registry center 101, multiple service instances 102 and their matching registration and discovery tools 103 and synchronization agents 104. Service instance 102 registers with the registration center 101 through the registration discovery tool 103, thereby registering service instance 102 in the local Kubernetes cluster 10. Service instance 102 can implement corresponding business services. Synchronization agent 104 is used to obtain the service instance 102 registered on the registration center 101 and synchronize the locally registered service instance 102 to the global synchronization controller 11. This enables the global synchronization controller 11 to maintain the global service registry corresponding to service instances 102 on all Kubernetes clusters 10, thereby aggregating the latest service instances 102 on all Kubernetes clusters 10 at the global synchronization controller 11. Synchronization agent 104 obtains the latest global service registry from the global service controller and determines the status of each service instance 102 and synchronizes it to the registration center 101, so that the registration center 101 of each Kubernetes cluster 10 records the service instances 102 in other Kubernetes clusters 10 and their corresponding status. When a Kubernetes cluster 10 receives a request for a business service, it uses the registration and discovery tool 103 to retrieve a list of service instances 102 of the business service from the global service registry of the registry center 101. Based on the status of the service instances 102 in the list, it schedules the service instance 102 that will respond to the request from the list. Therefore, the multi-cluster architecture service scheduling system 1 can perform service registration and discovery through a third-party registry center 101, improving the convenience of service scheduling. Furthermore, the registry center 101 includes service instances 102 in other Kubernetes clusters 10 and their corresponding statuses, thereby selecting the optimal service instance 102 to respond to the request based on the status of the service instance 102, improving the reliability of service scheduling.
[0030] Please see Figure 2 , Figure 2 This is a schematic diagram of another implementation of the service scheduling system with a multi-cluster architecture of this application. The service scheduling system 1 with a multi-cluster architecture includes multiple Kubernetes clusters 10 and a global synchronization controller 11. The Kubernetes clusters 10 include a registration center 101, multiple service instances 102 and their matching registration discovery tools 103, synchronization agents 104 and communication operation entry points 105. The synchronization agents include a synchronization module 1040 and a detection setting module 1041.
[0031] It should be noted that network interoperability in a multi-cluster architecture is a prerequisite for this system. There are many common solutions in the industry, which will not be elaborated here. For specific solutions, you can refer to and use open source components such as Cilium Mesh, Submariner, and Liqo to achieve interoperability across cluster networks.
[0032] Specifically, the synchronization module 1040 is used to obtain adjustment information of registered service instances 102 from the registry center 101 and synchronize the adjustment information to the global synchronization controller 11; wherein, the global synchronization controller 11 maintains a global service registry based on the adjustment information and synchronizes it to the synchronization modules 1040 of each cluster. The detection and setting module 1041 is used to obtain service instances 102 in other Kubernetes clusters 10 from the global service registry of the registry center 101, determine the status of service instances 102 in other Kubernetes clusters 10, obtain the routing policy of the local Kubernetes cluster 10, and set weights for service instances 102 on other Kubernetes clusters 10 based on the routing policy; wherein, the status and weights are synchronized to the registry center 101.
[0033] Understandably, the synchronization module 1040 is connected to the registration center 101, obtains the adjustment information of the registered service instance 102 from the registration center 101, and synchronizes the adjustment information to the global synchronization controller 11. When the global synchronization controller 11 receives the adjustment information, it updates the global service registry based on the adjustment information and synchronizes the updated global service registry to the synchronization modules 1040 of each cluster.
[0034] Optionally, the synchronization module 1040 can subscribe to and receive adjustment information pushes from the registration center 101, or periodically obtain adjustment information from the registration center 101.
[0035] In addition, the detection and setting module 1041 is used to obtain service instances 102 in other Kubernetes clusters 10 from the global service registry of the registry center 101, detect service instances 102 in other Kubernetes clusters 10, determine the status of service instances 102 in other Kubernetes clusters 10, and the detection and setting module 1041 is also used to obtain the routing policy of the local Kubernetes cluster 10, and set weights for service instances 102 on other Kubernetes clusters 10 based on the routing policy. Thus, for each Kubernetes cluster 10, it is possible to clearly identify the service instances 102 on other Kubernetes clusters 10 for the same business service and the status of the corresponding service instances 102, which facilitates scheduling the most reliable service instance 102.
[0036] For ease of explanation, taking the global service registry, which includes the instance information corresponding to the latest service instance 102 on each Kubernetes cluster 10, including instance ID, service name, cluster ID, IP address, port, status, and weight, as an example, the global service registry is represented in a table as follows: Table 1: Global Service Registry
[0037] The global service registry corresponds to a version. When any service instance 102 on any Kubernetes cluster 10 is adjusted, the version of the global service registry is updated. Table 1 above only shows the instance information corresponding to instance A in one cluster C1. Service instance 102 in any cluster can be stored in the above format.
[0038] It should be noted that the communication operation entry 105 is used to synchronize the routing policy of the local Kubernetes cluster 10 to the detection setting module 1041; the types of routing policies include default policy, weight policy and local policy.
[0039] Specifically, the communication operation entry 105 provides the detection setting module 1041 with an accurate routing policy. The detection setting module 1041 can obtain the routing policy of the local Kubernetes cluster 10 from the communication operation entry 105, and then set weights for instances on other Kubernetes clusters 10 after obtaining the routing policy. The value of the weight is related to the type of routing policy. The types of routing policies include the default policy, the weight policy, and the local policy. Each type of routing policy corresponds to its own set weight, ensuring the accuracy of the weight setting.
[0040] In some implementation scenarios, the default weight of service instance 102 on the local Kubernetes cluster 10 is 100. The weight corresponding to the default policy is 100, the weight corresponding to the weight policy can be customized according to the scenario, and the weight corresponding to the local policy is 0.
[0041] In one embodiment, the synchronization module 1040 is further configured to: upload the current global service registry of the registration center 101 to the global synchronization controller 11; wherein, the global synchronization controller 11 notifies the synchronization module 1040 to obtain the latest global service registry based on the difference between the latest global service registry and the global service registry uploaded by the synchronization module 1040; or, the synchronization module 1040 obtains the latest global service registry from the global synchronization controller 11 at preset time intervals.
[0042] Specifically, the synchronization module 1040 is used to upload the current global service registry of the registration center 101 to the global synchronization controller 11. The global synchronizer can determine whether there are differences by comparing the global service registry, and notify the synchronization module 1040 to obtain the latest global service registry, thereby ensuring the accuracy of the global service registry on the synchronization module 1040.
[0043] In addition, the synchronization module 1040 can also obtain the latest global service registry from the global synchronization controller 11 at preset time intervals, thereby reducing the processing burden of the global synchronization controller 11 and avoiding frequent updates to the global service registry on the synchronization module 1040 when service instances 102 on multiple Kubernetes clusters 10 change frequently in a short period of time.
[0044] Understandably, during the initial synchronization phase, the synchronization module 1040 can load local cluster information from the configuration, including the cluster ID, obtain a complete list of service instances 102 from the local registry center 101, obtain the full set of instances, add cluster metadata to the service instance 102 list, and report the full set of service instances 102 to the global synchronization controller 11. In subsequent synchronization phases, the synchronization module 1040 can obtain adjustment information for service instances 102 from the local registry center 101, obtain variable instances, add cluster metadata to the service instance 102 list, and report the variable instances to the global synchronization controller 11.
[0045] In addition, the synchronization module 1040 is also used to load the local cluster ID from the configuration and initialize the local global service registry version (Version) to 0. It then requests the global synchronization controller 11 with the cluster ID and the current local global service registry version, so that the global synchronization controller 11 can compare the requested Version with the Version in the global synchronization controller 11 and calculate change events. It obtains change events and the current Version of service instances 102 from other clusters from the global synchronization controller 11. Change events include the addition, deletion, and modification of service instances 102. It synchronizes the change events of service instances 102 from other clusters to the local registry center 101 and maintains the heartbeat of all other current cluster instances; it also updates the local global service registry version (Version) to the returned version. Instances in the registry center 101 need to renew their contracts / maintain heartbeats; otherwise, they will be deleted after a period of time.
[0046] It should be noted that the adjusted information includes the initial full instance and subsequent variable instances uploaded, as well as the corresponding cluster information. The global service registration list includes the cluster information. The global synchronization controller 11 is also used to: in response to obtaining the full instance, clear the information associated with the cluster information in the global service registry, and add the cluster information and the full instance to the global service registry; in response to obtaining the variable instance, supplement the cluster information and the variable instance to the global service registry.
[0047] Specifically, the global synchronization controller 11 can accept full instances or variable instances reported by the synchronization module 1040. If it is a full instance, it deletes all cluster information in the global service registry and then adds the reported full instance information to the global service registry. If it is a variable instance, it synchronizes the variable instance and cluster information to the global service registry. Therefore, the accuracy of cluster information is ensured and full instances are added during the initial synchronization phase of the cluster, while variable instances are used to reduce the processing load in subsequent synchronization phases.
[0048] Furthermore, after maintaining the global service registry, the global synchronization controller 11 updates the global service registry version (Version), notifies or waits for the synchronization agent 104 to pull incremental changes, compares the version requested by the synchronization agent 104 with the latest version, and returns the change event to the service instance 102.
[0049] In one embodiment, obtaining service instances 102 in other Kubernetes clusters 10 from the global service registry of the registry center 101 and determining the status of service instances 102 in other Kubernetes clusters 10 includes: obtaining service instances 102 in other Kubernetes clusters 10 corresponding to the same business service from the global service registry of the registry center 101 based on the business service corresponding to the service instance 102 registered on the registry center 101, and obtaining a group of service instances 102 corresponding to the corresponding business service; probing the service instances 102 in the group of service instances 102, and determining the status of service instances 102 in other Kubernetes clusters 10 based on the probing results.
[0050] Specifically, the detection and setting module 1041 can obtain the service instances 102 registered in the local cluster from the registration center 101, determine the business service corresponding to the service instance 102, obtain the service instances 102 corresponding to the same business service in other Kubernetes clusters 10 from the global service registry of the registration center 101, and obtain the service instance 102 group corresponding to the business service for the business service that can be implemented in the local cluster.
[0051] Furthermore, the service instance 102 in the service instance 102 group is probed, the probe results are determined, and the status of the service instance 102 in other Kubernetes clusters 10 is determined based on the probe results, so as to perform health probes on instances in other clusters and synchronize the probe results to the local registry center 101 to realize automatic disaster recovery for service calls between clusters.
[0052] It should be noted that the registration discovery tool 103 is also used to: obtain the status and weight of service instances 102 on other Kubernetes clusters 10 in the service instance 102 list from the registration center 101; obtain the status and default weight of service instances 102 on the local Kubernetes cluster 10; and schedule service instances 102 responding to requests from the service instance 102 list based on the status and weight of each service instance 102 in the service instance 102 list.
[0053] Specifically, the registration discovery tool 103 can identify the service instances 102 on the local Kubernetes cluster 10 and other Kubernetes clusters 10 in the service instance 102 list, obtain the status and weight of the service instances 102 on other Kubernetes clusters 10 from the registration center 101, and schedule the service instances 102 responding to the requests from the service instance 102 list based on the status and weight of each service instance 102 in the service instance 102 list, so as to ensure the high availability of the service instances 102 and automatically recover from disasters when some service instances 102 are in an abnormal state.
[0054] In one embodiment, scheduling a service instance 102 to respond to a request from the service instance 102 list based on the status and weight of each service instance 102 in the service instance 102 list includes: removing service instances 102 with abnormal status from the service instance 102 list, performing weighted round-robin based on the weights corresponding to the service instances 102 with normal status in the service instance 102 list, and scheduling a service instance 102 to respond to a request from the service instance 102 list.
[0055] Specifically, service instances 102 in the list of service instances 102 that are in an abnormal state are removed, and only service instances 102 in a normal state are retained. Based on the weights of the service instances 102 in the list of service instances 102 that are in a normal state, a weighted round-robin is performed to schedule the service instances 102 that respond to the request from the list of service instances 102.
[0056] In a specific implementation scenario, the inter-cluster routing policy configured in cluster C1 is Local. The service instances 102 containing business service A in the registry center 101 of cluster C1 are: AC1 (172.31.1.1, weight 100) and AC2 (172.32.2.2, weight 0). AC2 belongs to cluster C2. Under normal circumstances, according to the weighted round-robin algorithm, requests from other services in cluster C1 to business service A will be routed to AC1. However, when AC1 is in an abnormal health state, requests from other services in cluster C1 to business service A will only be routed to AC2. This achieves local cluster routing priority and high availability of service calls, meaning that even if a single cluster service fails, it will not affect the business.
[0057] In a specific implementation scenario, the inter-cluster routing policy configured in cluster C1 is Weight. The service instances 102 containing business service A in the registry 101 of cluster C1 are: AC1 (172.31.1.1, weight 100) and AC2 (172.32.2.2, weight 100). AC2 belongs to cluster C2. Under normal circumstances, according to the weighted round-robin algorithm, when other services in cluster C1 request business service A, the requests will be evenly routed to AC1 and AC2. However, when problems occur in cross-cluster networks, the synchronous proxy 104 will detect that AC2 is unusable and mark AC2 as abnormal. Therefore, when other services in cluster C1 request business service A, they will only be routed to AC1, thus achieving automatic disaster recovery for inter-cluster traffic.
[0058] It is understandable that the dynamic calculation of the scheduling ratio among Kubernetes clusters 10 is achieved by the synchronous agent 104 of each cluster obtaining the routing policy of the corresponding service instance 102 in the local cluster, calculating the weight of the service instance 102 according to the policy, updating it to the registration center 101 in the cluster, and then using the registration discovery tool 103 to perform weighted round-robin according to the instance weight, thereby ensuring the reliability of the scheduling of service instance 102.
[0059] Please see Figures 1-3 , Figure 3 This is a schematic diagram of an embodiment of the service scheduling method for a multi-cluster architecture of this application. The method is applied to the service scheduling system 1 of the multi-cluster architecture in any of the above embodiments, and includes: S301: In response to the service instances in the Kubernetes cluster registering with the registry center through the matching registration discovery tool, the synchronization agent obtains the service instances registered on the registry center and synchronizes them to the global synchronization controller.
[0060] Specifically, when a service instance 102 in a Kubernetes cluster 10 registers with the registry center 101 through a matching registration discovery tool 103, the synchronization agent 104 retrieves the registered service instance 102 from the registry center 101 and synchronizes it to the global synchronization controller 11.
[0061] In one embodiment, after the synchronization agent 104 obtains the service instance 102 from the registration center 101, it feeds back the information corresponding to the service instance 102 registered on the registration center 101 to the global synchronization controller 11.
[0062] In one embodiment, the synchronization agent 104 monitors the service instance 102 that has been adjusted on the registry center 101 and feeds back the information corresponding to the adjusted service instance 102 to the global synchronization controller 11.
[0063] S302: Use the global synchronization controller to maintain the global service registry for service instances on all Kubernetes clusters.
[0064] Specifically, the global synchronization controller 11 maintains the global service registry based on the service instances 102 synchronized by the synchronization agent 104 of all Kubernetes clusters 10.
[0065] In one implementation, the global synchronization controller 11 uses information fed back from the synchronization agents 104 of all Kubernetes clusters 10 to maintain a global service registry.
[0066] In one implementation, the global synchronization controller 11 uses the adjustment information of service instance 102 on the Kubernetes cluster 10 to maintain a global service registry.
[0067] S303: Use the synchronization agent to obtain the latest global service registry from the global service controller and determine the status of each service instance to synchronize to the registry center.
[0068] Specifically, the synchronization agent 104 obtains the latest global service registry from the global service controller and determines the status of each service instance 102 and synchronizes it to the registration center 101, so that the registration center 101 of each Kubernetes cluster 10 records the service instances 102 in other Kubernetes clusters 10 and their corresponding statuses.
[0069] In one implementation, the global service controller maintains a version of the global service registry. When a service instance 102 on any Kubernetes cluster 10 is adjusted, the version of the global service registry is updated. The global service controller notifies the synchronization agent 104 on each Kubernetes cluster 10 to obtain the latest version of the global service registry. The synchronization agent 104 is then used to probe the service instances 102 on other Kubernetes clusters 10 to determine the status of the service instances 102 on other Kubernetes clusters 10.
[0070] In one embodiment, the synchronization agent 104 obtains the global service registry maintained on the global synchronization controller 11 at preset time intervals, and determines the heartbeat signal of the cluster from other Kubernetes clusters 10, and determines the status of the service instance 102 on other Kubernetes clusters 10 based on the heartbeat signal.
[0071] S304: In response to a request to obtain business services from the Kubernetes cluster, the service instance list of the business services is obtained from the global service registry of the registry center using the registration discovery tool. Based on the status of the service instances in the service instance list, the service instance responding to the request is scheduled.
[0072] Specifically, when the Kubernetes cluster 10 receives a request to obtain a business service, it uses the registration discovery tool 103 to obtain a list of service instances 102 of the business service from the global service registry of the registry center 101, and schedules the service instance 102 that responds to the request from the list of service instances 102 based on the status of the service instances 102 in the list of service instances 102.
[0073] It is understood that the above method matches the functionality that the service scheduling system 1 with the multi-cluster architecture in any of the above embodiments can achieve, and this application will not elaborate further on this.
[0074] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device 40 includes a memory 401 and a processor 402 coupled to each other. The memory 401 stores program data (not shown in the figure). The processor 402 calls the program data to implement the method in any of the above embodiments. For the description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0075] Please see Figure 5 , Figure 5This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 50 stores program data 500. When the program data 500 is executed by a processor, it implements the method in any of the above embodiments. For related descriptions, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0076] It should be noted that the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0077] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0078] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0079] The above description is merely an embodiment of this application and does not limit the scope of protection of this application. Any equivalent structural or procedural transformations made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of protection of this application.
Claims
1. A service scheduling system of a multi-cluster architecture, characterized in that, The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system.
2. The service dispatch system of multi-cluster architecture according to claim 1, wherein, The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. 3.The service scheduling system of multi-cluster architecture of claim 2, wherein, The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system.
4. The service dispatch system of multi-cluster architecture according to claim 3, wherein, The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system.
5. The service dispatch system of multi-cluster architecture according to claim 2, wherein, The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to a global service registration and discovery method and system. The application relates to The global synchronization controller notifies the synchronization module to obtain the latest global service registry based on the difference between the latest global service registry and the global service registry uploaded by the synchronization module; or the synchronization module obtains the latest global service registry from the global synchronization controller at a preset time interval.
6. The service dispatch system of multi-cluster architecture according to claim 5, wherein, The adjustment information includes a full instance uploaded for the first time, a variable instance uploaded subsequently, and corresponding cluster information, and the global service registry list includes the cluster information; The global synchronization controller is further configured to: In response to obtaining the full instance, clear the information associated with the cluster information in the global service registry, and add the cluster information and the full instance to the global service registry; In response to obtaining the variable instance, supplement the cluster information and the variable instance to the global service registry.
7. The service dispatch system of multi-cluster architecture according to claim 2, wherein, The method for obtaining service instances in other Kubernetes clusters from the global service registry of the registration center and determining the state of the service instances in other Kubernetes clusters includes: Based on the business service corresponding to the service instance registered on the registration center, obtain the service instance corresponding to the same business service in other Kubernetes clusters from the global service registry of the registration center to obtain a service instance group corresponding to the business service; Detect the service instances in the service instance group, and determine the state of the service instances in other Kubernetes clusters based on the detection result.
8. The service dispatch system of multi-cluster architecture according to claim 2, wherein, The service scheduling system of the multi-cluster architecture further includes: A communication operation portal configured to synchronize the routing strategy of the local Kubernetes cluster to the detection setting module; wherein the routing strategy includes a default strategy, a weight strategy, and a local strategy. 9.A service scheduling method of a multi-cluster architecture, characterized in that, The method applied to the service scheduling system of the multi-cluster architecture of any one of claims 1-8 includes: In response to the service instance in the Kubernetes cluster registering with the registration center through the matched registration and discovery tool, use the synchronization agent to obtain the service instance registered on the registration center and synchronize to the global synchronization controller; Use the global synchronization controller to maintain the global service registry corresponding to the service instance on all the Kubernetes clusters; Use the synchronization agent to obtain the latest global service registry from the global service controller and determine the state synchronization of each service instance to the registration center; In response to the Kubernetes cluster obtaining a request to obtain a business service, use the registration and discovery tool to obtain the service instance list of the business service from the global service registry of the registration center, and based on the state of the service instance in the service instance list, schedule the service instance responding to the request.
10. An electronic device, comprising: It includes: The memory and the processor are coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method of claim 9.
11. A computer readable storage medium having stored thereon program data, wherein, The program data is executed by the processor to implement the method of claim 9.