Scheduling method and system based on Kubernetes in cross-domain environment

Optimizing Kubernetes' pod scheduling through real-time monitoring and scoring mechanisms solves the problems of inaccurate resource allocation and unconsidered communication delays in existing technologies, achieving more efficient resource utilization and task execution efficiency.

CN118784597APending Publication Date: 2024-10-15TARIM UNIV +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410904584.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing Kubernetes-based pod scheduling method has deficiencies in resource allocation and communication delay considerations, resulting in resource waste and long task execution time.

Method used

By obtaining the total amount of node resources, communication delay and bandwidth in a cross-domain environment, we can monitor the resource usage of nodes and pods in real time, build a communication indicator matrix and load scoring mechanism, optimize the sorting and scheduling decisions of candidate nodes, and ensure accurate resource allocation. sex and efficiency.

Benefits of technology

It improves resource utilization, reduces resource waste, shortens task execution time, ensures the best performance of applications on different nodes, and provides flexible scheduling policy adjustments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784597A_ABST
    Figure CN118784597A_ABST
Patent Text Reader

Abstract

The invention discloses a scheduling method based on Kubernetes in a cross-domain environment, which comprises the following steps: firstly, collecting the total resource amount of each node and the communication delay and bandwidth between the nodes through a Kubernetes API (Application Program Interface) and a network test tool, and then continuously monitoring the resource use condition of the nodes by using a monitoring tool; besides, the method also monitors node addition and deletion events in the Kubernetes cluster and a pod binding request, and triggers corresponding operations according to event types; after the creation information of the pod is obtained, screening out nodes meeting requirements according to the resource request quantity of the pod; then, according to communication delay and bandwidth information between the nodes, a communication index matrix is constructed, the communication performance of the nodes is scored, a total score is given according to the load conditions of the nodes, and a node list is subjected to ascending or descending sorting according to a scheduling strategy; and finally, binding the pod instance with the selected working node by a binding device to complete pod scheduling. The technical problem that task execution time is long in an existing resource-based scheduling method can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of cloud computing and computing resource scheduling, and more specifically, relates to a scheduling method and system based on Kubernetes in a cross-domain environment. Background Art

[0002] As an emerging computing model, cloud computing provides flexible and scalable computing resources. The development of geographically distributed data centers and the exponential growth of the amount of data processed in these data centers have made processing large-scale data applications an important topic. Container technology provides a lightweight virtualization layer that allows applications to run independently of the underlying infrastructure. The fully isolated environment provided by pod technology can ensure that the operating environment of the application is consistent and is not interfered with by other applications or operating systems. This is very important for large-scale data processing applications because they usually require specific dependencies and configurations. Kubernetes can dynamically allocate resources to ensure that each pod gets the appropriate computing power while avoiding resource waste. Not only that, Kubernetes provides a platform to simplify the deployment, management and monitoring of large-scale data applications. It automates the deployment, expansion, failover and update of pods, making operation and maintenance more efficient. Kubernetes can also manage pods distributed across data centers and geographical locations to meet the needs of processing data from different regions.

[0003] Existing Kubernetes-based pod scheduling methods are mainly divided into two categories, namely label-based scheduling methods and resource-based scheduling methods; label-based scheduling methods use Kubernetes' label mechanism to allocate pods (Pod is the smallest management unit of Kubernetes) to nodes that meet specific conditions; resource-based scheduling methods handle Pod allocation based on the number of resources of working nodes. This type of method usually models the pod scheduling problem as a vector packing problem, selects nodes based on multiple indicators (such as CPU utilization, memory utilization, disk utilization, etc.), and balances node loads and dependencies.

[0004] However, there are still some problems with the above two pod scheduling methods. First, for the label-based scheduling method, since the label can only provide rough information about the resource consumption of the application, it will lead to the inability to efficiently allocate pods to improve resource utilization, and it cannot provide enough information to make the best decision when dealing with scenarios with complex resource requirements; second, the label-based scheduling method does not take into account the actual resource usage of the node, which will lead to resource waste. If a node is marked as having sufficient resources, but in fact the resources of the node are already occupied by other applications, the label-based scheduling method may schedule the new application to the node, resulting in resource competition and performance degradation; third, the resource-based scheduling method mainly focuses on the number of resources of the node, without considering the communication delay between nodes, which will result in a longer execution time of the task. Summary of the invention

[0005] In view of the above defects or improvement needs of the prior art, the present invention provides a scheduling method and system based on Kubernetes in a cross-domain environment, which aims to solve the technical problems that the existing label-based scheduling method cannot efficiently allocate pods to improve resource utilization because the labels can only provide rough information about the resource consumption of the application, and cannot provide sufficient information to make the best decision when dealing with scenarios with complex resource requirements; the existing label-based scheduling method does not take into account the actual resource usage of the node, resulting in resource waste; and the existing resource-based scheduling method mainly focuses on the number of resources of the node without considering the communication delay between nodes, resulting in a long task execution time.

[0006] To achieve the above object, according to one aspect of the present invention, a scheduling method based on Kubernetes in a cross-domain environment is provided, comprising the following steps:

[0007] (1) Obtain the total number of nodes and the total amount of resources of each node in the cross-domain environment, and obtain the communication delay and bandwidth between any two nodes.

[0008] (2) Continuously monitor the remaining resources and resource utilization rate of each node in the cross-domain environment.

[0009] (3) Monitor the events occurring on each node in real time and determine whether the event is a node-related event or a pod-related event. If it is a node-related event, return to step (1); if it is a pod operation request, proceed to step (4);

[0010] (4) According to the Event object of the pod-related event obtained in step (3), the creation information of the corresponding pod is obtained. The creation information of the pod includes the resource request amount of the pod.

[0011] (5) Based on the resource request amount of the pod obtained in step (4) and the remaining resource amount of each node obtained in step (2), determine whether there is a node that meets the resources corresponding to the resource request amount. If so, take all nodes that meet the resources corresponding to the resource request amount as candidate nodes to build a candidate node list and proceed to step (6). Otherwise, set the state of the pod to waiting and return to step (2).

[0012] (6) Construct a communication index matrix based on the total number of nodes obtained in step (1), the communication delay and bandwidth between any two nodes, and the candidate node list obtained in step (5), and score the communication performance of all candidate nodes in the candidate node list based on the communication index matrix to obtain a communication performance score for each candidate node.

[0013] (7) Based on the resource utilization rate of each candidate node in the candidate node list obtained in step (2), and using the load scoring mechanism within Kubernetes to load score each candidate node, the total score of the candidate node is obtained based on the load score of the candidate node and the communication performance score of the candidate node obtained in step (6), and all candidate nodes in the candidate node list are sorted according to the total score, and the candidate node with the highest score is selected as the optimal scheduling node.

[0014] (8) According to the optimal scheduling node obtained in step (7), the pod corresponding to the Event object of the pod-related event obtained in step (3) is bound to the optimal scheduling node.

[0015] Preferably, the resources of a node include a CPU, memory, and storage in the node.

[0016] Step (1) is to use the network testing tool ping to measure the communication delay between nodes, and use the network testing tool iperf to measure the bandwidth of the nodes.

[0017] Step (2) is to use the monitoring tool Prometheus to obtain the remaining resources and resource usage of each node.

[0018] Preferably, in step (3), whether an event is a node-related event or a pod-related event is determined by checking the Kind field in the Event object of the event. If the value of the Kind field is node, the event is a node-related event; if the value of the Kind field is pod, the event is a pod-related event.

[0019] Node-related events include node addition events and node deletion events;

[0020] Pod-related events include pod creation events, pod binding events, and pod deletion events.

[0021] Preferably, step (6) comprises the following sub-steps:

[0022] (6-1) Initialize the delay matrix Y and the bandwidth matrix D, both of which have a size of N·M, where N represents the number of candidate nodes in the candidate node list and M represents the total number of nodes in the cross-domain environment obtained in step (1);

[0023] (6-2) Set counter i=1;

[0024] (6-3) Determine whether i is greater than the total number of candidate nodes in the candidate node list. If so, proceed to step (6-10), otherwise proceed to step (6-4);

[0025] (6-4) Set counter j = 1;

[0026] (6-5) Determine whether j is greater than the total number of nodes in the cross-domain environment obtained in step (1). If so, proceed to step (6-8); otherwise, proceed to step (6-6);

[0027] (6-6) Determine whether i is equal to j. If so, set the element yij in the i-th row and j-th column of the delay matrix Y to 0, and set the element dij in the i-th row and j-th column of the bandwidth matrix D to 0, and then proceed to step (6-8). Otherwise, set the element yij in the i-th row and j-th column of the delay matrix Y to the communication delay between the i-th candidate node and the j-th candidate node in the candidate node list obtained in step (1), and set the element dij in the i-th row and j-th column of the bandwidth matrix D to the bandwidth between the i-th candidate node and the j-th candidate node in the candidate node list obtained in step (1), and then proceed to step (6-7);

[0028] (6-7) Set j=j+1 and return to step (6-5);

[0029] (6-8) For the x-th row in the delay matrix Y obtained, all elements in the row are summed, and the sum result is used as the total communication delay of the x-th candidate node in the candidate node list, and for the y-th row in the bandwidth matrix D obtained, all elements in the row are summed, and the sum result is used as the total bandwidth of the y-th candidate node in the candidate node list, where x∈[1,N], y∈[1,N];

[0030] (6-9) Set i=i+1 and return to step (6-3);

[0031] (6-10) normalizing the total communication delay and total bandwidth of all candidate nodes in the candidate node list obtained in step (6-8) to obtain a delay score and a bandwidth score of each candidate node in the candidate node list;

[0032] (6-11) Calculate the communication performance score of each candidate node based on the delay score and bandwidth score of each candidate node in the candidate node list obtained in step (6-10).

[0033] Preferably, step (6-10) is to divide the minimum value of the N total communication delays corresponding to all N candidate nodes by the total communication delay of each candidate node, and obtain a normalized value as the delay score of the candidate node, and divide the minimum value of the N total bandwidths corresponding to all N candidate nodes by the total bandwidth of each candidate, and obtain a normalized value as the bandwidth score of the candidate node.

[0034] Preferably, step (6-11) is to calculate the communication performance score of each candidate node in the candidate node list using the following formula:

[0035] Communication performance score = delay score × delay weight + bandwidth score × bandwidth weight

[0036] The delay weight + bandwidth weight = 1, the default value of the delay weight is 0.4, and the default value of the bandwidth weight is 0.6.

[0037] Preferably, step (7) comprises the following sub-steps:

[0038] (7-1) Based on the resource usage of each candidate node in the candidate node list obtained in step (2), each candidate node is scored using the load scoring mechanism within Kubernetes to obtain a load score for each candidate node:

[0039] (7-2) obtaining a total score of each candidate node according to the load score of each candidate node in the candidate node list obtained in step (7-1) and the communication performance score of each candidate node obtained in step (6);

[0040] (7-3) Sort all candidate nodes according to the total score of each candidate node in the candidate node list obtained in step (7-2), and select the candidate node with the highest score as the optimal scheduling node.

[0041] Preferably, step (7-2) is to calculate the total score of each candidate node in the candidate node list using the following formula:

[0042] Total score = load score × α + communication score × (1-α)

[0043] Where α represents the score weight, and its default value is 0.6.

[0044] According to another aspect of the present invention, a scheduling system based on Kubernetes in a cross-domain environment is provided, including:

[0045] The first module is used to obtain the total number of nodes and the total amount of resources of each node in a cross-domain environment, and to obtain the communication delay and bandwidth between any two nodes.

[0046] The second module is used to continuously monitor the remaining resources and resource utilization rate of each node in the cross-domain environment.

[0047] The third module is used to monitor the events occurring on each node in real time and determine whether the event is a node-related event or a pod-related event. If it is a node-related event, it returns to the first module; if it is a pod operation request, it enters the fourth module;

[0048] The fourth module is used to obtain the creation information of the corresponding pod according to the Event object of the pod-related event obtained by the third module, and the creation information of the pod includes the resource request amount of the pod.

[0049] The fifth module is used to determine whether there is a node that meets the resources corresponding to the resource request amount according to the resource request amount of the pod obtained by the fourth module and the remaining resources of each node obtained by the second module. If so, all nodes that meet the resources corresponding to the resource request amount are taken as candidate nodes to build a candidate node list and enter the sixth module. Otherwise, the state of the pod is set to wait and then the second module is returned.

[0050] The sixth module is used to construct a communication index matrix based on the total number of nodes and the communication delay and bandwidth between any two nodes obtained in the first module and the candidate node list obtained in the fifth module, and score the communication performance of all candidate nodes in the candidate node list based on the communication index matrix to obtain a communication performance score for each candidate node.

[0051] The seventh module is used to perform load scoring on each candidate node according to the resource utilization rate of each candidate node in the candidate node list obtained by the second module and using the load scoring mechanism inside Kubernetes, obtain the total score of the candidate node according to the load score of the candidate node and the communication performance score of the candidate node obtained by the sixth module, and sort all the candidate nodes in the candidate node list according to the total score, and use the candidate node with the highest score as the optimal scheduling node.

[0052] The eighth module is used to bind the pod corresponding to the Event object of the pod-related event obtained by the third module to the optimal scheduling node according to the optimal scheduling node obtained by the seventh module.

[0053] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:

[0054] 1. The present invention adopts step (2), which continuously monitors the load of the node, and the scheduler can obtain the real-time resource usage of the node, so as to make more accurate scheduling decisions. Therefore, it can solve the technical problem that the existing label-based scheduling method does not take into account the actual resource usage of the node, resulting in resource waste;

[0055] 2. Since the present invention adopts step (6), the communication indicator matrix based on the selected nodes constructed by the present invention effectively considers the heterogeneity of node network resources in a cross-domain environment. The matrix not only considers the bandwidth and delay of the node, but also sets the weight value according to the actual business needs, so that the scheduler can flexibly allocate pods according to the bandwidth and delay requirements when selecting nodes. This can solve the technical problem that the existing resource-based scheduling method mainly focuses on the number of node resources without considering the communication delay between nodes, resulting in a long task execution time;

[0056] 3. Since the present invention adopts step (7), it not only evaluates the resource utilization of the node in the scoring stage, but also deeply considers the communication quality between the nodes. Through this comprehensive evaluation, the scheduler can more accurately predict and plan the operating environment of the pod to ensure that the application can obtain the best performance on different nodes; in addition, the α value introduced in step (7) further enhances the flexibility of the scheduler, which allows the scheduler to dynamically adjust the weight between the load score and the communication score according to different application scenarios and business needs. This dynamic adjustment mechanism enables the scheduler to adjust the strategy in real time according to the actual operating conditions, thereby achieving optimal utilization of resources and maximization of application performance. Therefore, it can solve the technical problem that the existing label-based scheduling method cannot efficiently allocate Pods to improve resource utilization because the label can only provide rough information about the resource consumption of the application, and cannot provide sufficient information to make the best decision when dealing with scenarios with complex resource requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 It is a flow chart of the scheduling method based on Kubernetes in a cross-domain environment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0059] The basic idea of ​​the present invention is to optimize the scheduling of pods by continuously monitoring node resources and communication delays, and understanding the resource requirements and priorities of pods, so as to improve the performance and user experience of applications. The method first collects the total resources of each node and the communication delay and bandwidth between nodes through Kubernetes API and network testing tools, and then uses monitoring tools to continuously monitor the resource usage of nodes. In addition, the method also monitors node joining and deletion events in the Kubernetes cluster, as well as pod binding requests, and triggers corresponding operations according to the event type. After obtaining the creation information of the pod, the nodes that meet the requirements are screened out according to the resource request amount of the pod. Subsequently, according to the communication delay and bandwidth information between nodes, a communication indicator matrix is ​​constructed, the communication performance of the nodes is scored, and the total score is given based on the load of the nodes, and the node list is sorted in ascending or descending order according to the scheduling strategy. Finally, the binder binds the pod instance to the selected working node to complete the pod scheduling.

[0060] like Figure 1 As shown, the present invention provides a scheduling method based on Kubernetes in a cross-domain environment, comprising the following steps:

[0061] (1) Obtain the total number of nodes and the total amount of resources of each node in the cross-domain environment, and obtain the communication delay and bandwidth between any two nodes.

[0062] Specifically, the resources of each node include the CPU, memory, storage, etc. in the node.

[0063] In this step, network testing tools such as ping and iperf are used to measure the network latency and bandwidth between nodes and record them. This provides basic data for subsequent node screening, sorting, and establishing a node communication indicator matrix.

[0064] (2) Continuously monitor the remaining resources and resource utilization rate of each node in the cross-domain environment.

[0065] Specifically, use the monitoring tool Prometheus to continuously monitor the resource usage of the node, including CPU, memory, network bandwidth, etc. Establish a resource usage database and update it regularly to facilitate dynamic scheduling.

[0066] The advantage of this step (2) is that by continuously monitoring the node load, the scheduler can obtain the real-time resource usage of the node and make more accurate scheduling decisions.

[0067] (3) Monitor the events occurring on each node in real time and determine whether the event is a node-related event or a pod-related event. If it is a node-related event, return to step (1); if it is a pod operation request, proceed to step (4);

[0068] Specifically, in this step, whether an event is a node-related event or a pod-related event is determined by checking the Kind field in the Event object of the event. If the value of the Kind field is node, the event is a node-related event; if the value of the Kind field is pod, the event is a pod-related event.

[0069] The node-related events in the present invention include node addition events and node deletion events. The pod-related events in the present invention include pod creation events, pod binding events, and pod deletion events.

[0070] (4) According to the Event object of the pod-related event obtained in step (3), the creation information of the corresponding pod is obtained. The creation information of the pod includes the resource request amount of the pod.

[0071] Specifically, the pod creation information includes the pod's resource request amount (CPU, memory, storage, etc.), affinity / anti-affinity rules, priority, etc., which is used to make corresponding scheduling decisions based on the pod creation information and provide a basis for pod scheduling.

[0072] (5) Based on the resource request amount of the pod obtained in step (4) and the remaining resource amount of each node obtained in step (2), determine whether there is a node that meets the resource request amount corresponding to the resource. If so, construct a candidate node list with all nodes that meet the resource request amount corresponding to the resource and proceed to step (6). Otherwise, set the pod status to pending and return to step (2).

[0073] This step is a key step in the pod scheduling process, which determines whether the pod can be successfully scheduled to run on the node.

[0074] (6) Construct a communication index matrix based on the total number of nodes obtained in step (1), the communication delay and bandwidth between any two nodes, and the candidate node list obtained in step (5), and score the communication performance of all candidate nodes in the candidate node list based on the communication index matrix to obtain a communication performance score for each candidate node.

[0075] Specifically, step (6) includes the following sub-steps:

[0076] (6-1) Initialize the delay matrix Y and the bandwidth matrix D, both of which have a size of N·M, where N represents the number of candidate nodes in the candidate node list and M represents the total number of nodes in the cross-domain environment obtained in step (1);

[0077] (6-2) Set counter i=1;

[0078] (6-3) Determine whether i is greater than the total number of candidate nodes in the candidate node list. If so, proceed to step (6-10), otherwise proceed to step (6-4);

[0079] (6-4) Set counter j = 1;

[0080] (6-5) Determine whether j is greater than the total number of nodes in the cross-domain environment obtained in step (1). If so, proceed to step (6-8); otherwise, proceed to step (6-6);

[0081] (6-6) Determine whether i is equal to j. If so, set the element yij in the i-th row and j-th column of the delay matrix Y to 0, and set the element dij in the i-th row and j-th column of the bandwidth matrix D to 0, and then proceed to step (6-8). Otherwise, set the element yij in the i-th row and j-th column of the delay matrix Y to the communication delay between the i-th candidate node and the j-th candidate node in the candidate node list obtained in step (1), and set the element dij in the i-th row and j-th column of the bandwidth matrix D to the bandwidth between the i-th candidate node and the j-th candidate node in the candidate node list obtained in step (1), and then proceed to step (6-7);

[0082] (6-7) Set j=j+1 and return to step (6-5);

[0083] (6-8) For the x-th row in the delay matrix Y obtained, all elements in the row are summed, and the sum result is used as the total communication delay of the x-th candidate node in the candidate node list, and for the y-th row in the bandwidth matrix D obtained, all elements in the row are summed, and the sum result is used as the total bandwidth of the y-th candidate node in the candidate node list, where x∈[1,N], y∈[1,N];

[0084] (6-9) Set i=i+1 and return to step (6-3);

[0085] (6-10) normalizing the total communication delay and total bandwidth of all candidate nodes in the candidate node list obtained in step (6-8) to obtain a delay score and a bandwidth score of each candidate node in the candidate node list;

[0086] Specifically, the minimum value of the N total communication delays corresponding to all N candidate nodes is divided by the total communication delay of each candidate node, and the normalized value obtained is used as the delay score of the candidate node. The higher the delay score, the lower the node delay. Then, the minimum value of the N total bandwidths corresponding to all N candidate nodes is divided by the total bandwidth of each candidate, and the normalized value is used as the bandwidth score of the candidate node. The higher the bandwidth score, the higher the node bandwidth.

[0087] (6-11) Calculate the communication performance score of each candidate node based on the delay score and bandwidth score of each candidate node in the candidate node list obtained in step (6-10).

[0088] Specifically, this step uses the following formula to calculate the communication performance score of each candidate node in the candidate node list:

[0089] Communication performance score = delay score × delay weight + bandwidth score × bandwidth weight

[0090] The delay weight + bandwidth weight = 1, the default value of the delay weight is 0.4, and the default value of the bandwidth weight is 0.6.

[0091] The advantage of this step (6) is that the constructed communication indicator matrix effectively considers the heterogeneity of node network resources in a cross-domain environment, which helps ensure that the scheduler considers the communication performance between nodes when selecting nodes. At the same time, different weights can be set for latency and bandwidth according to the actual business model. This provides the scheduler with flexibility to set weights according to different business requirements and priorities, thereby better meeting the needs of specific applications.

[0092] (7) Based on the resource utilization rate of each candidate node in the candidate node list obtained in step (2), and using the load scoring mechanism within Kubernetes to load score each candidate node, the total score of the candidate node is obtained based on the load score of the candidate node and the communication performance score of the candidate node obtained in step (6), and all candidate nodes in the candidate node list are sorted according to the total score, and the candidate node with the highest score is selected as the optimal scheduling node.

[0093] Specifically, this step includes the following sub-steps:

[0094] (7-1) Based on the resource usage of each candidate node in the candidate node list obtained in step (2), each candidate node is scored using the load scoring mechanism within Kubernetes to obtain a load score for each candidate node:

[0095] Specifically, this step calls the load scoring mechanism inside Kubernetes, that is, the load level of the candidate node is evaluated based on the current CPU, memory, disk and other resource utilization of the candidate node. The lower the resource utilization, the higher the load score, and the higher the resource utilization, the lower the load score.

[0096] (7-2) obtaining a total score of each candidate node according to the load score of each candidate node in the candidate node list obtained in step (7-1) and the communication performance score of each candidate node obtained in step (6);

[0097] Specifically, this step uses the following formula to calculate the total score of each candidate node in the candidate node list:

[0098] Total score = load score × α + communication score × (1-α)

[0099] α represents the scoring weight, and its default value is 0.6. The weight can be adjusted dynamically according to the scenario.

[0100] (7-3) Sort all candidate nodes according to the total score of each candidate node in the candidate node list obtained in step (7-2), and select the candidate node with the highest score as the optimal scheduling node.

[0101] The advantage of this step (7) is that it not only considers the resource utilization of the node, but also the communication quality between nodes, which enables the scheduler to comprehensively evaluate the load and communication capabilities of the node. In addition, the α value can dynamically adjust the weight between the load score and the communication score according to different scenarios. This dynamic adjustment mechanism enables the scheduler to adjust the strategy in real time according to the actual operation situation.

[0102] (8) According to the optimal scheduling node obtained in step (7), the pod corresponding to the Event object of the pod-related event obtained in step (3) is bound to the optimal scheduling node.

[0103] Specifically, this step is the last step in the pod scheduling process, which involves the binder binding the pod instance to the selected working node. After the scheduler selects the node, it calls the binder's API and passes the selected node information to the binder. After receiving the node information, the binder starts to perform the binding operation and finally completes the pod scheduling.

[0104] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A scheduling method based on Kubernetes in a cross-domain environment, characterized in that: The following steps are involved: (1) Obtain the total number of nodes and the total amount of resources of each node in the cross-domain environment, and obtain the communication delay and bandwidth between any two nodes. (2) Continuously monitor the remaining resources and resource utilization rate of each node in the cross-domain environment. (3) Monitor the events occurring on each node in real time and determine whether the event is a node-related event or a pod-related event. If it is a node-related event, return to step (1); if it is a pod operation request, proceed to step (4); (4) According to the Event object of the pod-related event obtained in step (3), the creation information of the corresponding pod is obtained. The creation information of the pod includes the resource request amount of the pod. (5) Based on the resource request amount of the pod obtained in step (4) and the remaining resource amount of each node obtained in step (2), determine whether there is a node that meets the resources corresponding to the resource request amount. If so, take all nodes that meet the resources corresponding to the resource request amount as candidate nodes to build a candidate node list and proceed to step (6). Otherwise, set the state of the pod to waiting and return to step (2). (6) Construct a communication index matrix based on the total number of nodes obtained in step (1), the communication delay and bandwidth between any two nodes, and the candidate node list obtained in step (5), and score the communication performance of all candidate nodes in the candidate node list based on the communication index matrix to obtain a communication performance score for each candidate node. (7) Based on the resource utilization rate of each candidate node in the candidate node list obtained in step (2), and using the load scoring mechanism within Kubernetes to load score each candidate node, the total score of the candidate node is obtained based on the load score of the candidate node and the communication performance score of the candidate node obtained in step (6), and all candidate nodes in the candidate node list are sorted according to the total score, and the candidate node with the highest score is selected as the optimal scheduling node. (8) According to the optimal scheduling node obtained in step (7), the pod corresponding to the Event object of the pod-related event obtained in step (3) is bound to the optimal scheduling node.

2. The scheduling method based on Kubernetes in a cross-domain environment according to claim 1 is characterized in that: The resources of a node include the CPU, memory, and storage in the node. Step (1) is to use the network testing tool ping to measure the communication delay between nodes, and use the network testing tool iperf to measure the bandwidth of the nodes. Step (2) is to use the monitoring tool Prometheus to obtain the remaining resources and resource usage of each node.

3. The scheduling method based on Kubernetes in a cross-domain environment according to claim 1 or 2, characterized in that: In step (3), whether an event is a node-related event or a pod-related event is determined by checking the Kind field in the Event object of the event. If the value of the Kind field is node, the event is a node-related event; if the value of the Kind field is pod, the event is a pod-related event. Node-related events include node addition events and node deletion events; Pod-related events include pod creation events, pod binding events, and pod deletion events.

4. The scheduling method based on Kubernetes in a cross-domain environment according to any one of claims 1 to 3, characterized in that: Step (6) includes the following sub-steps: (6-1) Initialize the delay matrix Y and the bandwidth matrix D, both of which have a size of N·M, where N represents the number of candidate nodes in the candidate node list and M represents the total number of nodes in the cross-domain environment obtained in step (1); (6-2) Set counter i=1; (6-3) Determine whether i is greater than the total number of candidate nodes in the candidate node list. If so, proceed to step (6-10), otherwise proceed to step (6-4); (6-4) Set counter j = 1; (6-5) Determine whether j is greater than the total number of nodes in the cross-domain environment obtained in step (1). If so, proceed to step (6-8); otherwise, proceed to step (6-6); (6-6) Determine whether i is equal to j. If so, set the element yij in the i-th row and j-th column of the delay matrix Y to 0, and set the element dij in the i-th row and j-th column of the bandwidth matrix D to 0, and then proceed to step (6-8). Otherwise, set the element yij in the i-th row and j-th column of the delay matrix Y to the communication delay between the i-th candidate node and the j-th candidate node in the candidate node list obtained in step (1), and set the element dij in the i-th row and j-th column of the bandwidth matrix D to the bandwidth between the i-th candidate node and the j-th candidate node in the candidate node list obtained in step (1), and then proceed to step (6-7); (6-7) Set j=j+1 and return to step (6-5); (6-8) For the x-th row in the delay matrix Y obtained, all elements in the row are summed, and the sum result is used as the total communication delay of the x-th candidate node in the candidate node list, and for the y-th row in the bandwidth matrix D obtained, all elements in the row are summed, and the sum result is used as the total bandwidth of the y-th candidate node in the candidate node list, where x∈[1,N], y∈[1,N]; (6-9) Set i=i+1 and return to step (6-3); (6-10) normalizing the total communication delay and total bandwidth of all candidate nodes in the candidate node list obtained in step (6-8) to obtain a delay score and a bandwidth score of each candidate node in the candidate node list; (6-11) Calculate the communication performance score of each candidate node based on the delay score and bandwidth score of each candidate node in the candidate node list obtained in step (6-10).

5. The scheduling method based on Kubernetes in a cross-domain environment according to claim 4 is characterized in that: Steps (6-10) are to divide the minimum value of the N total communication delays corresponding to all N candidate nodes by the total communication delay of each candidate node, and obtain a normalized value as the delay score of the candidate node, and divide the minimum value of the N total bandwidths corresponding to all N candidate nodes by the total bandwidth of each candidate, and obtain a normalized value as the bandwidth score of the candidate node.

6. The scheduling method based on Kubernetes in a cross-domain environment according to claim 5 is characterized in that: Step (6-11) is to calculate the communication performance score of each candidate node in the candidate node list using the following formula: Communication performance score = delay score × delay weight + bandwidth score × bandwidth weight The delay weight + bandwidth weight = 1, the default value of the delay weight is 0.4, and the default value of the bandwidth weight is 0.

6.

7. The scheduling method based on Kubernetes in a cross-domain environment according to claim 6 is characterized in that: Step (7) includes the following sub-steps: (7-1) Based on the resource usage of each candidate node in the candidate node list obtained in step (2), each candidate node is scored using the load scoring mechanism within Kubernetes to obtain a load score for each candidate node: (7-2) obtaining a total score of each candidate node according to the load score of each candidate node in the candidate node list obtained in step (7-1) and the communication performance score of each candidate node obtained in step (6); (7-3) Sort all candidate nodes according to the total score of each candidate node in the candidate node list obtained in step (7-2), and select the candidate node with the highest score as the optimal scheduling node.

8. The scheduling method based on Kubernetes in a cross-domain environment according to claim 7 is characterized in that: Step (7-2) is to calculate the total score of each candidate node in the candidate node list using the following formula: Total score = load score × α + communication score × (1-α) Where α represents the score weight, and its default value is 0.

6.

9. A scheduling system based on Kubernetes in a cross-domain environment, characterized in that: include: The first module is used to obtain the total number of nodes and the total amount of resources of each node in a cross-domain environment, and to obtain the communication delay and bandwidth between any two nodes. The second module is used to continuously monitor the remaining resources and resource utilization rate of each node in the cross-domain environment. The third module is used to monitor the events occurring on each node in real time and determine whether the event is a node-related event or a pod-related event. If it is a node-related event, it returns to the first module; if it is a pod operation request, it enters the fourth module; The fourth module is used to obtain the creation information of the corresponding pod according to the Event object of the pod-related event obtained by the third module, and the creation information of the pod includes the resource request amount of the pod. The fifth module is used to determine whether there is a node that meets the resources corresponding to the resource request amount according to the resource request amount of the pod obtained by the fourth module and the remaining resources of each node obtained by the second module. If so, all nodes that meet the resources corresponding to the resource request amount are taken as candidate nodes to build a candidate node list and enter the sixth module. Otherwise, the state of the pod is set to wait and then the second module is returned. The sixth module is used to construct a communication index matrix based on the total number of nodes and the communication delay and bandwidth between any two nodes obtained in the first module and the candidate node list obtained in the fifth module, and score the communication performance of all candidate nodes in the candidate node list based on the communication index matrix to obtain a communication performance score for each candidate node. The seventh module is used to perform load scoring on each candidate node according to the resource utilization rate of each candidate node in the candidate node list obtained by the second module and using the load scoring mechanism inside Kubernetes, obtain the total score of the candidate node according to the load score of the candidate node and the communication performance score of the candidate node obtained by the sixth module, and sort all the candidate nodes in the candidate node list according to the total score, and use the candidate node with the highest score as the optimal scheduling node. The eighth module is used to bind the pod corresponding to the Event object of the pod-related event obtained by the third module to the optimal scheduling node according to the optimal scheduling node obtained by the seventh module.

Citation Information

Cited By

  • Micro-service scheduling method, device and equipment under k8s cluster and storage medium

    CN119892905A

  • Microservice Scheduling Method, Device, Equipment and Storage Medium under k8s Cluster

    CN119892905B