CN109960585B - Resource scheduling method based on kubernets - Google Patents
Resource scheduling method based on kubernets Download PDFInfo
- Publication number
- CN109960585B CN109960585B CN201910107749.9A CN201910107749A CN109960585B CN 109960585 B CN109960585 B CN 109960585B CN 201910107749 A CN201910107749 A CN 201910107749A CN 109960585 B CN109960585 B CN 109960585B
- Authority
- CN
- China
- Prior art keywords
- pod
- node
- priority
- queue
- algorithm
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5021—Priority
Abstract
The invention relates to a method based onkubernetesThe resource scheduling method of (1) calculates all the resources in the cluster by a fixed ruleNodeThe scores are generated into a first node priority queue which is obtained by a dynamic priority algorithmPodPriority queue, two queue filtering non-dispatchableNodeGenerating the second sectionA point priority queue, from which the highest priority node and the highest priority node are selectedPodWith pop-up priority queuePodBinding, the binding is successfully carried out to enter the next stepPodScheduling circulation, if failure, the priority algorithm is adopted to optimize from the priority queue of the second nodeNodeBinding, failing again without being appropriateNodeCan be provided withPodOperation, enter the next onePodThe scheduling loop of (2). The method comprises static scheduling and dynamic resource load balancing, improves scheduling efficiency, accelerates task deployment efficiency, improves task operation integrity and load balancing of the whole cluster, actively adjusts the load balancing of the cluster, and improves the resource utilization efficiency of the cluster.
Description
Technical Field
The invention belongs to the technical field of digital information transmission, such as telegraph communication, and particularly relates to a kubernetes-based resource scheduling method for accelerating the deployment efficiency of cluster tasks.
Background
Kubernetes is a container arrangement engine of Google open source, which supports automatic deployment, large-scale scalable, application containerization management, and can manage the state of multiple nodes (nodes) in a large-scale cluster and the operation of Pod on the nodes. When an application is deployed in a production environment, multiple instances of the application are typically deployed to load balance application requests.
In kubernets, a container (containers) virtualization technology is a sharing mode of server resources, can meet the requirement of building a customized container according to needs, and is different from the traditional virtualization technology, so that the container virtualization technology is more flexible and convenient; in addition, Pod in kubernets refers to a set of one or several containers, is the minimum unit deployed by kubernets, logically represents an example of an application, and kubernets can manage multiple Pod examples created by users, so that the operation difficulty and the operation and maintenance management cost of operation and maintenance personnel are simplified.
The most important concern in the cloud computing field is the efficiency of resource scheduling and the load balancing of resource scheduling. In the prior art, a default scheduler selects an optimal Node to run a Pod instance according to a Node preselection and optimization algorithm, and a preemptive Priority scheduling algorithm designed for the Pod also exists, however, a Priority algorithm in a kubernets default scheduler calculates a score of each Node according to a requirement of each Pod instance, this calculation process reduces efficiency of resource scheduling, and meanwhile, a static Priority policy is adopted by a sorting algorithm of Pod Priority queues (Pod Priority queues) in the kubernets, which on one hand may possibly cause a large business to monopolize a part of nodes for a long time and reduce business deployment efficiency, and on the other hand, may possibly cause a part of low-Priority pods to fail to run for a long time and affect operation of the whole business.
A patent with a patent publication number of CN107948330A discloses a load balancing strategy based on dynamic priority in a cloud environment, Node dynamic priority takes the Pod priority algorithm in kubernets into consideration, and the Node dynamic priority is improved into a dynamic priority algorithm to make up for the defect of static priority in kubernets; however, the rescheduling for the kubernetes scheduler mainly occurs in the cases of Pod, Node abnormality, Pod capacity expansion and contraction upgrade, Node increase and decrease, and the like, and when the cluster runs stably and the above abnormality does not occur, the load of the cluster is not dynamically adjusted to promote the cluster load to be more balanced.
Patent publication No. CN106790726A discloses a dynamic load balancing method, but the method only divides all nodes into two high and low load queues, which means that some nodes are already in the average load state of the cluster, and there is no need to schedule Pod, and unnecessary scheduling occurs after the method, which reduces the efficiency of the system.
Disclosure of Invention
The invention solves the problems that in the prior art, the Priorities algorithm in the kubernets default scheduler can calculate the score of each Node according to the requirement of each Pod instance, the efficiency of resource scheduling is reduced, and the sorting algorithm of Pod priority queues in the kubernets adopts a static priority strategy, so that a part of nodes can be monopolized for a long time by a large business, the business deployment efficiency is reduced, a part of Pod with low priority can not run for a long time, and the running of the whole business is influenced, and provides the optimized resource scheduling method based on the kubernets.
The technical scheme adopted by the invention is that a resource scheduling method based on kubernets comprises the following steps:
step 1: initializing, calculating the scores of all nodes in the cluster, and adding all nodes into a first Node priority queue according to the scores from high to low; monitoring all the Pod in the cluster;
step 2: the cluster runs time T, if the Nodename field of any Pod is empty, the current Pod is added into the Pod priority queue by a dynamic priority algorithm, otherwise, the operation returns to the step 1;
and step 3: filtering useless nodes by using a high-priority Pod and a first Node priority queue which are matched preferentially through a pre-selection algorithm of kubernetes;
and 4, step 4: if no Node meeting the operating requirement of the Pod exists, the scheduling fails, and the step 3 is returned to enter the scheduling cycle of the next Pod; if available nodes exist, generating a filtered second Node priority queue and carrying out the next step;
and 5: selecting the Node with the highest priority from the priority queue of the second Node and carrying out binding operation with the high-priority Pod which is matched with the priority;
step 6: if the binding is successful, the high-priority Pod operates on the selected Node, the step 3 is returned to enter the scheduling cycle of the next Pod, otherwise, the binding is failed, and the next step is carried out;
and 7: node is optimized by using a priority algorithm of kubernetes from the second Node priority queue; binding operation is carried out on the preferred Node and the high-priority Pod which is matched with the priority;
and 8: and if the binding is successful, the high-priority Pod operates on the selected Node, the step 3 is returned to enter the scheduling cycle of the next Pod, otherwise, the binding is failed, and the scheduling cycle of the next Pod is still entered until the Node meeting the Pod to be scheduled appears in the cluster.
Preferably, in step 1, calculating the scores of all nodes includes the following steps:
step 1.1: calculating scores score of all nodes by using minimum consumption algorithm1,score1The sum of the CPU utilization rate, the memory utilization rate and the network bandwidth utilization rate is included;
step 1.2: calculating scores score of all nodes by using resource optimal balance algorithm2;
Step 1.3: in a score of score1And score2And adding to obtain the total score of any node.
Preferably, in step 1.1, score1Cpu (capacity-sum) (requested))10/capacity) + memory (capacity-sum (requested))10/capacity) + network (capacity-sum (requested))10/capacity, wherein the first term is cpu utilization, the second term is memory utilization, the third term is network bandwidth utilization, capacity represents the total amount of each resource on each node, and sum (requested) represents the corresponding total amount of resources required by the Pod.
Preferably, in step 2, the dynamic priority algorithm includes the following steps:
step 2.1: setting initial priority value initPodPriorityValue, system high priority threshold value alpha, system low priority threshold value beta and Pod escaping monitoring time TescapeThe minimum required Pod number minPodAmount and the Pod operation number weight W required by each Pod service operation1Time weight W occupying Pod priority queue2Pod running time weight W3;
Step 2.2: when the time waiting for the Pod to be established is more than TescapeCarrying out the next step;
step 2.3: obtaining the running number runningPodAmount of each Pod, the expected running number needledPodAmount of the corresponding Pod, and the time T of occupying the Pod priority queuequeuePosition Num of queue and time T of operationruntime;
Step 2.4: calculating the priority value runtimedopriorityValue of each Pod in the Pod priority queue, wherein the value is W1*runningPodAmount+W2*Num*Tqueue+W3*Truntime;
Step 2.5: if runtimedopriorityvalue is greater than α, calculating deprease podpriorityvalue, which is initPodpriorityvalue (1-runningPodAmount/needPodAmount), according to the value going from large to small into the reduced priority cohort; carrying out the next step;
calculating incrasepodpriorityvalue, which is the initPodpriorityvalue (1+ minPodAmount/ne dedPodAmount), by entering the queue of increasing priority from small to large value if runtimePriorityvalue is less than β; carrying out the next step;
if the runtimedopriorityvalue is between the threshold values alpha and beta, the dynamic priority is not adjusted, and the step 3 is carried out;
step 2.6: and adding all the Pod into the Pod priority queue again, and updating the information of the cluster.
Preferably, in the step 2.5, if the depreamedPodPriorityValue is not less than α, the priority of the corresponding Pod is decreased; if incrasepodpriorityvalue is not greater than β, the priority of the corresponding Pod is increased.
Preferably, in step 5, the binding operation is to change the value of the nodame field of the selected Pod to the name of the selected Node.
Preferably, in step 7, the priority algorithm includes a leaserequeudpriority algorithm, a BalanceResourceAllocation algorithm, a selectorspradpriority algorithm, a NodeAffinityPriority algorithm, a taintolerationpriority algorithm, and an interpackitoprioritypriority algorithm, and if any Node satisfies any algorithm, the algorithm is multiplied by a corresponding weight coefficient, and all products are added to obtain a score of the Node, and the Node with a higher score is given a higher priority.
Preferably, the resource scheduling method further includes a cluster dynamic resource load balancing method, where the cluster dynamic resource load balancing method includes the following steps:
step 9.1: initializing threshold η of high-load Node1And threshold η of low load Node2;
Step 9.2: monitoring cluster information in real time, and acquiring state information of all nodes according to a certain polling period T;
step 9.3: calculating scores Avg _ score (i) of average loads of all nodes, (1-Avg _ CPU (i)) 1-Avg _ network (i)) 1-Avg _ storage (i)), and calculating the load scores score (i) of each Node, (1-CPU (i)) 1-network (i) (1-storage (i)), wherein i is a Node sequence number, Avg _ CPU (i), Avg _ network (i) and Avg _ storage (i) are average values of CPUs, network bandwidths and memory utilizations of all nodes in the cluster respectively, and CPU, network bandwidth and memory utilizations of each Node respectively;
step 9.4: let eta be1=λ1Avg_Score(i)、η2=λ2Avg_Score(i);
Step 9.5: according to score (i) of each node by η1And η2As the threshold value, Score (i) < η1Node(s) of (c) is classified as a high load queue, score (i) > η2Node of (1) is classified as a low load queue, and η is1≤Score(i)≤η2Node(s) is classified as a balanced load queue;
step 9.6: if the high load queue and the low load queue are not empty, the next step is carried out; otherwise, the dynamic load scheduling is not carried out, and the step 9.2 is returned to enter the next polling period;
step 9.7: selecting the Pod running on the Node with the minimum value in the high load queue, preselecting the nodes in the low load queue, and running the Pod to the nodes in the low load queue to achieve cluster load balance.
Preferably, in step 9.2, the Node status information includes a CPU utilization rate, a memory utilization rate, a network bandwidth utilization rate, and a storage utilization rate of the Node.
the invention provides an optimized resource scheduling method based on kubernetes, which comprises the steps of reading cluster information, calculating scores of all nodes according to a fixed rule, generating a first Node priority queue, simultaneously obtaining a Pod priority queue obtained according to a dynamic priority algorithm, filtering nodes which cannot be scheduled by two queues through a preselection algorithm, generating a second Node priority queue, directly selecting a Node with the highest priority from the second Node priority queue to bind with a Pod popped out by the Pod priority queue, entering a scheduling cycle of the next Pod if the binding is successful, adopting a priority algorithm of the kubernetes to bind preferentially the Node in the second Node priority queue if the binding is failed, entering the scheduling cycle of the next Pod if the binding is successful, and indicating that no proper Node of the cluster can be operated by the Pod if the scheduling is failed.
The method comprises static scheduling and dynamic resource load balancing, and a more appropriate and non-optimal node is selected, so that the scheduling time of the kubernets scheduler can be saved, the scheduling efficiency is improved, the task deployment efficiency of the cluster is accelerated, the task operation integrity is improved, and the load balancing performance of the whole cluster is improved; the dynamic load balancing method transfers the Pod on the high-load Node to the low-load Node for operation, actively adjusts the load balance of the cluster, and improves the resource utilization efficiency of the cluster.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a flow chart of the dynamic priority algorithm of the present invention;
fig. 3 is a flowchart of a cluster dynamic resource load balancing method according to the present invention.
Detailed Description
The present invention will be described in further detail with reference to examples, but the scope of the present invention is not limited thereto.
The invention relates to a resource scheduling method based on kubernets, which comprises static scheduling and dynamic resource load balancing.
The method comprises the following steps.
Step 1: initializing, calculating the scores of all nodes in the cluster, and adding all nodes into a first Node priority queue according to the scores from high to low; all the Pod in the cluster are snooped.
In step 1, calculating the scores of all the nodes includes the following steps:
step 1.1: calculating scores score of all nodes by using minimum consumption algorithm1,score1Including cpu utilization, memory utilization, and network bandwidth utilizationSum of the utilization rates;
in said step 1.1, score1Cpu (capacity-sum) (requested))10/capacity) + memory (capacity-sum (requested))10/capacity) + network (capacity-sum (requested))10/capacity, wherein the first term is cpu utilization, the second term is memory utilization, the third term is network bandwidth utilization, capacity represents the total amount of each resource on each node, and sum (requested) represents the corresponding total amount of resources required by the Pod.
Step 1.2: calculating scores score of all nodes by using resource optimal balance algorithm2;
Step 1.3: in a score of score1And score2And adding to obtain the total score of any node.
In the invention, two algorithms for initializing and calculating the Node point values comprise a least consumption algorithm Leastrequest priority and a resource most balanced algorithm BalanceAllocation, wherein the former is used for selecting the Node with the least resource consumption, the resources comprise CPU utilization rate, memory utilization rate and network bandwidth utilization rate, and the latter selects the Node with the most balanced resource use, which is a known algorithm and mainly is the balance between the memory and the CPU utilization rate.
In the invention, score210-variance (cpufaction, memoryFraction) × 10, where cpufaction and memoryFraction are the ratio of Pod request resources to resources available on Node, cpufaction ═ cpu (requested)/cpu (available), memoryFraction ═ memory (requested)/memory (available), and variance is an algorithm for computing the balance between two resources in the kubernet itself, where requested represents the required amount and available represents the available amount.
Step 2: and (4) the cluster runs time T, if the Nodename field of any Pod is empty, the current Pod is added into the Pod priority queue by using a dynamic priority algorithm, and if not, the operation returns to the step 1.
In the invention, the dynamic priority algorithm of the Pod mainly solves the problems that the high-priority Pod occupies the head position of the Pod priority queue for a long time, so that the high-priority Pod possibly occupies Node resources of a cluster for a long time, and a low-priority Pod task cannot run. Specifically, the dynamic priority algorithm refers to an algorithm which is operated after a cluster is operated for a period of time, and can prevent the change of the high-priority Pod priority and the low-priority Pod priority when the cluster is operated, so that the high-priority Pod priority is lowered, and the low-priority Pod priority is raised.
In the invention, when there is no problem of Pod, the system returns to the state of monitoring Pod and continues to calculate the Node score.
In step 2, the dynamic priority algorithm includes the following steps:
step 2.1: setting initial priority value initPodPriorityValue, system high priority threshold value alpha, system low priority threshold value beta and Pod escaping monitoring time TescapeThe minimum required Pod number minPodAmount and the Pod operation number weight W required by each Pod service operation1Time weight W occupying Pod priority queue2Pod running time weight W3;
Step 2.2: when the time waiting for the Pod to be established is more than TescapeCarrying out the next step;
step 2.3: obtaining the running number runningPodAmount of each Pod, the expected running number needledPodAmount of the corresponding Pod, and the time T of occupying the Pod priority queuequeuePosition Num of queue and time T of operationruntime;
Step 2.4: calculating the priority value runtimedopriorityValue of each Pod in the Pod priority queue, wherein the value is W1*runningPodAmount+W2*Num*Tqueue+W3*Truntime;
Step 2.5: if runtimedopriorityvalue is greater than α, calculating deprease podpriorityvalue, which is initPodpriorityvalue (1-runningPodAmount/needPodAmount), according to the value going from large to small into the reduced priority cohort; carrying out the next step;
calculating incrasepodpriorityvalue, which is the initPodpriorityvalue (1+ minPodAmount/ne dedPodAmount), by entering the queue of increasing priority from small to large value if runtimePriorityvalue is less than β; carrying out the next step;
if the runtimedopriorityvalue is between the threshold values alpha and beta, the dynamic priority is not adjusted, and the step 3 is carried out;
in the step 2.5, if the createpodpriorityvalue is not less than α, the priority of the corresponding Pod is reduced; if incrasepodpriorityvalue is not greater than β, the priority of the corresponding Pod is increased.
In the invention, the time for waiting for the Pod establishment in the step 2.2 is more than TescapeI.e. indicating that the Pod creation was successful.
In the invention, the deceepPodPriorityValue and the incrasePodPriorityValue are further judged, so that the integral sequencing of the priorities of all the Pods is not required to be changed, and the situation that the priorities of all the Pods are positioned between alpha and beta, so that the resource scheduling is congested is prevented.
Step 2.6: and adding all the Pod into the Pod priority queue again, and updating the information of the cluster.
And step 3: and filtering useless nodes by the high-priority Pod and the first Node priority queue which are matched preferentially through a pre-selection algorithm of kubernets.
In the invention, the useless Node is a Node which obviously does not meet the requirement, including but not limited to filtering out the nodes which do not meet the requirement, such as insufficient residual CPU and memory resources, conflict of persistent storage volume, incapability of scheduling due to the fact that the host Node has dirty point, and affinity and counter-affinity of Pod.
And 4, step 4: if no Node meeting the operating requirement of the Pod exists, the scheduling fails, and the step 3 is returned to enter the scheduling cycle of the next Pod; and if available nodes exist, generating a filtered second Node priority queue and carrying out the next step.
In the invention, meeting the demand of Pod operation means meeting the requirements of memory, bandwidth, CPU quantity and the like of Pod operation.
And 5: and selecting the Node with the highest priority from the priority queue of the second Node and carrying out binding operation on the Node with the highest priority and the high-priority Pod with the priority matching.
In step 5, the binding operation is to change the value of the nodame field of the selected Pod into the name of the selected Node.
In the invention, Kubernetes only updates the Pod and Node information in the cache in the binding stage, and finally verifies whether the Pod can operate on the Node or not on the selected Node.
In the invention, Pod is popped up, and the Nodename of the selected Node is written into the attribute value of the Nodename in the Pod to be used as binding.
Step 6: and if the binding is successful, the high-priority Pod operates on the selected Node, the step 3 is returned to enter the scheduling cycle of the next Pod, and if the binding is not successful, the next step is carried out.
And 7: node is optimized by using a priority algorithm of kubernetes from the second Node priority queue; and binding the preferred Node and the high-priority Pod which is matched with the priority.
In step 7, the priority algorithm includes a leaserequeudpriority algorithm, a BalanceResourceAllocation algorithm, a selectorspradpriority algorithm, a NodeAffinityPriority algorithm, a tainttoleriority algorithm, and an interposaffinitypriority algorithm, and if any Node satisfies any algorithm, the algorithm is multiplied by a corresponding weight coefficient, and all products are added to obtain the score of the Node, and the Node with higher score is used as the higher priority.
In the invention, the scores of all nodes in the priority queue of the second Node are calculated through the algorithms, and the score is higher when the number of fields of one Node meeting the rules is more.
And 8: and if the binding is successful, the high-priority Pod operates on the selected Node, the step 3 is returned to enter the scheduling cycle of the next Pod, otherwise, the binding is failed, and the scheduling cycle of the next Pod is still entered until the Node meeting the Pod to be scheduled appears in the cluster.
In the invention, the two binding operations are the same.
The resource scheduling method also comprises a cluster dynamic resource load balancing method, and the cluster dynamic resource load balancing method comprises the following steps.
Step 9.1: initializing threshold η of high-load Node1And low load Node threshold η2。
In the present invention, eta1And η2The average value of the load according to all the servers is set by the person skilled in the art.
Step 9.2: and monitoring cluster information in real time, and acquiring the state information of all nodes according to a certain polling period T.
In step 9.2, the Node status information includes the CPU utilization, the memory utilization, the network bandwidth utilization, and the storage utilization of the Node.
Step 9.3: calculating scores Avg _ score (i) of average loads of all nodes, (1-Avg _ CPU (i)) 1-Avg _ network (i)) 1-Avg _ storage (i)), and calculating the load scores score (i) of each Node, (1-CPU (i)) 1-network (i) (1-storage (i)), wherein i is a Node sequence number, Avg _ CPU (i), Avg _ network (i) and Avg _ storage (i) are average values of CPUs, network bandwidths and memory utilizations of all nodes in the cluster, and CPU, network bandwidths and memory utilizations of each Node are CPU, network bandwidths and memory utilizations.
step 9.4: let eta be1=λ1Avg_Score(i)、η2=λ2Avg_Score(i)。
Step 9.5: according to score (i) of each node by η1And η2As the threshold value, Score (i) < η1Node(s) of (c) is classified as a high load queue, score (i) > η2Node of (1) is classified as a low load queue, and η is1≤Score(i)≤η2Node(s) of (2) is classified as a balanced load queue.
Step 9.6: if the high load queue and the low load queue are not empty, the next step is carried out; otherwise, the dynamic load scheduling is not carried out, and the step 9.2 is returned to enter the next polling period.
Step 9.7: selecting the Pod running on the Node with the minimum value in the high load queue, preselecting the nodes in the low load queue, and running the Pod to the nodes in the low load queue to achieve cluster load balance.
In the present invention, 0 < lambda1<λ2。
In the present invention, eta1<η2。
In the present invention, the Node in the low load queue is preselected in step 9.7 by using a kubernetes self-contained known algorithm.
The invention calculates the scores of all nodes by a fixed rule by reading cluster information, generates a first Node priority queue, simultaneously acquires a Pod priority queue obtained according to a dynamic priority algorithm, filters nodes which cannot be scheduled by two queues through a pre-selection algorithm, generates a second Node priority queue, directly selects a Node with the highest priority from the second Node priority queue to bind with a Pod popped by the Pod priority queue, if the binding is successful, the next Pod scheduling cycle is entered, if the binding is failed, the preferred Node in the second Node priority queue is bound by adopting a kubernetes self-contained priority algorithm, if the binding is successful, the next Pod scheduling cycle is entered, and if the scheduling is failed, the cluster does not have a proper Node for the operation of the Pod, the next Pod scheduling cycle is entered.
The method comprises static scheduling and dynamic resource load balancing, and a more appropriate and non-optimal node is selected, so that the scheduling time of the kubernets scheduler can be saved, the scheduling efficiency is improved, the task deployment efficiency of the cluster is accelerated, the task operation integrity is improved, and the load balancing performance of the whole cluster is improved; the dynamic load balancing method transfers the Pod on the high-load Node to the low-load Node for operation, actively adjusts the load balance of the cluster, and improves the resource utilization efficiency of the cluster.
Claims (9)
1. A resource scheduling method based on kubernets is characterized in that: the method comprises the following steps:
step 1: initializing, calculating the scores of all nodes in the cluster, and adding all nodes into a first Node priority queue according to the scores from high to low; monitoring all the Pod in the cluster;
step 2: the cluster runs time T, if the Nodename field of any Pod is empty, the current Pod is added into the Pod priority queue by a dynamic priority algorithm, otherwise, the operation returns to the step 1; the dynamic priority algorithm comprises the steps of:
step 2.1: setting initial priority value initPodPriorityValue, system high priority threshold value alpha, system low priority threshold value beta and Pod escaping monitoring time TescapeThe minimum required Pod number minPodAmount and the Pod operation number weight W required by each Pod service operation1Time weight W occupying Pod priority queue2Pod running time weight W3;
Step 2.2: when the time waiting for the Pod to be established is more than TescapeCarrying out the next step;
step 2.3: obtaining the running number runningPodAmount of each Pod, the expected running number needledPodAmount of the corresponding Pod, and the time T of occupying the Pod priority queuequeuePosition Num of queue and time T of operationruntime;
Step 2.4: calculating the priority value runtimedopriorityValue of each Pod in the Pod priority queue, wherein the value is W1*runningPodAmount+W2*Num*Tqueue+W3*Truntime;
Step 2.5: if runtimedopriorityvalue is greater than α, calculating deprease podpriorityvalue, which is initPodpriorityvalue (1-runningPodAmount/needPodAmount), according to the value going from large to small into the reduced priority cohort; carrying out the next step;
if runtimedopriorityvalue is less than β, calculating incrustedpoidpriorityvalue, which is the initPodpriorityvalue (1+ minPodAmount/needPodAmount), by entering the queue of increasing priority from small to large values; carrying out the next step;
if the runtimedopriorityvalue is between the threshold values alpha and beta, the dynamic priority is not adjusted, and the step 3 is carried out;
step 2.6: all the Pod are added into the Pod priority queue again, and cluster information is updated;
and step 3: filtering useless nodes by using a high-priority Pod and a first Node priority queue which are matched preferentially through a pre-selection algorithm of kubernetes;
and 4, step 4: if no Node meeting the operating requirement of the Pod exists, the scheduling fails, and the step 3 is returned to enter the scheduling cycle of the next Pod; if available nodes exist, generating a filtered second Node priority queue and carrying out the next step;
and 5: selecting the Node with the highest priority from the priority queue of the second Node and carrying out binding operation with the high-priority Pod which is matched with the priority;
step 6: if the binding is successful, the high-priority Pod operates on the selected Node, the step 3 is returned to enter the scheduling cycle of the next Pod, otherwise, the binding is failed, and the next step is carried out;
and 7: node is optimized by using a priority algorithm of kubernetes from the second Node priority queue; binding operation is carried out on the preferred Node and the high-priority Pod which is matched with the priority;
and 8: and if the binding is successful, the high-priority Pod operates on the selected Node, the step 3 is returned to enter the scheduling cycle of the next Pod, otherwise, the binding is failed, and the scheduling cycle of the next Pod is still entered until the Node meeting the Pod to be scheduled appears in the cluster.
2. The method of claim 1, wherein the resource scheduling method based on kubernets comprises: in step 1, calculating the scores of all the nodes includes the following steps:
step 1.1: calculating scores score of all nodes by using minimum consumption algorithm1,score1The sum of the CPU utilization rate, the memory utilization rate and the network bandwidth utilization rate is included;
step 1.2: calculating scores score of all nodes by using resource optimal balance algorithm2;
Step 1.3: in a score of score1And score2And adding to obtain the total score of any node.
3. The method of claim 2, wherein the resource scheduling method based on kubernets comprises: in said step 1.1, score1 ═ cpuX + memoryX + networkX, where,wherein, the first item of score1 is cpu utilization rate, the second item is memory utilization rate, and the third item is network bandwidth utilization rate, capacity respectively represents the total amount of cpu, memory, and network bandwidth on each node, and sum (requested) represents the corresponding total amount of cpu, memory, and network bandwidth resources required by Pod.
4. The method of claim 1, wherein the resource scheduling method based on kubernets comprises: in the step 2.5, if the createpodpriorityvalue is not less than α, the priority of the corresponding Pod is reduced; if incrasepodpriorityvalue is not greater than β, the priority of the corresponding Pod is increased.
5. The method of claim 1, wherein the resource scheduling method based on kubernets comprises: in step 5, the binding operation is to change the value of the nodame field of the selected Pod into the name of the selected Node.
6. The method of claim 1, wherein the resource scheduling method based on kubernets comprises: in step 7, the priority algorithm includes a leaserequeudpriority algorithm, a BalanceResourceAllocation algorithm, a selectorspradpriority algorithm, a NodeAffinityPriority algorithm, a tainttoleriority algorithm, and an interposaffinitypriority algorithm, and if any Node satisfies any algorithm, the algorithm is multiplied by a corresponding weight coefficient, and all products are added to obtain the score of the Node, and the Node with higher score is used as the higher priority.
7. The method of claim 1, wherein the resource scheduling method based on kubernets comprises: the resource scheduling method further comprises a cluster dynamic resource load balancing method, and the cluster dynamic resource load balancing method comprises the following steps:
step 9.1: initializing threshold η of high-load Node1And threshold η of low load Node2;
Step 9.2: monitoring cluster information in real time, and acquiring state information of all nodes according to a certain polling period T;
step 9.3: calculating scores Avg _ score (i) of average loads of all nodes, (1-Avg _ CPU (i)) 1-Avg _ network (i)) 1-Avg _ storage (i)), and calculating the load scores score (i) of each Node, (1-CPU (i)) 1-network (i) (1-storage (i)), wherein i is a Node sequence number, Avg _ CPU (i), Avg _ network (i) and Avg _ storage (i) are average values of CPUs, network bandwidths and memory utilizations of all nodes in the cluster respectively, and CPU, network bandwidth and memory utilizations of each Node respectively;
step 9.4: let eta be1=λ1Avg_Score(i)、η2=λ2Avg_Score(i);0<λ1<λ2;
Step 9.5: according to score (i) of each node by η1And η2As the threshold value, Score (i) < η1Node(s) of (c) is classified as a high load queue, score (i) > η2Node of (1) is classified as a low load queue, and η is1≤Score(i)≤η2Node(s) is classified as a balanced load queue;
step 9.6: if the high load queue and the low load queue are not empty, the next step is carried out; otherwise, the dynamic load scheduling is not carried out, and the step 9.2 is returned to enter the next polling period;
step 9.7: selecting the Pod running on the Node with the minimum value in the high load queue, preselecting the nodes in the low load queue, and running the Pod to the nodes in the low load queue to achieve cluster load balance.
8. The method of claim 7, wherein the resource scheduling method based on kubernets comprises: in step 9.2, the Node status information includes the CPU utilization, the memory utilization, and the network bandwidth utilization of the Node.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910107749.9A CN109960585B (en) | 2019-02-02 | 2019-02-02 | Resource scheduling method based on kubernets |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910107749.9A CN109960585B (en) | 2019-02-02 | 2019-02-02 | Resource scheduling method based on kubernets |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109960585A CN109960585A (en) | 2019-07-02 |
CN109960585B true CN109960585B (en) | 2021-05-14 |
Family
ID=67023606
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910107749.9A Active CN109960585B (en) | 2019-02-02 | 2019-02-02 | Resource scheduling method based on kubernets |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109960585B (en) |
Families Citing this family (39)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112214303A (en) * | 2019-07-09 | 2021-01-12 | 上海交通大学 | Kubernetes cluster automatic scaling system |
CN112214288B (en) * | 2019-07-10 | 2023-04-25 | 中国移动通信集团上海有限公司 | Pod scheduling method, device, equipment and medium based on Kubernetes cluster |
CN110515730A (en) * | 2019-08-22 | 2019-11-29 | 北京宝兰德软件股份有限公司 | Resource secondary dispatching method and device based on kubernetes container arranging system |
CN110727512B (en) * | 2019-09-30 | 2020-06-26 | 星环信息科技(上海)有限公司 | Cluster resource scheduling method, device, equipment and storage medium |
CN110704165A (en) * | 2019-10-08 | 2020-01-17 | 浪潮云信息技术有限公司 | High-availability deployment method for container |
CN110727653B (en) * | 2019-10-12 | 2023-06-16 | 广州华多网络科技有限公司 | Multi-project load balancing method and device |
CN110719335B (en) * | 2019-10-21 | 2022-10-04 | 中国科学院空间应用工程与技术中心 | Resource scheduling method, system and storage medium under space-based cloud computing architecture |
CN110941393A (en) * | 2019-10-31 | 2020-03-31 | 北京浪潮数据技术有限公司 | Logical volume management-based LV supply method, device, equipment and medium |
CN110851236A (en) * | 2019-11-11 | 2020-02-28 | 星环信息科技(上海)有限公司 | Real-time resource scheduling method and device, computer equipment and storage medium |
CN110990121B (en) * | 2019-11-28 | 2023-07-14 | 中国—东盟信息港股份有限公司 | Kubernetes scheduling strategy based on application portraits |
CN111143059B (en) * | 2019-12-17 | 2023-10-20 | 天津大学 | Improved Kubernetes resource scheduling method |
CN111090523A (en) * | 2019-12-18 | 2020-05-01 | 浪潮云信息技术有限公司 | Resource scheduling method based on dynamic priority under kubernets environment |
CN113014611A (en) * | 2019-12-19 | 2021-06-22 | 华为技术有限公司 | Load balancing method and related equipment |
CN111258609B (en) * | 2020-01-19 | 2023-08-01 | 北京百度网讯科技有限公司 | Upgrading method and device of Kubernetes cluster, electronic equipment and medium |
CN111475251A (en) * | 2020-03-08 | 2020-07-31 | 苏州浪潮智能科技有限公司 | Cluster container scheduling method, system, terminal and storage medium |
CN111352717B (en) * | 2020-03-24 | 2023-04-07 | 广西梯度科技股份有限公司 | Method for realizing kubernets self-defined scheduler |
CN111522639B (en) * | 2020-04-16 | 2022-11-01 | 南京邮电大学 | Multidimensional resource scheduling method under Kubernetes cluster architecture system |
CN111694646B (en) * | 2020-05-29 | 2023-11-07 | 北京百度网讯科技有限公司 | Resource scheduling method, device, electronic equipment and computer readable storage medium |
CN111737003B (en) * | 2020-06-24 | 2023-04-28 | 重庆紫光华山智安科技有限公司 | Pod balanced scheduling method and device, master node and storage medium |
US11336588B2 (en) | 2020-06-26 | 2022-05-17 | Red Hat, Inc. | Metadata driven static determination of controller availability |
CN111813556B (en) * | 2020-07-21 | 2021-04-09 | 北京东方通软件有限公司 | Elastic expansion method of virtual cluster in cloud computing environment |
DE102021109546A1 (en) * | 2020-09-30 | 2022-03-31 | Hewlett Packard Enterprise Development Lp | PREVENTING A RESOURCE FROM SCHEDULING OR RUNNING ON AN INCONSISTENT HOST NODE |
CN112181661B (en) * | 2020-10-13 | 2023-10-24 | 极道科技(北京)有限公司 | Task scheduling method |
CN112286631B (en) * | 2020-10-23 | 2022-07-01 | 烽火通信科技股份有限公司 | Kubernetes resource scheduling method and device and electronic equipment |
CN112363811B (en) * | 2020-11-16 | 2023-04-07 | 中国电子科技集团公司电子科学研究院 | Artificial intelligence computing resource scheduling method and computer readable storage medium |
CN112527454A (en) * | 2020-12-04 | 2021-03-19 | 上海连尚网络科技有限公司 | Container group scheduling method and device, electronic equipment and computer readable medium |
US11474905B2 (en) | 2020-12-10 | 2022-10-18 | International Business Machines Corporation | Identifying harmful containers |
CN114625493B (en) * | 2020-12-14 | 2024-04-02 | 中国石油大学(华东) | Kubernetes cluster resource scheduling method based on improved longhorn beetle whisker intelligent method |
CN112286671B (en) * | 2020-12-29 | 2021-03-12 | 湖南星河云程信息科技有限公司 | Containerization batch processing job scheduling method and device and computer equipment |
CN112764906B (en) * | 2021-01-26 | 2024-03-15 | 浙江工业大学 | Cluster resource scheduling method based on user job type and node performance bias |
CN112988380B (en) * | 2021-02-25 | 2022-06-17 | 电子科技大学 | Kubernetes-based cluster load adjusting method and storage medium |
CN113391891B (en) * | 2021-05-20 | 2024-03-12 | 国网江苏省电力有限公司信息通信分公司 | Load balancing resource scheduling method based on Rete and character string pattern matching algorithm |
CN113485792B (en) * | 2021-07-08 | 2023-05-26 | 厦门服云信息科技有限公司 | Pod scheduling method in kubernetes cluster, terminal equipment and storage medium |
US11706105B2 (en) | 2021-12-14 | 2023-07-18 | International Business Machines Corporation | Selecting low priority pods for guaranteed runs |
CN114327886B (en) * | 2021-12-24 | 2022-12-16 | 国家石油天然气管网集团有限公司 | Dynamic resource scheduling method based on big data deep learning |
CN114064296B (en) * | 2022-01-18 | 2022-04-26 | 北京建筑大学 | Kubernetes scheduling method, Kubernetes scheduling device and storage medium |
CN115309501A (en) * | 2022-07-26 | 2022-11-08 | 天翼云科技有限公司 | Cluster resource planning method, device, apparatus and medium |
CN115297112A (en) * | 2022-07-31 | 2022-11-04 | 南京匡吉信息科技有限公司 | Dynamic resource quota and scheduling component based on Kubernetes |
CN117112239B (en) * | 2023-10-23 | 2024-02-09 | 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) | Extensible load balancing method and system on heterogeneous reasoning back end |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10191778B1 (en) * | 2015-11-16 | 2019-01-29 | Turbonomic, Inc. | Systems, apparatus and methods for management of software containers |
CN106027643B (en) * | 2016-05-18 | 2018-10-23 | 无锡华云数据技术服务有限公司 | A kind of resource regulating method based on Kubernetes container cluster management systems |
US20180351851A1 (en) * | 2016-12-15 | 2018-12-06 | Nutanix, Inc. | Managing validity periods for computing resource attributes |
CN106886451B (en) * | 2017-01-10 | 2020-10-27 | 广东石油化工学院 | Multi-workflow task allocation method based on virtualization container technology |
CN108829509A (en) * | 2018-05-03 | 2018-11-16 | 山东汇贸电子口岸有限公司 | Distributed container cluster framework resources management method based on domestic CPU and operating system |
CN108769254B (en) * | 2018-06-25 | 2019-09-20 | 星环信息科技(上海)有限公司 | Resource-sharing application method, system and equipment based on preemption scheduling |
CN109117265A (en) * | 2018-07-12 | 2019-01-01 | 北京百度网讯科技有限公司 | The method, apparatus, equipment and storage medium of schedule job in the cluster |
CN109167835B (en) * | 2018-09-13 | 2021-11-26 | 重庆邮电大学 | Physical resource scheduling method and system based on kubernets |
CN109298914A (en) * | 2018-10-12 | 2019-02-01 | 西安交通大学 | A kind of Docker based on three-tier architecture and virtual machine initial placement method |
-
2019
- 2019-02-02 CN CN201910107749.9A patent/CN109960585B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN109960585A (en) | 2019-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109960585B (en) | Resource scheduling method based on kubernets | |
WO2021208546A1 (en) | Multi-dimensional resource scheduling method in kubernetes cluster architecture system | |
US11275609B2 (en) | Job distribution within a grid environment | |
CN107832153B (en) | Hadoop cluster resource self-adaptive allocation method | |
WO2016082370A1 (en) | Distributed node intra-group task scheduling method and system | |
CN109783225B (en) | Tenant priority management method and system of multi-tenant big data platform | |
CN114610474B (en) | Multi-strategy job scheduling method and system under heterogeneous supercomputing environment | |
CN114138486A (en) | Containerized micro-service arranging method, system and medium for cloud edge heterogeneous environment | |
CN108616394B (en) | Virtual network function backup and deployment method | |
US20230266999A1 (en) | Resource scheduling method, resource scheduling system, and device | |
CN112799817A (en) | Micro-service resource scheduling system and method | |
CN112114973A (en) | Data processing method and device | |
CN112799837A (en) | Container dynamic balance scheduling method | |
CN111767145A (en) | Container scheduling system, method, device and equipment | |
CN116010064A (en) | DAG job scheduling and cluster management method, system and device | |
CN115794337A (en) | Resource scheduling method and device, cloud platform, equipment and storage medium | |
CN113672391B (en) | Parallel computing task scheduling method and system based on Kubernetes | |
CN111796933A (en) | Resource scheduling method, device, storage medium and electronic equipment | |
CN115665157B (en) | Balanced scheduling method and system based on application resource types | |
CN115686826A (en) | Dynamic scheduling method and system based on space-based distributed satellite cluster | |
CN115562841A (en) | Cloud video service self-adaptive resource scheduling system and method | |
Hicham et al. | Deadline and energy aware task scheduling in cloud computing | |
CN115981806A (en) | Self-adaptive risk-resistant Kubernets cluster scheduling method based on penalty factors | |
CN115061811A (en) | Resource scheduling method, device, equipment and storage medium | |
CN114390106B (en) | Scheduling method, scheduler and scheduling system based on Kubernetes container resources |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |