Cluster resource management method and device, electronic equipment and storage medium

By obtaining and utilizing the namespace mapping relationship between the main cluster and the member cluster, the need for tenants to use different namespace management in multiple clusters is solved, and flexible resource issuance and takeover are achieved, improving the convenience and user experience of cluster management.

CN119902855APending Publication Date: 2025-04-29TRANSWARP TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411988572.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

The prior art cannot meet the need for tenants to use different namespaces for management in multiple clusters, especially when multi-tenant distributed cloud platform manages multiple member clusters.

Method used

By obtaining the namespace mapping relationship between the main cluster and the member cluster, determining the resource and resource issuance strategy to be issued, determining the scheduling unit resources and the cluster list to be issued based on this information, determining the target namespace according to the namespace mapping relationship and cluster list, and deploying the resource configuration information to the target namespace.

Benefits of technology

It realizes that in the scenario of resource issuance and takeover, the mapping namespace can be flexibly selected according to tenant planning, improve the convenience of cluster management, and improve the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119902855A_ABST
    Figure CN119902855A_ABST
Patent Text Reader

Abstract

The invention discloses a cluster resource management method and device, electronic equipment and a storage medium, and relates to the technical field of cluster management. The cluster resource management method comprises the following steps: acquiring a namespace mapping relationship between a main cluster and a member cluster, and determining a to-be-issued resource and a resource issuing strategy; determining scheduling unit resources and a to-be-issued cluster list according to the to-be-issued resources and the resource issuing strategy, and determining to-be-issued resource configuration information according to the scheduling unit resources; determining a target namespace of the to-be-issued cluster according to the namespace mapping relation and the to-be-issued cluster list; and issuing the to-be-issued resource configuration information according to the to-be-issued cluster list, and deploying the to-be-issued resource configuration information according to the target namespace. According to the embodiment of the invention, the mapped namespace can be flexibly selected according to the planning of the tenant in a resource issuing and takeover scene, the convenience of cluster management is improved, and the use experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cluster management, and in particular to a cluster resource management method, device, electronic device and storage medium. Background Art

[0002] The namespace in the container orchestration system (Kubernetes, K8s) is a logical isolation mechanism used to divide cluster resources into different areas, so that the same Kubernetes cluster can manage multiple isolated environments. Each namespace can contain multiple objects, such as container groups (Pod), services (Service), and configuration maps (ConfigMap), etc. These objects can be associated with each other and centrally managed, but resources in different namespaces are isolated by default.

[0003] When a multi-tenant distributed cloud platform manages multiple member clusters, each tenant creates a namespace in each member cluster that is identical to the main cluster. When the main cluster distributes the tenant's resources, it distributes them to the same namespace. However, in the scenario of managing multiple existing clusters, the namespace of each cluster is usually created independently and cannot be changed, so it cannot meet the tenant's needs to use different namespaces for management in multiple clusters. Therefore, how to manage multi-tenant resources with heterogeneous multi-cluster namespaces so that the distributed cloud platform can take over the resources of the member clusters to different namespaces of the main cluster during the resource distribution process has become a problem that needs to be solved urgently. Summary of the invention

[0004] The present invention provides a cluster resource management method, device, electronic device and storage medium to solve the problem in the prior art that the requirement of tenants to use different namespaces for management in multiple clusters cannot be met.

[0005] According to one aspect of the present invention, a cluster resource management method is provided, wherein the method comprises:

[0006] Obtain the namespace mapping relationship between the main cluster and the member cluster, and determine the resources to be delivered and the resource delivery strategy;

[0007] Determine the scheduling unit resources and the list of clusters to be issued according to the resources to be issued and the resource issuance strategy, and determine the resource configuration information to be issued according to the scheduling unit resources;

[0008] Determine the target namespace of the cluster to be delivered according to the namespace mapping relationship and the list of clusters to be delivered;

[0009] The resource configuration information to be issued is issued according to the to-be-issued cluster list, and the resource configuration information to be issued is deployed according to the target namespace.

[0010] According to another aspect of the present invention, a cluster resource management device is provided, wherein the device comprises:

[0011] The resource determination module is used to obtain the namespace mapping relationship between the main cluster and the member cluster, determine the resources to be issued and the resource issuance strategy;

[0012] A resource configuration module, configured to determine the scheduling unit resources and the list of clusters to be issued according to the resources to be issued and the resource issuance strategy, and determine the resource configuration information to be issued according to the scheduling unit resources;

[0013] A space determination module, configured to determine a target namespace of the cluster to be delivered according to the namespace mapping relationship and the list of clusters to be delivered;

[0014] The resource deployment module is used to issue the resource configuration information to be issued according to the cluster list to be issued, and deploy the resource configuration information to be issued according to the target namespace.

[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the cluster resource management method described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the cluster resource management method of any embodiment of the present invention when executed.

[0020] The technical solution of the embodiment of the present invention obtains the namespace mapping relationship between the main cluster and the member cluster, determines the resources to be sent and the resource sending strategy, determines the scheduling unit resources and the list of clusters to be sent according to the resources to be sent and the resource sending strategy, determines the resource configuration information to be sent according to the scheduling unit resources, determines the target namespace of the cluster to be sent according to the namespace mapping relationship and the list of clusters to be sent, sends the resource configuration information to be sent according to the list of clusters to be sent, and deploys the resource configuration information to be sent according to the target namespace, so that in the resource sending and takeover scenarios, the mapped namespace can be flexibly selected according to the tenant planning, thereby improving the convenience of cluster management and enhancing the user experience.

[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0023] Figure 1 is a flow chart of a cluster resource management method provided according to Embodiment 1 of the present invention;

[0024] Figure 2 is a flow chart of a cluster resource management method provided according to Embodiment 2 of the present invention;

[0025] Figure 3 is an architecture diagram of a cluster resource management system provided according to Embodiment 3 of the present invention;

[0026] Figure 4 is a structural diagram of a cluster resource management device provided according to Embodiment 4 of the present invention;

[0027] Figure 5 It is a structural schematic diagram of an electronic device for implementing a cluster resource management method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Embodiment 1

[0031] Figure 1 This is a flow chart of a cluster resource management method provided according to the first embodiment of the present invention. This embodiment is applicable to the management of multi-tenant resources in heterogeneous Kubernetes multi-cluster namespaces. The method can be executed by a cluster resource management device, which can be implemented in the form of hardware and / or software. The cluster resource management device can be configured in a main cluster, which can be located in an electronic device. Figure 1 As shown, the method includes:

[0032] S110: Obtain the namespace mapping relationship between the main cluster and the member cluster, and determine the resources to be delivered and the resource delivery strategy.

[0033] Among them, Kubernetes is used to automatically deploy, expand and manage containerized applications, which can help developers and system administrators deploy applications more easily, expand services, and manage containers across host clusters. The main cluster can be understood as the core control point of the multi-cluster management architecture, which is responsible for unified management and coordination of all member clusters. The member cluster can be understood as the working cluster that actually runs the application, which can receive the management and scheduling of the main cluster and is responsible for the deployment, operation and management of containerized applications. Generally speaking, member clusters can perform tasks independently. The namespace mapping relationship can be understood as the association relationship between the namespace in the main cluster and the namespace in the member cluster. Multiple namespaces can be included in the main cluster and the member cluster respectively. Generally, the namespace in the member cluster can be defined and set according to the namespace in the main cluster, but there is a situation where the resource names associated with the main cluster and the member cluster are consistent, but the namespaces are inconsistent. The namespace mapping relationship can be set in advance according to the cluster deployment situation. The resources to be issued can be understood as the resources that need to be deployed in the member cluster. For example, the resources to be issued can include but are not limited to the image of the Pod, the number of containers, resource requests (CPU, memory, etc.), environment variables, etc. The resource delivery strategy can be understood as a strategy for delivering resources to member clusters. Generally speaking, the resource delivery strategy can include a global strategy and a differentiated strategy. The global strategy can specify the allocation ratio of the entire cluster resources among different types of tenants or applications, as well as the priority of different applications or tenants; the differentiated strategy can be special rules defined for different tenants, such as the tenant's network access rights.

[0034] In an embodiment, the pre-set namespace mapping relationship between the main cluster and the member cluster can be extracted, the resources to be issued created by the tenant are obtained as the resources to be issued, and the resource issuance policy of the tenant is determined. In the actual operation process, the resource issuance policy for each tenant can be pre-set; or the resource issuance policy can be created while constructing the resources to be issued.

[0035] S120: Determine the scheduling unit resources and the list of clusters to be issued according to the resources to be issued and the resource issuance policy, and determine the resource configuration information to be issued according to the scheduling unit resources.

[0036] Among them, the scheduling unit resources can be understood as a set of resources allocated to the scheduling unit to meet the execution requirements of specific tasks or workloads during the resource scheduling process. In Kubernetes, container groups (Plain OldDocker, Pod) can be used as scheduling unit resources. The list of clusters to be sent can be understood as a list of member clusters that need to be deployed, and the list of member clusters can be determined based on the resources to be sent. The resource configuration information to be sent can be understood as the resource configuration information that needs to be sent, which is the specific setting of the resources to be deployed to the target cluster. Exemplarily, the resource configuration information to be sent can include inventory resources.

[0037] In an embodiment, the scheduling unit resources can be determined according to the resources to be issued and the resource issuance policy, and the list of clusters to be issued can be determined according to the resources to be issued, and the resource configuration information to be issued can be determined through the scheduling unit resources. In the actual operation process, when the issuance policy is monitored, the scheduling unit resources corresponding to the resources to be issued can be generated, and the resources to be issued and the list of clusters to be issued can be configured in the resource field of the scheduling unit resources. When the change of the scheduling unit resources is detected, the list resources corresponding to the scheduling unit resources can be updated accordingly as the resource configuration information to be issued.

[0038] S130: Determine the target namespace of the cluster to be delivered according to the namespace mapping relationship and the list of clusters to be delivered.

[0039] The target namespace can be understood as the namespace in which resources to be delivered in the member cluster need to be deployed.

[0040] In an embodiment, the namespace of each cluster to be sent in the list of clusters to be sent can be searched in the namespace mapping relationship, and the namespace of the cluster to be sent can be used as the target namespace. In the actual operation process, the namespace name of the main cluster can exist in the resources to be sent, and the target namespace corresponding to the cluster to be sent can be searched in the namespace mapping relationship according to the namespace name of the main cluster.

[0041] S140: The resource configuration information to be issued is issued according to the cluster list to be issued, and the resource configuration information to be issued is deployed according to the target namespace.

[0042] In an embodiment, the resource configuration information can be sent to the cluster to be sent according to the list of clusters to be sent, and the resource configuration information can be sent or updated to the target namespace of the corresponding member cluster. In the actual operation process, when the resource configuration information to be sent is a list resource, the list resource can be created or updated to the application programming interface server (Application Programming Interface Server, apiserver) of the cluster to be sent in the list of clusters to be sent, and the resource configuration information to be sent can be deployed in the target namespace through the application programming interface server.

[0043] In an embodiment of the present invention, by obtaining the namespace mapping relationship between the main cluster and the member cluster, the resources to be sent and the resource sending strategy are determined, the scheduling unit resources and the list of clusters to be sent are determined according to the resources to be sent and the resource sending strategy, the resource configuration information to be sent is determined according to the scheduling unit resources, the target namespace of the cluster to be sent is determined according to the namespace mapping relationship and the list of clusters to be sent, the resource configuration information to be sent is sent according to the list of clusters to be sent, and the resource configuration information to be sent is deployed according to the target namespace, so that in the resource sending and takeover scenarios, the mapped namespace can be flexibly selected according to the tenant planning, the convenience of cluster management is improved, and the user experience is enhanced.

[0044] In one embodiment, before obtaining the namespace mapping relationship between the main cluster and the member cluster and determining the resources to be delivered and the resource delivery strategy, the method further includes:

[0045] Determine the namespaces in the primary cluster and the member clusters that are associated with the tenant, and create a mapping relationship between the namespaces that are associated as the namespace mapping relationship associated with the primary cluster;

[0046] Use the name of the namespace mapping relationship associated with the primary cluster as the tenant's label and create a resource delivery policy for the tenant.

[0047] A tenant can be understood as an independent user group or organization that uses shared resources. For each tenant, a corresponding namespace can exist in the main cluster and the member cluster.

[0048] In an embodiment, before obtaining the namespace mapping relationship between the main cluster and the member clusters, determining the resources to be distributed and the resource distribution strategy, for each tenant, the namespace corresponding to the tenant in the main cluster and the member cluster can be determined, the namespace with which the main cluster and the member cluster have an associated relationship can be determined, and the mapping relationship of the namespace with an associated relationship can be determined as the namespace mapping relationship. The name of the namespace mapping relationship associated with the main cluster is determined, and the name is used as a label for the tenant to facilitate the tenant to find the corresponding namespace mapping relationship and create a resource distribution strategy for each tenant. In one embodiment, if the user wants to distribute the resources in the namespace of tenant A to cluster A and namespace A and namespace B of cluster B, these two mapping relationships need to be configured in the namespace mapping relationship.

[0049] In one embodiment, after the resource configuration information to be sent is sent according to the to-be-sent cluster list and the resource configuration information to be sent is deployed according to the target namespace, the method further includes:

[0050] Monitor the status changes of the resources to be delivered in the member cluster. When it is determined that there is a status change, determine the list resource corresponding to the resource to be delivered through the preset tag of the resource to be delivered, and update the status change to the list resource;

[0051] When it is determined that the existence state of the inventory resource has changed, the scheduling unit resource corresponding to the inventory resource is determined by the preset tag associated with the inventory resource, and the state of the scheduling unit resource is updated according to the state change of the inventory resource;

[0052] Determine the resource field of the scheduling unit resource, and update the status of the scheduling unit resource to the resource field.

[0053] In an embodiment, the state change of the resource to be sent can be determined by the list state controller. If the resource to be sent has a state change, the list resource corresponding to the resource to be sent can be determined by the preset tag of the resource to be sent, and the state change of the list resource can be updated. The scheduling unit state monitor can monitor the state change of the list resource. When the state of the list resource changes, the scheduling unit resource corresponding to the list resource can be determined by the preset tag associated with the list resource, the state of the scheduling unit resource can be updated, and the resource field of the scheduling unit resource can be extracted, and the state of the scheduling unit resource can be updated to the resource field to realize the collection of resource state.

[0054] In one embodiment, before obtaining the namespace mapping relationship between the main cluster and the member cluster and determining the resources to be delivered and the resource delivery strategy, the method further includes:

[0055] Create tenant access permissions for the primary cluster and member clusters, and configure resource limits for the tenant.

[0056] The resource restriction can be understood as the resource restriction condition of the tenant.

[0057] In an embodiment, access rights in the main cluster and member clusters can be created for each tenant, and resource restrictions for the tenant can be set. In the actual operation process, the user needs to configure the namespace information associated with the tenant. The user controller will automatically generate relevant cluster roles and role bindings in the main cluster and member clusters to limit the user's access rights in the main cluster and member clusters. In the cluster role, the user can be configured to only access resources under the specified namespace (based on the configuration of the namespace mapping relationship between the main cluster and the member cluster). And the corresponding private data, the private data saves the corresponding Kubernetes file (kubeconfig information) used to manage cluster configuration information. Users access the resources of the cluster and member cluster through kubeconfig to limit user permissions. Usually the federated API server (federatedapiserver) uses the administrator (admin) high-privilege user for access. When the user accesses the member cluster, the user of the access request will be replaced with the corresponding ordinary user through the simulation mechanism (imporsonate mechanism).

[0058] In one embodiment, a user can define a total resource limit for a tenant and divide resource usage into clusters by percentage. When the resource change is monitored, the corresponding resource quota can be generated based on the configuration of the namespace mapping relationship between the main cluster and the member cluster and the percentage of each cluster, and the resource quota can be deployed to the member cluster. Limit the resource usage of the member cluster namespace, and obtain the usage of each cluster and write it back to the main cluster. This is used to manage the resource allocation status across multiple clusters in the Kubernetes Federation scenario.

[0059] In one embodiment, the present invention can also make a cluster exit the management of a tenant in a simple manner. Just delete the mapping of the member cluster in the namespace mapping relationship corresponding to the tenant. Since it is found that the cluster cannot be found in the corresponding namespace mapping relationship during the resource distribution and deletion of the member cluster's resources, the operation of updating the inventory resources and deleting the member cluster resources will no longer be performed, and the management of the resources will be stopped. It supports the rapid release of the cascade deletion relationship between resources, avoids unexpected deletion of important resources, and improves the stability of the system.

[0060] Embodiment 2

[0061] Figure 21 is a flow chart of a cluster resource management method provided according to Embodiment 2 of the present invention. This embodiment is further optimized and expanded based on the above embodiment and can be combined with various optional technical solutions in the above embodiment. Figure 2 As shown, the method includes:

[0062] S210: extract the namespace mapping relationship between the main cluster and the member cluster associated with the tenant, and obtain the preset resource delivery policy of the tenant; wherein the resource delivery policy includes at least a global policy and a differentiated policy.

[0063] Among them, the global policy can specify the allocation ratio of the entire cluster resources among different types of tenants or applications, as well as the priority of different applications or tenants; the differentiated policy can be special rules defined for different tenants, such as tenants' network access rights.

[0064] In an embodiment, the namespace mapping relationship between the main cluster and the member cluster associated with the tenant may be extracted through the tenant information to determine a preset resource delivery strategy.

[0065] S220. Determine resources to be sent; wherein the resources to be sent include at least one of the following: computing resources, storage resources, and network resources.

[0066] In an embodiment, computing resources, storage resources, and network resources that need to be deployed in a member cluster may be determined, and the computing resources, storage resources, and network resources may be used as resources to be delivered.

[0067] S230: When it is determined that there are changes in the resources to be delivered and / or the global policy in the resource delivery policy, the scheduling unit resources are determined according to the global policy and the resources to be delivered.

[0068] Among them, the resource field of the scheduling unit resource is configured with resources to be issued.

[0069] In an embodiment, it can be determined whether there are changes in the resources to be sent and the resource sending policy. When it is determined that there are changes in the resources to be sent or the global policy in the resource sending policy, the scheduling unit resources can be configured according to the global policy and the resources to be sent. In the actual operation process, the global policy can be parsed to determine the resource quota, priority rules and other information defined in the global policy. The updated information in the resources to be sent is extracted to determine the required scheduling unit resource type, such as pod, and the resource request of the resources to be sent is matched with the resource quota in the global policy. According to the priority rules in the global policy, the resources to be sent are sorted, and the final scheduling unit resources are generated according to the global policy and the resources to be sent.

[0070] S240: Determine the to-be-delivered clusters of the to-be-delivered resources, and organize the to-be-delivered clusters into a to-be-delivered cluster list.

[0071] In an embodiment, the to-be-delivered clusters in which the to-be-delivered resources need to be deployed may be determined, and the to-be-delivered clusters may be grouped into a to-be-delivered cluster list.

[0072] S250: When it is determined that the scheduling unit resources and / or the differentiation strategy in the resource delivery strategy have changed, determine change information of the scheduling unit resources and / or the differentiation strategy having changed.

[0073] In an embodiment, when it is determined that the scheduling unit resources and / or the differentiation strategy in the resource delivery strategy have changed, the change information of the scheduling unit resources and the differentiation strategy can be extracted. Exemplarily, the change information can include but is not limited to storage resource changes, network resource changes, etc.

[0074] S260: Update the list resources according to the change information as resource configuration information to be sent.

[0075] Among them, the scheduling unit resources and inventory resources are associated through tags. Inventory resources refer to the collection of files that define and describe various resources in the system.

[0076] In an embodiment, resources may be updated according to the change information, and the updated list resources may be used as resource configuration information to be sent.

[0077] S270: Search the namespace of each cluster to be delivered in the list of clusters to be delivered in the namespace mapping relationship, and use the namespace of the cluster to be delivered as the target namespace.

[0078] In an embodiment, the namespace of each cluster to be sent in the list of clusters to be sent can be confirmed in the namespace mapping relationship, and the namespace of the cluster to be sent can be used as the target namespace. In the actual operation process, the target namespace can be updated to the manifest resource. For example, if the namespace of the tenant on cluster A is namespace A, the namespace of the sent resource needs to be changed to namespace A and saved in the corresponding manifest resource (Manifest) field.

[0079] S280: The resource configuration information to be issued is issued according to the cluster list to be issued, and the resource configuration information to be issued is deployed according to the target namespace.

[0080] In an embodiment of the present invention, by extracting the namespace mapping relationship between the main cluster and the member cluster associated with the tenant and obtaining the resource delivery policy of the tenant that is preset, the resources to be delivered are determined. When it is determined that the resources to be delivered and / or the global policy in the resource delivery policy have changed, the scheduling unit resources are determined according to the global policy and the resources to be delivered, the clusters to be delivered of the resources to be delivered are determined, and the clusters to be delivered are formed into a list of clusters to be delivered. When it is determined that the scheduling unit resources and / or the differentiated policy in the resource delivery policy have changed, the change information of the changes in the scheduling unit resources and / or the differentiated policy is determined, the list resources are updated according to the change information as the configuration information of the resources to be delivered, the namespace of each cluster to be delivered in the list of clusters to be delivered is searched in the namespace mapping relationship, and the namespace of the cluster to be delivered is used as the target namespace, so as to achieve accurate update of the namespace and facilitate flexible deployment of resources in the namespace of the member cluster.

[0081] Embodiment 3

[0082] Figure 3 is an architecture diagram of a cluster resource management system provided according to Embodiment 3 of the present invention, such as Figure 3 As shown in the figure, the cluster resource management system is divided into three parts: user management, namespace management, and workload management.

[0083] The namespace mapping relationship defines the mapping relationship between the namespace of the primary cluster and the namespace of the member cluster.

[0084] The global policy defines the resource delivery strategy, scheduling strategy, and whether the existing resources need to be overwritten and whether the delivery needs to be paused.

[0085] Prioritized Rewrite Policy: For a specified resource, the fields and related configurations that are differentially configured on a specified member cluster.

[0086] The Schedule Unit defines the information required for scheduling as the input of the scheduler, and the scheduler will write the scheduling results back to the Schedule Unit after the scheduling is completed.

[0087] The manifest saves the final resource definition to be sent to the member cluster and the resource status in the member cluster.

[0088] Namespace Mapping Controller: Responsible for labeling the namespace of the main cluster with the name of the namespace mapping relationship, and creating a global policy that supports automatically delivering certain types of resources to a specified cluster and a specified namespace.

[0089] The Schedule Unit Generator Controller is used to generate Schedule Unit resources. The controller monitors all the resources and global policies that can be issued on the main cluster, generates Schedule Unit resources based on these two pieces of information, and labels the two resources accordingly.

[0090] The Manifests Generator Controller is responsible for generating manifest resources, monitoring schedule unit resources, and generating the final definition of the member cluster to be sent based on the scheduling results and the configured rewrite strategy.

[0091] Delivery Controller: Sends the manifest to the member cluster and keeps it consistent with the resources in the main cluster. If there is any inconsistency, update the resources on the member cluster immediately.

[0092] Manifest Status Controller: collects and sends resource status from member clusters.

[0093] The Schedule Unit Status Controller aggregates the status of multiple manifests into the status of a Schedule Unit and writes it to the resources of the corresponding main cluster, such as the Deployment resource.

[0094] The federated API server is responsible for forwarding the access proxy of the main cluster to the member cluster resources to the corresponding member cluster, and returning the request to the main cluster after aggregation.

[0095] Among them, users (tenants) can create resources, global policies, differentiated policies and namespace mapping relationships. The resource delivery process can be that the user generates a scheduling unit through the scheduling unit generator, the namespace mapping controller generates a namespace mapping relationship, the scheduling unit determines the list based on the list generator and the namespace and mapping relationship, and sends the resources to namespace A of cluster A and namespace B of cluster B. The resource status update process can be that the list state controller determines the list state, based on the list state, the scheduling unit controller determines the scheduling unit state, and the resource state is determined based on the scheduling unit state.

[0096] Namespace management: supports the establishment of namespace mapping between the main cluster and the member cluster by creating a namespace mapping relationship. When issuing resources, the tenant must first create a namespace mapping relationship, and configure the namespace on the main cluster and the namespace on the member cluster corresponding to the tenant in the namespace mapping relationship. For example, if the user wants to issue the resources in the namespace of tenant A to cluster A and namespace A and namespace B of cluster B, it is necessary to configure these two mapping relationships in the namespace mapping relationship. After the controller monitors the creation of the namespace mapping relationship, it will indicate the name of the namespace mapping relationship associated with the namespace in the label of tenant A. And create the corresponding issuance policy for the namespace, support automatic issuance of a specified type of resources to the member cluster, avoiding the user from creating the issuance policy. When a mapping relationship is deleted from the namespace mapping, it means that the namespace and all resources under it are out of the control of the tenant.

[0097] In one embodiment, workload management supports the collection of resources and resource status, as well as the query and management of member cluster resources.

[0098] The resource delivery process is as follows: in the namespace associated with the namespace mapping relationship (Namespace Mapping) created by the tenant, the tenant creates the resources to be delivered, the global policy (global policy), and the differentiated policy (rewrite policy) resources.

[0099] The Schedule Unit Controller monitors changes in resources and global policies, and generates corresponding Schedule Unit resources based on the global policies. The resource field in the Schedule Unit resource configures the resource to be delivered, which only specifies one resource and the list of clusters to be delivered.

[0100] The Manifest Generator Controller monitors changes in the Schedule Unit and the differentiation strategy. If these two resources change, the corresponding Manifest resource will be updated. The differentiation strategy configures the configuration that needs to be changed for a certain field of the resource on the specified cluster. The Manifest Generator Controller obtains the resources to be issued from the API server of the main cluster, and generates the resource configuration to be issued based on the list of clusters to be issued and the differentiation strategy, and changes the namespace of the resource to be issued according to the configuration in the namespace mapping. For example, if the tenant's namespace on cluster A is namespace A, the namespace of the issued resource needs to be changed to namespace A and saved in the corresponding Manifest field.

[0101] The resource delivery controller listens to the manifest resource, creates or updates the manifest resource to the API server of the corresponding member cluster, and finally deploys the resource to namespace A.

[0102] In one embodiment, in the resource delivery, there is a one-to-one relationship between resource and schedule unit. The corresponding resource can be found through the resource and field of the schedule unit.

[0103] The relationship between the Schedule Unit and the Manifest resource is one-to-many. Each cluster to be issued by the Schedule Unit corresponds to a Manifest. The Schedule Unit and the Manifest are associated through labels. The Manifest is labeled with the name of the corresponding Schedule Unit and the namespace label.

[0104] There is a one-to-one relationship between the manifest resource and the resources on the member cluster. The member resource will be labeled with the namespace and name of the corresponding manifest.

[0105] When modifying a resource, you may need to complete multiple modifications before executing the resource delivery. Because the global policy supports pausing delivery, the user can pause the delivery first, then modify it, and then cancel the pause after the modification is completed. After the controller is adjusted, the pause field will appear in the manifest. After the resource delivery controller listens to this field, it will no longer create or update the resource.

[0106] In one embodiment, the process of resource status collection is as follows: for example, a deployment resource is deployed in the namespace A of the primary cluster tenant, and two copies are respectively run in namespace A of the member cluster Cluster A and namespace B of Cluster B. The tenant needs to see in the primary cluster that the deployment is running in four copies and the running status of the four copies.

[0107] The resource status collection is achieved through the following process:

[0108] The Manifest Status controller monitors the status changes of member resources. If the status changes, it can find the corresponding manifest according to the label of the resource and write the status to the manifest status.

[0109] The Schedule Unit Status controller monitors the status changes of the manifest. If the status changes, it can find the corresponding Schedule Unit resource according to the label of the manifest and update the status of the Schedule Unit. In the process of updating the status of the Schedule Unit, it finds all corresponding manifests through the label and aggregates the status of the manifest to generate the status of the Schedule Unit.

[0110] Finally, according to the service (resource) field of the schedule unit (Schedule Unit), the status of the schedule unit (Schedule Unit) is updated to the status of the corresponding service (resource).

[0111] In one embodiment, the management of users and permissions supports joining the distributed cloud platform with minimal permissions. Admin permissions are not required, and only permissions to authorize a namespace and permissions to specify resources can be used. In addition to authorizing access to the resources of the main cluster, users can also access the resources of the member cluster through the federated API server. Through the custom API Server mechanism of Kubernetes, the Namespace Mapping resources are registered in the API server. The API server will intercept / apis / <group name> In the custom federated apsierver with a path prefixed with / v1alpha1 / namespacemappings / . In the custom server, the namespace of the resource to be queried or managed is replaced according to the configuration of NamespaceMapping, and then forwarded to the apiserver of the corresponding member cluster, and finally the response is aggregated and returned to the tenant, ensuring that the user can only access the resources under his corresponding namespace.

[0112] The user controller will automatically generate relevant cluster roles (clusterrole) and role bindings (rolebinding) in the main cluster and member clusters to limit the user's access rights in the main cluster and member clusters. In the cluster role (clusterrole), you can configure the user to only access resources under the specified namespace (based on the configuration of the namespace mapping relationship between the main cluster and the member cluster). And the corresponding private data (secrets), the private data (secrets) saves the corresponding Kubernetes files (kubeconfig information) used to manage cluster configuration information. Users access the resources of the cluster and member clusters through kubeconfig to limit user permissions. Usually, the federated API server (federatedapiserver) uses the administrator (admin) high-privilege user for access. When a user accesses a member cluster, the user of the access request will be replaced with the corresponding ordinary user through the impersonation mechanism (imporsonate mechanism).

[0113] In one embodiment, a user can define a tenant's total resource limit through a Federated Resource Quota custom resource, and divide resource usage into each cluster by percentage. When the resource change is monitored, the corresponding resource quota can be generated according to the configuration of the namespace mapping relationship between the main cluster and the member cluster and the percentage of each cluster, and the resource quota can be deployed to the member cluster. Limit the resource usage of the member cluster namespace, and obtain the usage of each cluster and write it back to the main cluster. This is used to manage the resource allocation status across multiple clusters in the Kubernetes Federation scenario.

[0114] In one embodiment, the present invention can also make a cluster exit the management of a tenant in a simple manner. Just delete the mapping of the member cluster in the namespace mapping relationship corresponding to the tenant. Since it is found that the cluster cannot be found in the corresponding namespace mapping relationship during the resource distribution and deletion of the member cluster's resources, the operation of updating the inventory resources and deleting the member cluster resources will no longer be performed, and the management of the resources will be stopped. It supports the rapid release of the cascade deletion relationship between resources, avoids unexpected deletion of important resources, and improves the stability of the system.

[0115] Embodiment 4

[0116] Figure 4 Schematic diagram of the structure of a cluster resource management device provided according to Embodiment 4 of the present invention. Figure 4As shown, the device includes: a resource determination module 41, a resource configuration module 42, a space determination module 43 and a resource deployment module 44.

[0117] The resource determination module 41 is used to obtain the namespace mapping relationship between the main cluster and the member cluster, and determine the resources to be issued and the resource issuance strategy;

[0118] A resource configuration module 42, configured to determine the scheduling unit resources and the list of clusters to be issued according to the resources to be issued and the resource issuance policy, and determine the resource configuration information to be issued according to the scheduling unit resources;

[0119] A space determination module 43, configured to determine a target namespace of the cluster to be delivered according to the namespace mapping relationship and the list of clusters to be delivered;

[0120] The resource deployment module 44 is used to send the resource configuration information to be sent according to the cluster list to be sent, and deploy the resource configuration information to be sent according to the target namespace.

[0121] The technical solution of the embodiment of the present invention obtains the namespace mapping relationship between the main cluster and the member cluster through the resource determination module, determines the resources to be sent and the resource sending strategy, the resource configuration module determines the scheduling unit resources and the list of clusters to be sent according to the resources to be sent and the resource sending strategy, determines the resource configuration information to be sent according to the scheduling unit resources, the space determination module determines the target namespace of the cluster to be sent according to the namespace mapping relationship and the list of clusters to be sent, the resource deployment module sends the resource configuration information to be sent according to the list of clusters to be sent, and deploys the resource configuration information to be sent according to the target namespace, so that in the resource sending and takeover scenarios, the mapped namespace can be flexibly selected according to the tenant planning, the convenience of cluster management is improved, and the user experience is enhanced.

[0122] In one embodiment, the cluster resource management device further includes:

[0123] A mapping construction module is used to determine the namespaces in the primary cluster and the member clusters that have an associated relationship for the tenant, and create a mapping relationship between the namespaces in the associated relationship as the namespace mapping relationship associated with the primary cluster;

[0124] The policy generation module is used to use the name of the namespace mapping relationship associated with the main cluster as the tenant's label and create a resource delivery policy for the tenant.

[0125] In one embodiment, the resource determination module 41 includes:

[0126] A policy extraction unit, used to extract the namespace mapping relationship between the main cluster and the member cluster associated with the tenant, and obtain the resource delivery policy of the preset tenant; wherein the resource delivery policy includes at least a global policy and a differentiated policy;

[0127] The resource determination unit is used to determine the resources to be sent; wherein the resources to be sent include at least one of the following: computing resources, storage resources and network resources.

[0128] In one embodiment, the resource configuration module 42 includes:

[0129] A resource scheduling determination unit, configured to determine scheduling unit resources according to the global policy and the resources to be issued when it is determined that the resources to be issued and / or the global policy in the resource issuance policy have changed; wherein the resource field of the scheduling unit resources configures the resources to be issued;

[0130] A list determination unit, used to determine the to-be-delivered clusters of the to-be-delivered resources, and to form the to-be-delivered clusters into a to-be-delivered cluster list;

[0131] An information determination unit, configured to determine change information of a change in the scheduling unit resources and / or the differentiation strategy when it is determined that the scheduling unit resources and / or the differentiation strategy in the resource delivery strategy have changed;

[0132] The resource configuration unit is used to update the inventory resources according to the change information as the resource configuration information to be issued; wherein the scheduling unit resources and the inventory resources are associated through tags.

[0133] In one embodiment, the space determination module 43 includes:

[0134] The namespace determination unit is used to search the namespace of each cluster to be delivered in the list of clusters to be delivered in the namespace mapping relationship, and use the namespace of the cluster to be delivered as the target namespace.

[0135] In one embodiment, the cluster resource management device further includes:

[0136] A first updating module is used to monitor the state changes of the resources to be delivered in the member cluster, and when it is determined that there is a state change, determine the list resource corresponding to the resource to be delivered through the preset tag of the resource to be delivered, and update the state change to the list resource;

[0137] A second updating module is used to determine the scheduling unit resource corresponding to the list resource through the preset tag associated with the list resource when it is determined that the existence state of the list resource has changed, and update the state of the scheduling unit resource according to the state change of the list resource;

[0138] The third updating module is used to determine the resource field of the scheduling unit resource and update the status of the scheduling unit resource to the resource field.

[0139] In one embodiment, the cluster resource management device further includes:

[0140] The permission creation module is used to create tenants' access permissions in the main cluster and member clusters, and configure tenants' resource limits.

[0141] The cluster resource management device provided in the embodiment of the present invention can execute the cluster resource management method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0142] Embodiment 5

[0143] Figure 5 It is a structural diagram of an electronic device for implementing a cluster resource management method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0144] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0145] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0146] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a cluster resource management method.

[0147] In some embodiments, the cluster resource management method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the cluster resource management method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the cluster resource management method in any other appropriate manner (e.g., by means of firmware).

[0148] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0149] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0150] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0151] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0152] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0153] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0154] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0155] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A cluster resource management method, characterized in that: include: Obtain the namespace mapping relationship between the main cluster and the member cluster, and determine the resources to be delivered and the resource delivery strategy; Determine the scheduling unit resources and the list of clusters to be issued according to the resources to be issued and the resource issuance strategy, and determine the resource configuration information to be issued according to the scheduling unit resources; Determine the target namespace of the cluster to be delivered according to the namespace mapping relationship and the list of clusters to be delivered; The resource configuration information to be issued is issued according to the to-be-issued cluster list, and the resource configuration information to be issued is deployed according to the target namespace.

2. The method according to claim 1, characterized in that Before obtaining the namespace mapping relationship between the main cluster and the member cluster and determining the resources to be delivered and the resource delivery strategy, the method further includes: Determine, for the tenant, namespaces in the primary cluster and the member clusters that have an associated relationship, and create a mapping relationship between the namespaces in the associated relationship as a namespace mapping relationship associated with the primary cluster; The name of the namespace mapping relationship associated with the main cluster is used as a label of the tenant, and a resource delivery policy for the tenant is created.

3. The method according to claim 1, characterized in that The obtaining of the namespace mapping relationship between the main cluster and the member cluster, and determining the resources to be issued and the resource issuance strategy include: Extract the namespace mapping relationship between the main cluster and the member cluster associated with the tenant, and obtain the pre-set resource delivery policy of the tenant; wherein the resource delivery policy includes at least a global policy and a differentiated policy; Determine the resources to be sent; wherein the resources to be sent include at least one of the following: computing resources, storage resources and network resources.

4. The method according to claim 1, characterized in that: The determining of the scheduling unit resources and the to-be-delivered cluster list according to the to-be-delivered resources and the resource delivery strategy, and determining the to-be-delivered resource configuration information according to the scheduling unit resources, includes: When it is determined that there is a change in the resources to be issued and / or the global policy in the resource issuance policy, the scheduling unit resources are determined according to the global policy and the resources to be issued; wherein the resource field of the scheduling unit resources configures the resources to be issued; Determine the to-be-delivered clusters of the to-be-delivered resources, and organize the to-be-delivered clusters into a to-be-delivered cluster list; When it is determined that the scheduling unit resources and / or the differentiation strategy in the resource delivery strategy have changed, determining change information that the scheduling unit resources and / or the differentiation strategy have changed; The list resources are updated according to the change information as the resource configuration information to be sent; wherein the scheduling unit resources and the list resources are associated through tags.

5. The method according to claim 1, characterized in that The determining the target namespace of the cluster to be delivered according to the namespace mapping relationship and the list of clusters to be delivered includes: The namespace of each cluster to be delivered in the list of clusters to be delivered is searched in the namespace mapping relationship, and the namespace of the cluster to be delivered is used as the target namespace.

6. The method according to claim 1, characterized in that After the resource configuration information to be issued is issued according to the to-be-issued cluster list, and the resource configuration information to be issued is deployed according to the target namespace, the method further includes: Monitor the state changes of the resources to be delivered in the member cluster, and when it is determined that the state changes exist, determine the list resources corresponding to the resources to be delivered by using the preset tags of the resources to be delivered, and update the state changes to the list resources; When it is determined that the existence state of the list resource has changed, determining the scheduling unit resource corresponding to the list resource through the preset tag associated with the list resource, and updating the state of the scheduling unit resource according to the state change of the list resource; Determine a resource field of the scheduling unit resource, and update the status of the scheduling unit resource to the resource field.

7. The method according to claim 1, characterized in that Before obtaining the namespace mapping relationship between the main cluster and the member cluster and determining the resources to be delivered and the resource delivery strategy, the following steps are also required: Create tenant access permissions on the master and member clusters, and configure resource limits for the tenant.

8. A cluster resource management device, characterized in that: include: The resource determination module is used to obtain the namespace mapping relationship between the main cluster and the member cluster, determine the resources to be issued and the resource issuance strategy; A resource configuration module, configured to determine the scheduling unit resources and the list of clusters to be issued according to the resources to be issued and the resource issuance strategy, and determine the resource configuration information to be issued according to the scheduling unit resources; A space determination module, configured to determine a target namespace of the cluster to be delivered according to the namespace mapping relationship and the list of clusters to be delivered; The resource deployment module is used to issue the resource configuration information to be issued according to the cluster list to be issued, and deploy the resource configuration information to be issued according to the target namespace.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the cluster resource management method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the cluster resource management method according to any one of claims 1 to 7 when executed.