Method and system for implementing open, multi-cloud, multi-cluster federation

By configuring the PropagationPolicy and OverridePolicy policies, combined with the aggregation layer API and SchedulerController, the problem of unified resource distribution and load balancing scheduling in the kubernetes federated cluster is solved, automatic failover of the cluster is realized, and the elasticity and reliability of the system are improved.

CN115460089BActive Publication Date: 2024-10-01IND BANK CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211046691.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2024-10-01
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

The existing kubernetes federated cluster solution has problems such as inconvenient permission management, difficulty in version iteration, poor elasticity and insufficient failover capabilities in multi-cluster management.

Method used

By configuring PropagationPolicy and OverridePolicy policies, the aggregation layer API service and SchedulerController are used to implement unified resource delivery and load balancing scheduling, and a failover process is designed to automatically transfer applications from a failed cluster to a healthy cluster.

Benefits of technology

It achieves unified management and differentiated configuration of resources, solves the problems of cluster decentralized management and failover, and improves the flexibility and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115460089B_ABST
    Figure CN115460089B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for implementing an open, multi-cloud, multi-cluster federation, including: step S1: a new cluster joins a federated cluster; step S2: an application is issued through a federated cluster; step S3: after the application is issued, when a member cluster fails, the application automatically transfers to a healthy cluster. The present invention designs a cluster scheduler SchedulerController, which not only implements load balancing load-aware scheduling, but also invents a failover process, which can automatically transfer the load to a healthy member cluster when a cluster fails.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a method and system for realizing open, multi-cloud, and multi-cluster federation. Background Art

[0002] The kubernetes development community provides a kubernetes federation cluster solution. This technical solution manages member clusters as a resource, but does not add new resource definitions. As a result, a new adapter must be added every time a new resource is created. It cannot effectively manage permissions in multiple clusters, does not support RBAC, has no independent API, and is difficult to evolve in version iteration. The federation-level settings and policy API resource annotations make the elasticity poor, and there is no failover process when a member cluster fails.

[0003] Patent document CN113742033A (application number: 202111048076.8) discloses a method for implementing a kubernetes cluster federation, which relates to the field of network communication technology and solves the service discovery and orchestration problems of kubernetes' cross-cluster resources. The method is: setting a cluster controller, a state controller, a synchronization controller, a scheduler, and a command controller; initializing the cluster controller, the state controller, the synchronization controller, the scheduler, and the command controller to the kubernetes system, so that the kubernetes becomes the main cluster of the federated cluster, and the cluster controller, the state controller, the synchronization controller, the scheduler, and the command controller can run at least one copy. The present invention also discloses a kubernetes cluster federation system. The present invention runs a cluster controller, a state controller, a synchronization controller, a scheduler, and a command controller in the kubernetes system, and utilizes the CRD resources and admission webhook admission control built into kubernetes to achieve a complete cluster federation function, realize unified management of multiple Kubernetes clusters by a single cluster, and effectively solve the service discovery and orchestration problems of kubernetes' cross-cluster resources. Summary of the invention

[0004] In view of the defects in the prior art, the purpose of the present invention is to provide a method and system for implementing an open, multi-cloud, multi-cluster federation.

[0005] A method for implementing an open, multi-cloud, multi-cluster federation provided by the present invention includes:

[0006] Step S1: The new cluster joins the federated cluster;

[0007] Step S2: The application is delivered through the federated cluster;

[0008] Step S3: After the application is delivered, when a member cluster fails, the application is automatically transferred to the healthy cluster.

[0009] Preferably, the step S1 adopts:

[0010] Step S1.1: Call the aggregation layer API service, pass in the cluster certificate to be joined, the access entry address, and the member cluster name member;

[0011] Step S1.2: The control cluster creates a service account in the member cluster and configures clusterrole and clusterrolebinding for the serviceaccount. By configuring the above SA, the control cluster is authorized to access the / readyz or / healthz URL of the member cluster member, so as to determine the health status of the cluster;

[0012] Step S1.3: The control cluster creates a cluster object in the control cluster, saves the access entry address and access certificate, and starts the cluster status update process at a preset time interval;

[0013] Step S1.4: In the update process, access the access entry address saved in the cluster object, obtain the / readyz or healthz interface, and if a 200 http response is obtained, it means that the cluster is healthy, otherwise it means that the cluster is unhealthy, and the status is updated to the cluster object.

[0014] Preferably, the step S2 adopts:

[0015] Step S2.1: Submit the propagation policy PropagationPolicy, partition overload policy OverridePolicy and KubernetesObject on the control cluster side;

[0016] Step S2.2: The propagation policy PropagationPolicy and KubernetesObject resources are monitored by the controller ResourcesController. ResourcesController monitors the original KubernetesObject and PropagationPolicy resources, completes resource binding, and generates a ResourcesBinding object.

[0017] Step S2.3: After observing the ResourcesBinding object, BindingController finds the associated partition override policy OverridePolicy, implements the binding between the ResourcesBinding object and OverridePolicy, and sets ResourcesBinding to be schedulable;

[0018] Step S2.4: After SchedulerController is started, it loops to obtain all schedulable ResourcesBindings, sets the number of replicas for each cluster and region according to the dynamic load, and generates Work objects in combination with the OverridePolicy overload differentiation strategy;

[0019] Step S2.5: After the ExecutionController is started, when the Work object is created, it is responsible for synchronizing the Work object to the cluster to complete the application delivery.

[0020] Preferably, the step S2.2 adopts:

[0021] Step S2.2.1: After the PropagationPolicy is submitted to the control cluster, ResourcesController extracts the name of the resource to be propagated from the PropagationPolicy information;

[0022] Step S2.2.2: Use the extracted resource name to check whether the associated KubernetesObject has been submitted by the user in the waiting queue. If not, the PropagationPolicy propagation policy is thrown into the waiting queue and waits for the next processing. If a match is found, a ResourcesBinding object is created.

[0023] Preferably, the step S2.4 adopts:

[0024] Step S2.4.1: After SchedulerController is started, it obtains the entry address and access certificate of each cluster by reading the cluster object; and starts the cluster status detection process; the status detection process accesses the / ready interface in real time, updates the status of the managed cluster and the remaining allocatable resources, and synchronously listens to the ResourcesBinding object event;

[0025] Step S2.4.2: After ResourcesBinding is derived by ResourcesController, SchedulerController first obtains the name of the associated cluster through the ResourcesBinding object, and then obtains the resources that need to be propagated;

[0026] Step S2.4.3: After obtaining the cluster name, match it with the healthy cluster. After the match is successful, calculate the number of nodes that can be scheduled by the propagation cluster and the resources that can be scheduled, and then calculate the resource requirements of the propagated objects, and finally get the number of Pods that can be actually scheduled by the cluster;

[0027] Step S2.4.4: Get the number of Pods that can be scheduled and compare it with the expected number of replicas. If the number of Pods that can be scheduled is less than the expected number of replicas, dynamically adjust the number of replicas to a cluster with sufficient resources that cannot meet the scheduling requirements. After the adjustment is successful, modify the ResourcesBinding object, set the number of replicas for each cluster, and mark the ResourcesBinding scheduling as completed.

[0028] Step S2.4.5: After the scheduling is completed, SchedulerController obtains the associated overload policy OverridePolicy, reads the content that needs to be overloaded, and then generates a Work object for each propagated cluster. The spec.data field of the Work object is filled with the content of the propagated resource.

[0029] Preferably, the step S3 adopts:

[0030] Step S3.1: After the new cluster is added as a member cluster of the federation, SchedulerController starts the status detection process and resource calculation process;

[0031] Step S3.2: The detection process accesses the / healthy interface of the cluster, obtains all working nodes of the member cluster, including the control node and working nodes of the member cluster, and detects the nodes at intervals. The node status of the member cluster is realized by detecting the kubelet service port, and the member cluster and node status are recorded in the control cluster;

[0032] Step S3.3: When the member cluster status changes from available to unavailable, first determine the status of the nodes to which it belongs. When more than half of the nodes become unavailable, the failover process begins;

[0033] Step S3.4: After the failover process is started, it is determined again that more than half of the nodes on the faulty cluster are unavailable, and a proportion of containers cannot be started due to insufficient resources. After the above conditions are met, all Work objects on the faulty cluster are obtained;

[0034] Step S3.5: traverse the saved work objects of the faulty cluster and count the total resources of all work objects, including memory and CPU data, as an important basis for selecting clusters;

[0035] Step S3.6: Obtain all members in healthy state, use the comprehensive resources of the acquired fault cluster statistics as the screening condition, screen all clusters that meet the condition, and obtain a preliminary matching cluster list;

[0036] Step S3.7: Score the preliminary matched cluster list, and select the cluster with the highest score based on the comprehensive scores of remaining resources, number of nodes, and node latency;

[0037] Step S3.8: After selecting the cluster with the highest score, get the cluster address, access the certificate, and get all the work objects of the cluster to be deployed;

[0038] Step S3.9: Get all work objects works1 from the faulty cluster, get the work object works2 that has been deployed in the native work cluster from the cluster with the highest score, and get the work lists of the two clusters;

[0039] Step S3.10: Compare the two work objects, loop through works2 and compare works1 in turn, find the work object with the same name, and modify the work object with the same name when it is found. At the same time, modify the cluster field in the work object, fill in the address of the new cluster and the access token, and change the delivery status to not delivered.

[0040] Step S3.11: After the ExecutionController detects a new work object that has not been issued, it takes out the cluster address and token of the cluster to be issued in the work, creates resources in sequence after the resources are issued, and starts the update thread;

[0041] Step S3.12: The update thread synchronizes the status of each work object in turn through the work object, collects the status of the issued resources from the issued cluster, and synchronizes the work status, thus completing the cluster failover process.

[0042] A system for implementing an open, multi-cloud, multi-cluster federation according to the present invention includes:

[0043] Module M1: A new cluster joins the federated cluster;

[0044] Module M2: The application is delivered through the federated cluster;

[0045] Module M3: After the application is delivered, when a member cluster fails, the application is automatically transferred to the healthy cluster.

[0046] Preferably, the module M1 adopts:

[0047] Module M1.1: Call the aggregation layer API service, pass in the cluster certificate to be joined, access entry address, and member cluster name member;

[0048] Module M1.2: The control cluster creates a service account in the member cluster and configures clusterrole and clusterrolebinding for the serviceaccount. By configuring the above SA, the control cluster is authorized to access the / readyz or / healthz URL of the member cluster member to determine the health status of the cluster.

[0049] Module M1.3: Control cluster creates a cluster object in the control cluster, saves the access entry address and access certificate, and starts the cluster status update process at a preset time interval;

[0050] Module M1.4: During the update process, access the access entry address saved in the cluster object and obtain the / readyz or healthz interface. If a 200 HTTP response is obtained, it means that the cluster is healthy, otherwise it means that the cluster is unhealthy, and the status is updated to the cluster object.

[0051] Preferably, the module M2 adopts:

[0052] Module M2.1: Submit the propagation policy PropagationPolicy, partition overload policy OverridePolicy and KubernetesObject on the control cluster side;

[0053] Module M2.2: The propagation policy PropagationPolicy and KubernetesObject resources are monitored by the controller ResourcesController. ResourcesController monitors the original KubernetesObject and PropagationPolicy resources, completes resource binding, and generates a ResourcesBinding object;

[0054] Module M2.3: After observing the ResourcesBinding object, BindingController finds the associated partition override policy OverridePolicy, implements the binding between the ResourcesBinding object and OverridePolicy, and sets ResourcesBinding to be schedulable;

[0055] Module M2.4: After SchedulerController is started, it loops to obtain all schedulable ResourcesBindings, sets the number of replicas for each cluster and region according to the dynamic load, and generates Work objects in combination with the OverridePolicy overload differentiation strategy;

[0056] Module M2.5: After the ExecutionController is started, when the Work object is created, it is responsible for synchronizing the Work object to the cluster and completing the application delivery;

[0057] The module M2.2 adopts:

[0058] Module M2.2.1: After the PropagationPolicy is submitted to the control cluster, ResourcesController extracts the name of the resource to be propagated from the PropagationPolicy information;

[0059] Module M2.2.2: Use the extracted resource name to search the waiting queue to see if the associated KubernetesObject has been submitted by the user. If not, the PropagationPolicy propagation policy is thrown into the waiting queue and waits for the next processing. If a match is found, a ResourcesBinding object is created.

[0060] The module M2.4 adopts:

[0061] Module M2.4.1: After SchedulerController is started, it obtains the entry address and access certificate of each cluster by reading the cluster object; and starts the cluster status detection process; the status detection process accesses the / ready interface in real time, updates the status of the managed cluster and the remaining allocatable resources, and synchronously listens to ResourcesBinding object events;

[0062] Module M2.4.2: After ResourcesBinding is derived from ResourcesController, SchedulerController first obtains the name of the associated cluster through the ResourcesBinding object, and then obtains the resources that need to be propagated;

[0063] Module M2.4.3: After obtaining the cluster name, match it with the healthy cluster. After the match is successful, calculate the number of nodes that can be scheduled by the propagation cluster and the resources that can be scheduled, and then calculate the resource requirements of the propagated objects, and finally get the number of Pods that can be actually scheduled by the cluster;

[0064] Module M2.4.4: Get the number of Pods that can be scheduled and compare it with the expected number of replicas. If the number of Pods that can be scheduled is less than the expected number of replicas, dynamically adjust the number of replicas to a cluster with sufficient resources that cannot meet the scheduled number of replicas. After the adjustment is successful, modify the ResourcesBinding object, set the number of replicas for each cluster, and mark the ResourcesBinding scheduling as completed.

[0065] Module M2.4.5: After the scheduling is completed, SchedulerController obtains the associated override policy OverridePolicy, reads the content that needs to be overloaded, and then generates a Work object for each propagated cluster. The spec.data field of the Work object is filled with the content of the propagated resource.

[0066] Preferably, the module M3 adopts:

[0067] Module M3.1: After the new cluster is added as a member cluster of the federation, SchedulerController starts the status detection process and resource calculation process;

[0068] Module M3.2: The detection process accesses the / healthy interface of the cluster, obtains all working nodes of the member cluster, including the control node and working nodes of the member cluster, and detects the nodes at intervals. The node status of the member cluster is realized by detecting the kubelet service port, and the member cluster and node status are recorded in the control cluster;

[0069] Module M3.3: When the member cluster status changes from available to unavailable, first determine the status of the nodes to which it belongs. When more than half of the nodes become unavailable, the failover process is performed;

[0070] Module M3.4: After the failover process is started, it is determined again that more than half of the nodes on the faulty cluster are unavailable, and a certain proportion of containers cannot be started due to insufficient resources. After the above conditions are met, all Work objects on the faulty cluster are obtained;

[0071] Module M3.5: Traverse the saved work objects of the faulty cluster and count the total resources of all work objects, including memory and CPU data, as an important basis for selecting clusters;

[0072] Module M3.6: Obtain all members in healthy state, use the comprehensive resources of the acquired fault cluster statistics as the screening condition, screen all clusters that meet the conditions, and obtain a preliminary matching cluster list;

[0073] Module M3.7: Score the preliminary matching cluster list, and select the cluster with the highest score based on the remaining resources, number of nodes, and node latency.

[0074] Module M3.8: After selecting the cluster with the highest score, get the cluster address, access the certificate, and get all the work objects of the cluster to be deployed;

[0075] Module M3.9: Get all work objects works1 from the faulty cluster, get the work object works2 that has been deployed in the native work cluster from the cluster with the highest score, and get the work lists of the two clusters;

[0076] Module M3.10: Compare the two work objects, loop through works2 and compare works1 in turn, find the work object with the same name, and modify the work object with the same name when it is found. At the same time, modify the cluster field in the work object, fill in the address of the new cluster and the access token, and change the delivery status to not delivered.

[0077] Module M3.11: After the ExecutionController detects a new work object that has not been issued, it takes out the cluster address and token of the cluster to be issued in the work, creates resources in sequence after the resources are issued, and starts the update thread;

[0078] Module M3.12: The update thread synchronizes the status of each work object in turn through the work object, collects the status of the issued resources from the issued cluster, and synchronizes the work status, thus completing the cluster failover process.

[0079] Compared with the prior art, the present invention has the following beneficial effects:

[0080] 1. By configuring the PropagationPolicy strategy, resources can be uniformly distributed without the need to define each cluster separately, solving the problem of decentralized cluster management.

[0081] 2. Implement differentiated configuration of member clusters by configuring the OverridePolicy strategy to solve the problem of differentiated cluster deployment.

[0082] 3. By configuring the cluster object, a cluster object is bound to a cluster, and cluster configuration management is implemented by defining the cluster object.

[0083] 4. Designed a cluster scheduler SchedulerController, which not only implements load balancing and load-aware scheduling, but also invented a failover process. When a cluster fails, it can automatically transfer the load to a healthy member cluster. BRIEF DESCRIPTION OF THE DRAWINGS

[0084] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0085] Figure 1 Schematic diagram of application delivery and differentiated settings for multi-cloud environments.

[0086] Figure 2 Schematic diagram of load-aware scheduling.

[0087] Figure 3 This is a schematic diagram of cluster status awareness.

[0088] Figure 4 This is a schematic diagram of the unified access portal for multiple clusters.

[0089] Figure 5 The following is a cluster failover flowchart. DETAILED DESCRIPTION

[0090] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0091] The present invention provides multi-cloud environment application delivery, differentiated settings, and load-aware scheduling, solves the problem of unified access portals for multiple clusters, and realizes cluster failover.

[0092] Example 1

[0093] According to the present invention, a method for implementing open, multi-cloud, multi-cluster federation is provided. Figures 1 to 5 As shown, including:

[0094] Step S1: The new cluster joins the federated cluster;

[0095] Specifically, the step S1 adopts:

[0096] Step S1.1: Call the aggregation layer API service, pass in the cluster certificate to be joined, the access entry address, and the member cluster name member;

[0097] Step S1.2: The control cluster creates a service account in the member cluster and configures clusterrole and clusterrolebinding for the serviceaccount. By configuring the above SA, the control cluster is authorized to access the / readyz or / healthz URL of the member cluster member, so as to determine the health status of the cluster;

[0098] Step S1.3: The control cluster creates a cluster object in the control cluster, saves the access entry address and access certificate, and starts the cluster status update process at 10s intervals;

[0099] Step S1.4: In the update process, access the access entry address saved in the cluster object, obtain the / readyz or healthz interface, and if a 200 http response is obtained, it means that the cluster is healthy, otherwise it means that the cluster is unhealthy, and the status is updated to the cluster object.

[0100] Step S2: The application is delivered through the federated cluster;

[0101] Specifically, the step S2 adopts:

[0102] Step S2.1: Submit the propagation policy PropagationPolicy, partition overload policy OverridePolicy and KubernetesObject on the control cluster side;

[0103] Step S2.2: The propagation policy PropagationPolicy and KubernetesObject resources are monitored by the controller ResourcesController. ResourcesController monitors the original KubernetesObject and PropagationPolicy resources, completes resource binding, and generates a ResourcesBinding object.

[0104] Step S2.3: After observing the ResourcesBinding object, BindingController finds the associated partition override policy OverridePolicy, implements the binding between the ResourcesBinding object and OverridePolicy, and sets ResourcesBinding to be schedulable;

[0105] Step S2.4: After SchedulerController is started, it loops to obtain all schedulable ResourcesBindings, sets the number of replicas for each cluster and region according to the dynamic load, and generates Work objects in combination with the OverridePolicy overload differentiation strategy;

[0106] Step S2.5: After the ExecutionController is started, when the Work object is created, it is responsible for synchronizing the Work object to the cluster and completing the application delivery;

[0107] The PropagationPolicy propagation strategy is a declarative resource implemented based on the Customer Resources Definitions technology. The PropagationPolicy declares the KubernetesObject and the cluster to be delivered to achieve unified delivery of applications.

[0108] The OverridePolicy partition overload strategy is a declarative resource based on Customer ResourcesDefinitions technology. The OverridePolicy declaration requires differentiated configuration. The overload strategy includes the following three methods: PlaintextOverridder, CommandOverridder, and ArgsOverride; corresponding to spec overload, named overload, and parameter overload respectively;

[0109] The ResourcesBinding binding strategy is a declarative resource based on the Customer Resources Definitions technology. ResourcesBinding is responsible for binding the PropagationPolicy with the KubernetesObject. Only after the binding relationship is established can cluster scheduling be performed.

[0110] The Work strategy is a declarative resource based on the Customer Resources Definitions technology. A Work object is used for a cluster. The Work object records the status information of the cluster and the resources that are issued. The Work object is responsible for the coordination of container resources on each cluster.

[0111] The ResourcesController service includes a general controller responsible for the kubernetes resource object coordination and processing logic, as well as matching the PropagationPolicy propagation strategy, and deriving the ResourcesBinding object corresponding to the resource object according to the propagation strategy;

[0112] The BindingController service mainly handles the logic of adding, deleting, checking and modifying ResourcesBinding resource objects, implements the binding relationship between ResourcesBinding and OverridePolicy, sets the initial state of cluster binding, etc.

[0113] The SchedulerController service is the scheduler for the entire multi-cloud management and is responsible for completing resource object scheduling. For resource objects that need to calculate the replica ratio, some clusters will be selected based on the filter and score, and then the number of replicas distributed to each cluster application will be calculated for the resource object type that needs to allocate replicas, and finally a Work object will be generated. The SchedulerController is also responsible for cluster failover scheduling;

[0114] The ExecutionController service is used to process the Work object, is responsible for creating the resources set in the Work on the corresponding cluster, and is responsible for subsequent status synchronization and fault repair work.

[0115] Specifically, the step S2.2 adopts:

[0116] Step S2.2.1: After the PropagationPolicy is submitted to the control cluster, ResourcesController extracts the name of the resource to be propagated from the PropagationPolicy information;

[0117] Step S2.2.2: Use the extracted resource name to check whether the associated KubernetesObject has been submitted by the user in the waiting queue. If not, the PropagationPolicy propagation policy is thrown into the waiting queue and waits for the next processing. If a match is found, a ResourcesBinding object is created.

[0118] Specifically, the step S2.4 adopts:

[0119] Step S2.4.1: After SchedulerController is started, it obtains the entry address and access certificate of each cluster by reading the cluster object; and starts the cluster status detection process; the status detection process accesses the / ready interface in real time, updates the status of the managed cluster and the remaining allocatable resources, and synchronously listens to the ResourcesBinding object event;

[0120] Step S2.4.2: After ResourcesBinding is derived by ResourcesController, SchedulerController first obtains the name of the associated cluster through the ResourcesBinding object, and then obtains the resources that need to be propagated;

[0121] Step S2.4.3: After obtaining the cluster name, match it with the healthy cluster. After the match is successful, calculate the number of nodes that can be scheduled by the propagation cluster and the resources that can be scheduled, and then calculate the resource requirements of the propagated objects, and finally get the number of Pods that can be actually scheduled by the cluster;

[0122] Step S2.4.4: Get the number of Pods that can be scheduled and compare it with the expected number of replicas. If the number of Pods that can be scheduled is less than the expected number of replicas, dynamically adjust the number of replicas to a cluster with sufficient resources that cannot meet the scheduling requirements. After the adjustment is successful, modify the ResourcesBinding object, set the number of replicas for each cluster, and mark the ResourcesBinding scheduling as completed.

[0123] Step S2.4.5: After the scheduling is completed, SchedulerController obtains the associated overload policy OverridePolicy, reads the content that needs to be overloaded, and then generates a Work object for each propagated cluster. The spec.data field of the Work object is filled with the content of the propagated resource.

[0124] Step S3: After the application is delivered, when a member cluster fails, the application is automatically transferred to the healthy cluster.

[0125] Specifically, the step S3 adopts:

[0126] Step S3.1: After the new cluster is added as a member cluster of the federation, SchedulerController starts the status detection process and resource calculation process;

[0127] Step S3.2: The detection process accesses the / healthy interface of the cluster, obtains all working nodes of the member cluster, including the control node and working nodes of the member cluster, and detects the nodes at intervals. The node status of the member cluster is realized by detecting the kubelet service port, and the member cluster and node status are recorded in the control cluster;

[0128] Step S3.3: When the member cluster status changes from available to unavailable, first determine the status of the nodes to which it belongs. When more than half of the nodes become unavailable, the failover process begins;

[0129] Step S3.4: After the failover process is started, it is determined again that more than half of the nodes on the faulty cluster are unavailable, and a proportion of containers cannot be started due to insufficient resources. After the above conditions are met, all Work objects on the faulty cluster are obtained;

[0130] Step S3.5: traverse the saved work objects of the faulty cluster and count the total resources of all work objects, including memory and CPU data, as an important basis for selecting clusters;

[0131] Step S3.6: Obtain all members in healthy state, use the comprehensive resources of the acquired fault cluster statistics as the screening condition, screen all clusters that meet the condition, and obtain a preliminary matching cluster list;

[0132] Step S3.7: Score the preliminary matched cluster list, and select the cluster with the highest score based on the comprehensive scores of remaining resources, number of nodes, and node latency;

[0133] Step S3.8: After selecting the cluster with the highest score, get the cluster address, access the certificate, and get all the work objects of the cluster to be deployed;

[0134] Step S3.9: Get all work objects works1 from the faulty cluster, get the work object works2 that has been deployed in the native work cluster from the cluster with the highest score, and get the work lists of the two clusters;

[0135] Step S3.10: Compare the two work objects, loop through works2 and compare works1 in turn, find the work object with the same name, and modify the work object with the same name when it is found. At the same time, modify the cluster field in the work object, fill in the address of the new cluster and the access token, and change the delivery status to not delivered.

[0136] Step S3.11: After the ExecutionController detects a new work object that has not been issued, it takes out the cluster address and token of the cluster to be issued in the work, creates resources in sequence after the resources are issued, and starts the update thread;

[0137] Step S3.12: The update thread synchronizes the status of each work object in turn through the work object, collects the status of the issued resources from the issued cluster, and synchronizes the work status, thus completing the cluster failover process.

[0138] A system for implementing an open, multi-cloud, multi-cluster federation according to the present invention includes:

[0139] Module M1: A new cluster joins the federated cluster;

[0140] Specifically, the module M1 adopts:

[0141] Module M1.1: Call the aggregation layer API service, pass in the cluster certificate to be joined, access entry address, and member cluster name member;

[0142] Module M1.2: The control cluster creates a service account in the member cluster and configures clusterrole and clusterrolebinding for the serviceaccount. By configuring the above SA, the control cluster is authorized to access the / readyz or / healthz URL of the member cluster member to determine the health status of the cluster.

[0143] Module M1.3: The control cluster creates a cluster object in the control cluster, saves the access entry address and access certificate, and starts the cluster status update process at 10s intervals;

[0144] Module M1.4: During the update process, access the access entry address saved in the cluster object and obtain the / readyz or healthz interface. If a 200 HTTP response is obtained, it means that the cluster is healthy, otherwise it means that the cluster is unhealthy, and the status is updated to the cluster object.

[0145] Module M2: The application is delivered through the federated cluster;

[0146] Specifically, the module M2 adopts:

[0147] Module M2.1: Submit the propagation policy PropagationPolicy, partition overload policy OverridePolicy and KubernetesObject on the control cluster side;

[0148] Module M2.2: The propagation policy PropagationPolicy and KubernetesObject resources are monitored by the controller ResourcesController. ResourcesController monitors the original KubernetesObject and PropagationPolicy resources, completes resource binding, and generates a ResourcesBinding object;

[0149] Module M2.3: After observing the ResourcesBinding object, BindingController finds the associated partition override policy OverridePolicy, implements the binding between the ResourcesBinding object and OverridePolicy, and sets ResourcesBinding to be schedulable;

[0150] Module M2.4: After SchedulerController is started, it loops to obtain all schedulable ResourcesBindings, sets the number of replicas for each cluster and region according to the dynamic load, and generates Work objects in combination with the OverridePolicy overload differentiation strategy;

[0151] Module M2.5: After the ExecutionController is started, when the Work object is created, it is responsible for synchronizing the Work object to the cluster and completing the application delivery;

[0152] The PropagationPolicy propagation strategy is a declarative resource implemented based on the Customer Resources Definitions technology. The PropagationPolicy declares the KubernetesObject and the cluster to be delivered to achieve unified delivery of applications.

[0153] The OverridePolicy partition overload strategy is a declarative resource based on Customer ResourcesDefinitions technology. The OverridePolicy declaration requires differentiated configuration. The overload strategy includes the following three methods: PlaintextOverridder, CommandOverridder, and ArgsOverride; corresponding to spec overload, named overload, and parameter overload respectively;

[0154] The ResourcesBinding binding strategy is a declarative resource based on the Customer Resources Definitions technology. ResourcesBinding is responsible for binding the PropagationPolicy with the KubernetesObject. Only after the binding relationship is established can cluster scheduling be performed.

[0155] The Work strategy is a declarative resource based on the Customer Resources Definitions technology. A Work object is used for a cluster. The Work object records the status information of the cluster and the resources that are issued. The Work object is responsible for the coordination of container resources on each cluster.

[0156] The ResourcesController service includes a general controller responsible for the kubernetes resource object coordination and processing logic, as well as matching the PropagationPolicy propagation strategy, and deriving the ResourcesBinding object corresponding to the resource object according to the propagation strategy;

[0157] The BindingController service mainly handles the logic of adding, deleting, checking and modifying ResourcesBinding resource objects, implements the binding relationship between ResourcesBinding and OverridePolicy, sets the initial state of cluster binding, etc.

[0158] The SchedulerController service is the scheduler for the entire multi-cloud management and is responsible for completing resource object scheduling. For resource objects that need to calculate the replica ratio, some clusters will be selected based on the filter and score, and then the number of replicas distributed to each cluster application will be calculated for the resource object type that needs to allocate replicas, and finally a Work object will be generated. The SchedulerController is also responsible for cluster failover scheduling;

[0159] The ExecutionController service is used to process the Work object, is responsible for creating the resources set in the Work on the corresponding cluster, and is responsible for subsequent status synchronization and fault repair work.

[0160] Specifically, the module M2.2 adopts:

[0161] Module M2.2.1: After the PropagationPolicy is submitted to the control cluster, ResourcesController extracts the name of the resource to be propagated from the PropagationPolicy information;

[0162] Module M2.2.2: Use the extracted resource name to search the waiting queue to see if the associated KubernetesObject has been submitted by the user. If not, the PropagationPolicy propagation policy is thrown into the waiting queue and waits for the next processing. If a match is found, a ResourcesBinding object is created.

[0163] Specifically, the module M2.4 adopts:

[0164] Module M2.4.1: After SchedulerController is started, it obtains the entry address and access certificate of each cluster by reading the cluster object; and starts the cluster status detection process; the status detection process accesses the / ready interface in real time, updates the status of the managed cluster and the remaining allocatable resources, and synchronously listens to ResourcesBinding object events;

[0165] Module M2.4.2: After ResourcesBinding is derived from ResourcesController, SchedulerController first obtains the name of the associated cluster through the ResourcesBinding object, and then obtains the resources that need to be propagated;

[0166] Module M2.4.3: After obtaining the cluster name, match it with the healthy cluster. After the match is successful, calculate the number of nodes that can be scheduled by the propagation cluster and the resources that can be scheduled, and then calculate the resource requirements of the propagated objects, and finally get the number of Pods that can be actually scheduled by the cluster;

[0167] Module M2.4.4: Get the number of Pods that can be scheduled and compare it with the expected number of replicas. If the number of Pods that can be scheduled is less than the expected number of replicas, dynamically adjust the number of replicas to a cluster with sufficient resources that cannot meet the scheduled number of replicas. After the adjustment is successful, modify the ResourcesBinding object, set the number of replicas for each cluster, and mark the ResourcesBinding scheduling as completed.

[0168] Module M2.4.5: After the scheduling is completed, SchedulerController obtains the associated override policy OverridePolicy, reads the content that needs to be overloaded, and then generates a Work object for each propagated cluster. The spec.data field of the Work object is filled with the content of the propagated resource.

[0169] Module M3: After the application is delivered, when a member cluster fails, the application is automatically transferred to the healthy cluster.

[0170] Specifically, the module M3 adopts:

[0171] Module M3.1: After the new cluster is added as a member cluster of the federation, SchedulerController starts the status detection process and resource calculation process;

[0172] Module M3.2: The detection process accesses the / healthy interface of the cluster, obtains all working nodes of the member cluster, including the control node and working nodes of the member cluster, and detects the nodes at intervals. The node status of the member cluster is realized by detecting the kubelet service port, and the member cluster and node status are recorded in the control cluster;

[0173] Module M3.3: When the member cluster status changes from available to unavailable, first determine the status of the nodes to which it belongs. When more than half of the nodes become unavailable, the failover process is performed;

[0174] Module M3.4: After the failover process is started, it is determined again that more than half of the nodes on the faulty cluster are unavailable, and a certain proportion of containers cannot be started due to insufficient resources. After the above conditions are met, all Work objects on the faulty cluster are obtained;

[0175] Module M3.5: Traverse the saved work objects of the faulty cluster and count the total resources of all work objects, including memory and CPU data, as an important basis for selecting clusters;

[0176] Module M3.6: Obtain all members in healthy state, use the comprehensive resources of the acquired fault cluster statistics as the screening condition, screen all clusters that meet the conditions, and obtain a preliminary matching cluster list;

[0177] Module M3.7: Score the preliminary matching cluster list, and select the cluster with the highest score based on the remaining resources, number of nodes, and node latency.

[0178] Module M3.8: After selecting the cluster with the highest score, get the cluster address, access the certificate, and get all the work objects of the cluster to be deployed;

[0179] Module M3.9: Get all work objects works1 from the faulty cluster, get the work object works2 that has been deployed in the native work cluster from the cluster with the highest score, and get the work lists of the two clusters;

[0180] Module M3.10: Compare the two work objects, loop through works2 and compare works1 in turn, find the work object with the same name, and modify the work object with the same name when it is found. At the same time, modify the cluster field in the work object, fill in the address of the new cluster and the access token, and change the delivery status to not delivered.

[0181] Module M3.11: After the ExecutionController detects a new work object that has not been issued, it takes out the cluster address and token of the cluster to be issued in the work, creates resources in sequence after the resources are issued, and starts the update thread;

[0182] Module M3.12: The update thread synchronizes the status of each work object in turn through the work object, collects the status of the issued resources from the issued cluster, and synchronizes the work status, thus completing the cluster failover process.

[0183] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing the method and structures within the hardware component.

[0184] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A method for implementing open, multi-cloud, multi-cluster federation, characterized in that: include: Step S1: The new cluster joins the federated cluster; Step S2: The application is delivered through the federated cluster; Step S3: After the application is issued, when a member cluster fails, the application automatically transfers to the healthy cluster; The step S1 adopts: Step S1.1: Call the aggregation layer API service, pass in the cluster certificate to be joined, the access entry address, and the member cluster name member; Step S1.2: The control cluster creates a service account in the member cluster and configures clusterrole and clusterrolebinding for the service account. By configuring the above service account, the control cluster is authorized to access the / readyz or / healthz URL of the member cluster member, so as to determine the health status of the cluster; Step S1.3: The control cluster creates a cluster object in the control cluster, saves the access entry address and access certificate, and starts the cluster status update process at a preset time interval; Step S1.4: In the update process, access the access entry address saved in the cluster object, obtain the / readyz or healthz interface, and if a 200 HTTP response is obtained, it means that the cluster is healthy, otherwise it means that the cluster is unhealthy, and the status is updated to the cluster object; The step S2 adopts: Step S2.1: Submit the propagation policy PropagationPolicy, partition overload policy OverridePolicy and KubernetesObject on the control cluster side; Step S2.2: The propagation policy PropagationPolicy and KubernetesObject resources are monitored by the controller ResourcesController. ResourcesController monitors the original KubernetesObject and PropagationPolicy resources, completes resource binding, and generates a ResourcesBinding object. Step S2.3: After observing the ResourcesBinding object, BindingController finds the associated partition override policy OverridePolicy, implements the binding between the ResourcesBinding object and OverridePolicy, and sets ResourcesBinding to be schedulable; Step S2.4: After SchedulerController is started, it loops to obtain all schedulable ResourcesBindings, sets the number of replicas for each cluster and region according to the dynamic load, and generates Work objects in combination with the OverridePolicy overload differentiation strategy; Step S2.5: After the ExecutionController is started, when the Work object is created, it is responsible for synchronizing the Work object to the cluster and completing the application delivery; The step S3 adopts: Step S3.1: After the new cluster is added as a member cluster of the federation, SchedulerController starts the status detection process and resource calculation process; Step S3.2: The detection process accesses the / healthy interface of the cluster, obtains all working nodes of the member cluster, including the control node and working nodes of the member cluster, and detects the nodes at intervals. The node status of the member cluster is realized by detecting the kubelet service port, and the member cluster and node status are recorded in the control cluster; Step S3.3: When the member cluster status changes from available to unavailable, first determine the status of the nodes to which it belongs. When more than half of the nodes become unavailable, the failover process begins; Step S3.4: After the failover process is started, it is determined again that more than half of the nodes on the faulty cluster are unavailable, and a certain proportion of containers cannot be started due to insufficient resources, and all Work objects on the faulty cluster are obtained; Step S3.5: traverse the saved work objects of the faulty cluster and count the total resources of all work objects, including memory and CPU data, as an important basis for selecting clusters; Step S3.6: Obtain all members in healthy state, use the comprehensive resources of the acquired fault cluster statistics as the screening condition, screen all clusters that meet the condition, and obtain a preliminary matching cluster list; Step S3.7: Score the preliminary matched cluster list, and select the cluster with the highest score based on the comprehensive scores of remaining resources, number of nodes, and node latency; Step S3.8: After selecting the cluster with the highest score, get the cluster address, access the certificate, and get all the work objects of the cluster to be deployed; Step S3.9: Get all work objects works1 from the faulty cluster, get the work object works2 that has been deployed in the native work cluster from the cluster with the highest score, and get the work lists of the two clusters; Step S3.10: Compare the two work objects, loop through works2 and compare works1 in turn, find the work object with the same name, and modify the work object with the same name when it is found. At the same time, modify the cluster field in the work object, fill in the address of the new cluster and the access token, and change the delivery status to not delivered. Step S3.11: After the ExecutionController detects a new work object that has not been issued, it takes out the cluster address and token to be issued in the work, creates resources in sequence after the resources are issued, and starts the update thread; Step S3.12: The update thread synchronizes the status of each work object in turn through the work object, collects the status of the issued resources from the issued cluster, and synchronizes the work status, thus completing the cluster failover process.

2. The method for implementing open, multi-cloud, multi-cluster federation according to claim 1, characterized in that: The step S2.2 adopts: Step S2.2.1: After the PropagationPolicy is submitted to the control cluster, ResourcesController extracts the name of the resource to be propagated from the PropagationPolicy information; Step S2.2.2: Use the extracted resource name to check whether the associated KubernetesObject has been submitted by the user in the waiting queue. If not, the PropagationPolicy propagation policy is thrown into the waiting queue and waits for the next processing. If a match is found, a ResourcesBinding object is created.

3. The method for implementing open, multi-cloud, multi-cluster federation according to claim 1, characterized in that: The step S2.4 adopts: Step S2.4.1: After SchedulerController is started, it obtains the entry address and access certificate of each cluster by reading the cluster object; and starts the cluster status detection process; the status detection process accesses the / ready interface in real time, updates the status of the managed cluster and the remaining allocatable resources, and synchronously listens to the ResourcesBinding object event; Step S2.4.2: After ResourcesBinding is derived by ResourcesController, SchedulerController first obtains the name of the associated cluster through the ResourcesBinding object, and then obtains the resources that need to be propagated; Step S2.4.3: After obtaining the cluster name, match it with the healthy cluster. After the match is successful, calculate the number of nodes that can be scheduled by the propagation cluster and the resources that can be scheduled, and then calculate the resource requirements of the propagated objects, and finally get the number of Pods that can be actually scheduled by the cluster; Step S2.4.4: Get the number of Pods that can be scheduled and compare it with the expected number of replicas. If the number of Pods that can be scheduled is less than the expected number of replicas, dynamically adjust the number of replicas to a cluster with sufficient resources that cannot meet the scheduling requirements. After the adjustment is successful, modify the ResourcesBinding object, set the number of replicas for each cluster, and mark the ResourcesBinding scheduling as completed. Step S2.4.5: After the scheduling is completed, SchedulerController obtains the associated overload policy OverridePolicy, reads the content that needs to be overloaded, and then generates a Work object for each propagated cluster. The spec.data field of the Work object is filled with the content of the propagated resource.

4. An open, multi-cloud, multi-cluster federated implementation system, characterized in that: include: Module M1: A new cluster joins the federated cluster; Module M2: The application is delivered through the federated cluster; Module M3: After the application is delivered, when a member cluster fails, the application automatically transfers to the healthy cluster; The module M1 adopts: Module M1.1: Call the aggregation layer API service, pass in the cluster certificate to be joined, access entry address, and member cluster name member; Module M1.2: The control cluster creates a service account in the member cluster and configures clusterrole and clusterrolebinding for the service account. By configuring the above service account, the control cluster is authorized to access the / readyz or / healthz URL of the member cluster member, so as to determine the health status of the cluster; Module M1.3: Control cluster creates a cluster object in the control cluster, saves the access entry address and access certificate, and starts the cluster status update process at a preset time interval; Module M1.4: During the update process, access the access entry address saved in the cluster object and obtain the / readyz or healthz interface. If a 200 HTTP response is obtained, it means that the cluster is healthy, otherwise it means that the cluster is unhealthy, and the status is updated to the cluster object. The module M2 adopts: Module M2.1: Submit the propagation policy PropagationPolicy, partition overload policy OverridePolicy and KubernetesObject on the control cluster side; Module M2.2: The propagation policy PropagationPolicy and KubernetesObject resources are monitored by the controller ResourcesController. ResourcesController monitors the original KubernetesObject and PropagationPolicy resources, completes resource binding, and generates a ResourcesBinding object; Module M2.3: After observing the ResourcesBinding object, BindingController finds the associated partition override policy OverridePolicy, implements the binding between the ResourcesBinding object and OverridePolicy, and sets ResourcesBinding to be schedulable; Module M2.4: After SchedulerController is started, it loops to obtain all schedulable ResourcesBindings, sets the number of replicas for each cluster and region according to the dynamic load, and generates Work objects in combination with the OverridePolicy overload differentiation strategy; Module M2.5: After the ExecutionController is started, when the Work object is created, it is responsible for synchronizing the Work object to the cluster and completing the application delivery; The module M3 adopts: Module M3.1: After the new cluster is added as a member cluster of the federation, SchedulerController starts the status detection process and resource calculation process; Module M3.2: The detection process accesses the / healthy interface of the cluster, obtains all working nodes of the member cluster, including the control node and working nodes of the member cluster, and detects the nodes at intervals. The node status of the member cluster is realized by detecting the kubelet service port, and the member cluster and node status are recorded in the control cluster; Module M3.3: When the member cluster status changes from available to unavailable, first determine the status of the nodes to which it belongs. When more than half of the nodes become unavailable, the failover process is performed; Module M3.4: After the failover process is started, it is determined again that more than half of the nodes on the faulty cluster are unavailable, and a certain percentage of containers cannot be started due to insufficient resources, and all Work objects on the faulty cluster are obtained; Module M3.5: Traverse the saved work objects of the faulty cluster and count the total resources of all work objects, including memory and CPU data, as an important basis for selecting clusters; Module M3.6: Obtain all members in healthy state, use the comprehensive resources of the acquired fault cluster statistics as the screening condition, screen all clusters that meet the conditions, and obtain a preliminary matching cluster list; Module M3.7: Score the preliminary matching cluster list, and select the cluster with the highest score based on the remaining resources, number of nodes, and node latency. Module M3.8: After selecting the cluster with the highest score, get the cluster address, access the certificate, and get all the work objects of the cluster to be deployed; Module M3.9: Get all work objects works1 from the faulty cluster, get the work object works2 that has been deployed in the native work cluster from the cluster with the highest score, and get the work lists of the two clusters; Module M3.10: Compare the two work objects, loop through works2 and compare works1 in turn, find the work object with the same name, and modify the work object with the same name when it is found. At the same time, modify the cluster field in the work object, fill in the address of the new cluster and the access token, and change the delivery status to not delivered. Module M3.11: After the ExecutionController detects a new work object that has not been issued, it takes out the cluster address and token to be issued in the work, creates resources in sequence after the resources are issued, and starts the update thread; Module M3.12: The update thread synchronizes the status of each work object in turn through the work object, collects the status of the issued resources from the issued cluster, and synchronizes the work status, thus completing the cluster failover process.

5. The system for implementing an open, multi-cloud, multi-cluster federation according to claim 4, characterized in that: The module M2.2 adopts: Module M2.2.1: After the PropagationPolicy is submitted to the control cluster, ResourcesController extracts the name of the resource to be propagated from the PropagationPolicy information; Module M2.2.2: Use the extracted resource name to search the waiting queue to see if the associated KubernetesObject has been submitted by the user. If not, the PropagationPolicy propagation policy is thrown into the waiting queue and waits for the next processing. If a match is found, a ResourcesBinding object is created. The module M2.4 adopts: Module M2.4.1: After SchedulerController is started, it obtains the entry address and access certificate of each cluster by reading the cluster object; and starts the cluster status detection process; the status detection process accesses the / ready interface in real time, updates the status of the managed cluster and the remaining allocatable resources, and synchronously listens to ResourcesBinding object events; Module M2.4.2: After ResourcesBinding is derived from ResourcesController, SchedulerController first obtains the name of the associated cluster through the ResourcesBinding object, and then obtains the resources that need to be propagated; Module M2.4.3: After obtaining the cluster name, match it with the healthy cluster. After the match is successful, calculate the number of nodes that can be scheduled by the propagation cluster and the resources that can be scheduled, and then calculate the resource requirements of the propagated objects, and finally get the number of Pods that can be actually scheduled by the cluster; Module M2.4.4: Get the number of Pods that can be scheduled and compare it with the expected number of replicas. If the number of Pods that can be scheduled is less than the expected number of replicas, dynamically adjust the number of replicas to a cluster with sufficient resources that cannot meet the scheduled number of replicas. After the adjustment is successful, modify the ResourcesBinding object, set the number of replicas for each cluster, and mark the ResourcesBinding scheduling as completed. Module M2.4.5: After the scheduling is completed, SchedulerController obtains the associated override policy OverridePolicy, reads the content that needs to be overloaded, and then generates a Work object for each propagated cluster. The spec.data field of the Work object is filled with the content of the propagated resource.