CN114153604A - Container cluster control method and device - Google Patents

Container cluster control method and device Download PDF

Info

Publication number
CN114153604A
CN114153604A CN202111414286.4A CN202111414286A CN114153604A CN 114153604 A CN114153604 A CN 114153604A CN 202111414286 A CN202111414286 A CN 202111414286A CN 114153604 A CN114153604 A CN 114153604A
Authority
CN
China
Prior art keywords
resource
target
cluster
pod
container
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.)
Pending
Application number
CN202111414286.4A
Other languages
Chinese (zh)
Inventor
胡文端
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202111414286.4A priority Critical patent/CN114153604A/en
Publication of CN114153604A publication Critical patent/CN114153604A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation 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/505Allocation 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

Abstract

The invention discloses a container cluster control method and a device, which can determine the cluster resource utilization rate of a container cluster to a target resource, judge whether the cluster resource utilization rate is smaller than a first preset threshold value, if so, obtain a judgment result whether the cluster resource allocation rate of the target resource is smaller than a second preset threshold value, determine a target control object and a resource control mode corresponding to the judgment result, correspondingly control the target control object according to the resource control mode, add a pod to a container node of the container cluster, allocate the target resource to the added pod, improve the use amount of the container cluster to the target resource, and further improve the cluster resource utilization rate of the container cluster to the target resource.

Description

Container cluster control method and device
Technical Field
The invention relates to computer science and technology, in particular to a container cluster control method and device.
Background
With the development of computer science and technology, the control technology of container clusters is continuously improved.
Wherein, a plurality of container nodes can be included in the container cluster. The container node may be the smallest hardware unit in the container cluster, for example, the container node may be a real physical machine; for another example, the container node may be a virtual machine. One or more pods may be run in a container node. A Pod may be a high-level structure that holds one or more packaged containers, all of which may share the same namespace and local network in the same Pod. And one container may include one or more packaged applications.
Currently, there exist container cluster management platforms in the prior art, such as kubernets. The management platform can integrate resources (such as memory and CPU) of each container node in the container cluster, integrate the use condition of the whole resources of the container cluster, and schedule the integrated resources to the pod in each container node of the container cluster for use.
However, the existing container cluster management platform cannot effectively schedule resources, which results in low resource utilization rate.
Disclosure of Invention
In view of the above problems, the present invention provides a container cluster control method and apparatus that overcomes or at least partially solves the above problems, and the technical solution is as follows:
a container cluster control method, comprising:
determining the cluster resource utilization rate of the container cluster to the target resource;
judging whether the cluster resource utilization rate is smaller than a first preset threshold, if so, obtaining a judgment result whether the cluster resource allocation rate of the target resource is smaller than a second preset threshold;
determining a target control object and a resource control mode corresponding to the judgment result;
and correspondingly controlling the target control object according to the resource control mode so as to improve the cluster resource utilization rate of the target resource.
Optionally, the determining the target control object and the resource control manner corresponding to the determination result includes:
if the judgment result is that the cluster resource allocation rate of the target resource is smaller than the second preset threshold, determining that the target control object is the total available resource amount of the container cluster, and determining that the resource control mode is as follows: increasing the total amount of saleable resources by increasing a currently set first super-ratio to a second super-ratio.
Optionally, the determining the target control object and the resource control manner corresponding to the determination result includes:
and if the judgment result is that the cluster resource allocation rate of the target resource is not less than the second preset threshold, determining that the target control object is the request value of at least one pod, and determining that the resource control mode is to reduce the request value of at least one pod.
Optionally, the target resource is a memory, and the method further includes:
when the cluster resource allocation rate of the target resource is greater than a third preset threshold, determining a container node with the memory allocation rate greater than a fourth preset threshold in the container cluster as a target container node;
in the target container node, prioritizing all the pods based on the quality of service level, and determining at least one pod with a low priority order as a target pod;
evicting the target pod.
Optionally, the method further includes:
determining one of the target pods as a pod to be analyzed;
obtaining a configuration file of the pod to be analyzed, and reading a restart strategy of the pod to be analyzed from the configuration file of the pod to be analyzed;
after the pod to be analyzed is expelled, correspondingly controlling the pod to be analyzed according to a restarting strategy of the pod to be analyzed;
and returning to the step of determining one of the target pods as the pod to be analyzed until the control of each pod in the target pods is finished according to the corresponding restart strategy.
Optionally, the method further includes:
obtaining a prepared resource matched with the super-proportion;
when the cluster resource utilization rate is greater than a fifth preset threshold, allocating at least part of the prepared resources to at least one container node in the container cluster to reduce the cluster resource utilization rate to be not greater than the fifth preset threshold;
after the cluster resource utilization rate is not greater than the fifth preset threshold, adjusting the second super-allocation rate to a third super-allocation rate, wherein the third super-allocation rate is smaller than the second super-allocation rate.
A container cluster control apparatus comprising: the device comprises a first determining unit, a first judging unit, a first obtaining unit, a second determining unit and a first control unit; wherein:
the first determining unit is configured to determine a cluster resource utilization rate of the container cluster for the target resource;
the first judging unit is configured to judge whether the cluster resource utilization rate is smaller than a first preset threshold, and if so, trigger the first obtaining unit;
the first obtaining unit is configured to obtain a determination result whether the cluster resource allocation rate of the target resource is smaller than a second preset threshold;
the second determining unit is used for determining a target control object and a resource control mode corresponding to the judgment result;
and the first control unit is used for correspondingly controlling the target control object according to the resource control mode so as to improve the cluster resource utilization rate of the target resource.
Optionally, the second determining unit includes: a third determination unit and a fourth determination unit;
the third determining unit is configured to determine that the target control object is a total available resource amount of the container cluster if the determination result indicates that the cluster resource allocation rate of the target resource is smaller than the second preset threshold;
the fourth determining unit is configured to determine that the resource control manner is: increasing the total amount of saleable resources by increasing a currently set first super-ratio to a second super-ratio.
Optionally, the second determining unit includes: a fifth determining unit and a sixth determining unit;
the fifth determining unit is configured to determine that the target control object is a request value of at least one pod if the determination result indicates that the cluster resource allocation rate of the target resource is not less than the second preset threshold;
the sixth determining unit is configured to determine that the resource control manner is to decrease the request value of at least one pod.
Optionally, the target resource is a memory, and the apparatus further includes: a seventh determining unit, an eighth determining unit, and an eviction unit;
the seventh determining unit is configured to determine, as a target container node, a container node in the container cluster whose memory allocation rate is greater than a fourth preset threshold when the cluster resource allocation rate of the target resource is greater than a third preset threshold;
the eighth determining unit is configured to, in the target container node, prioritize all the pods based on the quality of service level, and determine at least one pod with a lower priority as a target pod;
the eviction unit is configured to evict the target pod.
Optionally, the apparatus further comprises: the device comprises a ninth determining unit, a second obtaining unit, a reading unit, a second control unit and a triggering unit;
the ninth determining unit is configured to determine one of the target pods as a pod to be analyzed;
the second obtaining unit is used for obtaining the configuration file of the pod to be analyzed;
the reading unit is used for reading the restart strategy of the analysis pod from the configuration file of the pod to be analyzed;
the second control unit is used for performing corresponding control on the pod to be analyzed according to a restarting strategy of the pod to be analyzed after the pod to be analyzed is expelled;
and the triggering unit is used for triggering the ninth determining unit until the control of each pod in the target pod is finished according to a corresponding restart strategy.
Optionally, the apparatus further comprises: a third obtaining unit, a distributing unit and an adjusting unit;
the third obtaining unit is used for obtaining the prepared resources matched with the super-ratio;
the allocating unit is configured to, when the cluster resource utilization rate is greater than a fifth preset threshold, allocate at least part of the prepared resources to at least one container node in the container cluster, so as to reduce the cluster resource utilization rate to be not greater than the fifth preset threshold;
the adjusting unit is configured to adjust the second super-allocation ratio to a third super-allocation ratio after the cluster resource utilization ratio is not greater than the fifth preset threshold, where the third super-allocation ratio is smaller than the second super-allocation ratio.
The method and the device for controlling the container cluster, which are provided by this embodiment, may determine a cluster resource utilization rate of the container cluster for the target resource, determine whether the cluster resource utilization rate is smaller than a first preset threshold, if so, obtain a determination result whether a cluster resource allocation rate of the target resource is smaller than a second preset threshold, determine a target control object and a resource control manner corresponding to the determination result, perform corresponding control on the target control object according to the resource control manner, add the pod to the container node of the container cluster, allocate the target resource to the added pod, so as to improve the usage amount of the container cluster for the target resource, thereby improving the cluster resource utilization rate of the container cluster for the target resource.
The foregoing description is only an overview of the technical solutions of the present invention, and the following detailed description of the present invention is provided to enable the technical means of the present invention to be more clearly understood, and to enable the above and other objects, features, and advantages of the present invention to be more clearly understood.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart illustrating a first container cluster control method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a first container cluster control device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
As shown in fig. 1, the present embodiment proposes a first container cluster control method, which may include the following steps:
s101, determining the cluster resource utilization rate of a container cluster to a target resource;
it should be noted that the present invention can be applied to a container cluster management platform.
The target resource may be, among other things, some type of computer resource, such as a CPU, memory, hard disk, or network resource.
The cluster resource utilization rate of the target resource may be a ratio of the usage amount of the target resource by the container cluster to an actual total amount of the target resource in all container nodes.
S102, judging whether the utilization rate of the cluster resources is smaller than a first preset threshold value, if so, executing a step S103; otherwise, forbidding to execute the step S103, and avoiding the consumption of unnecessary resources;
the first preset threshold may be used to determine a degree of cluster resource utilization of the current container cluster for the target resource.
Specifically, when the cluster resource utilization rate of the target resource is smaller than the first preset threshold, the present invention may determine that the cluster resource utilization rate of the target resource is low, and execute step S103; when the cluster resource utilization rate of the target resource is not less than the first preset threshold, the method and the device can determine the cluster resource utilization rate of the target resource
It should be noted that the first preset threshold may be set by a technician according to actual situations, and the present invention is not limited to this, and may be set to 15%, for example.
S103, obtaining a judgment result whether the cluster resource allocation rate of the target resource is smaller than a second preset threshold value;
the cluster resource allocation rate of the target resource may be a ratio of a total amount of request values of all the pods to the target resource in the container cluster to a total amount of the target resource allocable by all the container nodes. It should be noted that the request value of the pod to the target resource may be set by a technician in advance according to the condition of the pod.
The second preset threshold may be used to determine a degree of the cluster resource allocation rate of the target resource.
Specifically, when the judgment result is that the cluster resource allocation rate of the target resource is smaller than the second preset threshold, the method can determine that the cluster resource allocation rate of the target resource is lower; when the judgment result shows that the cluster resource allocation rate of the target resource is not less than the second preset threshold, the method and the device can determine that the cluster resource allocation rate of the target resource is not low or high.
It should be noted that the second preset threshold may be set by a technician according to practical situations, and the present invention is not limited to this, and for example, the second preset threshold may be set to 60%.
S104, determining a target control object and a resource control mode corresponding to the judgment result;
the target control object may be an object that needs to be controlled to improve the utilization rate of the cluster resource of the target resource.
The resource control mode may be a control mode for the target control object, which is required to improve the cluster resource utilization rate of the target resource.
Specifically, when the cluster resource utilization rate of the target resource is smaller than a first preset threshold value, the target control object and the resource control mode are determined according to the judgment result.
Optionally, in the second container cluster control method proposed in this embodiment, step S104 may include:
if the judgment result is that the cluster resource allocation rate of the target resource is smaller than a second preset threshold, determining that the target control object is the total available resource amount of the container cluster, and determining that the resource control mode is as follows: the total amount of saleable resources is increased by increasing the currently set first super-ratio to the second super-ratio.
The total available resource amount may be a product of a total amount of available resource amounts of all container nodes in the container cluster to the target resource and the super-proportion. The amount of resources that can be supplied to the target resource by the container node may be the amount of resources of the target resource allocated to the container node by the container cluster management platform after integrating the target resources in all the container nodes. It will be appreciated that the total amount of saleable resources may be greater than the total amount of target resources that all container nodes can supply (in which case the super ratio is greater than 1).
Specifically, when the cluster resource utilization rate of the target resource is smaller than a first preset threshold and the cluster resource allocation rate is smaller than a second preset threshold, the present invention may determine that the number of current pod in the container cluster is small, and at this time, by increasing the total saleable resource amount in the resource selling pool, more pod may be scheduled into the container cluster, so that more tasks or jobs may be scheduled to enter the container cluster for operation, and the cluster resource utilization rate of the container cluster for the target resource is improved.
Whether the pod can be added to the target container node of the container cluster is related to the sum of the limit values of all the pods in the container cluster to the target resource, the total amount of the available resources and the remaining available resources of the target container node for the target resource. The remaining allocable resources may be a value obtained by subtracting, from the amount of suppliable resources of the target resource by the target container node, the total amount of requests of all non-terminated pod-to-target resources on the target container node.
Specifically, the sum of the limit values for all of the pods in the container cluster may be no greater than the total amount of resources available for sale. When the sum of the limit value of the pod to be called into the container cluster and the limit values of all the pods in the container cluster is not more than the total available resource amount, the invention can call the pod to be called into the container cluster; and when the sum of the limit value of the pod to be called into the container cluster and the limit values of all the pods in the container cluster is larger than the total available resource amount, the invention can prohibit the pod to be called into the container cluster from being called into the container cluster.
Specifically, the total amount of requests of all non-terminated state posts on the target container node to the target resource cannot be greater than the amount of suppliable resources of the target container node to the target resource. When the sum of the request value of the pod to be called into the target container node to the target resource and the total amount of the requests of all the pod to the target resource in the non-termination state on the target container node is not more than the amount of the available resource, the invention can call the pod to be called into the target container node; when the sum of the request value of the pod to be called into the target container node to the target resource and the total amount of the requests of all the pod to the target resource in the non-termination state on the target container node is larger than the amount of the available resource, the invention can prohibit the pod to be called into the target container node from being called into the target container node.
Specifically, when the cluster resource utilization rate of the target resource is smaller than a first preset threshold and the cluster resource allocation rate is smaller than a second preset threshold, the present invention may consider that the total amount of the available resource amount of all the container nodes with respect to the target resource is sufficient, and the number of pod included in the container cluster is small, and at this time, it is not necessary to add a new target resource in the container cluster, and the pod is added to the container nodes of the container cluster to allocate the target resource to the added pod, so as to increase the usage amount of the target resource by the container cluster, thereby increasing the cluster resource utilization rate of the container cluster with respect to the target resource. It can be understood that, after the pod is added to the container cluster, the total request amount of all the pods to the target resource in the container cluster can be simultaneously increased, so that the cluster resource allocation rate of the container cluster to the target resource can be increased.
Specifically, when the cluster resource utilization rate of the target resource is smaller than a first preset threshold and the cluster resource allocation rate is smaller than a second preset threshold, the method and the system can determine that the target control object is the total saleable resource amount of the container cluster, and determine that the resource control mode is to increase the total saleable resource amount of the target resource by increasing the super-proportion. It can be understood that, when the total amount of the saleable resources is increased by increasing the super-ratio, the total amount of the suppliable resources of all container nodes with respect to the target resource is unchanged, and a new pod can be added to the container cluster on the premise that the limit total amount of all pods in the container cluster is not greater than the total amount of the saleable resources.
Optionally, when the super-match ratio is increased, the super-match ratio may be increased according to an increase manner of a certain step size (e.g., 10%).
Optionally, in a third container cluster control method provided in this embodiment, the step S104 may include:
and if the judgment result is that the cluster resource allocation rate of the target resource is not less than the second preset threshold, determining that the target control object is the request value of at least one pod, and determining that the resource control mode is to reduce the request value of at least one pod.
Specifically, when the cluster resource utilization rate of the target resource is less than a first preset threshold and the cluster resource allocation rate is not less than a second preset threshold, the present invention may consider that the total amount of the available resource amounts of all container nodes with respect to the target resource is sufficient, and the actual over-selling degree of the target resource by the container cluster is low, and at this time, the cluster resource utilization rate of the target resource by the container cluster may be improved only by reducing the request value of at least one pod.
The reduction of the request value of the pod can be referred to as pod compression. In theory, the pod compression ratio is 1/cluster super-ratio. Assuming that all the pods on the container cluster are resident services and the request values of the pods are all n% of the limit value, the total resource amount (sum namespace resource availability) of the container cluster may be set to (100/n)% of the actual available resource amount (sum node availability) of the container cluster. In this case, the present invention can submit the pod to the container cluster as much as possible so that the request occupancy of each container node approaches 100% and the limit occupancy approaches (100/n)%
The pod to be reduced in the request value may be an existing pod in the container cluster, or may be a pod to be called into the container cluster.
It should be noted that, when the request value of at least one pod is reduced, the new pod can be introduced into the container cluster under the condition that the cluster resource allocation rate of the container cluster to the target resource is effectively avoided being too high, so that the cluster resource utilization rate of the target resource is improved.
Specifically, when the request value of the pod is reduced, the normal execution of the task by the pod can be prevented from being influenced.
Specifically, when selecting the pod with the request value to be reduced, the present invention may obtain the resource usage of each pod on each container node of the container cluster in advance, determine whether the setting of the request value of each pod is reasonable, and then determine the pod with the determined larger setting of the request value as the pod with the request value to be reduced.
Optionally, in the other container cluster control methods provided in this embodiment, when the cluster resource utilization rate of the target resource is less than the first preset threshold and the cluster resource allocation rate is not less than the second preset threshold, the present invention may also adopt a manner of reducing the request value of at least one pod and increasing the total available resource amount at the same time, so that the container cluster may introduce more pods, and improve the cluster resource utilization rate of the container cluster for the target resource. At this time, the target control object may include a request value of at least one pod and a total available resource amount of the target resource, and the resource control manner may include decreasing the request value of at least one pod and increasing the total available resource amount.
And S105, correspondingly controlling the target control object according to the resource control mode so as to improve the cluster resource utilization rate of the target resource.
Specifically, after the target control object and the resource control mode are determined, the cluster resource utilization rate of the container cluster to the target resource can be improved by correspondingly controlling the target control object according to the determined resource control mode.
The method for controlling a container cluster according to this embodiment may determine a cluster resource utilization rate of a container cluster for a target resource, determine whether the cluster resource utilization rate is smaller than a first preset threshold, if so, obtain a determination result whether a cluster resource allocation rate of the target resource is smaller than a second preset threshold, determine a target control object and a resource control manner corresponding to the determination result, perform corresponding control on the target control object according to the resource control manner, add a pod to a container node of the container cluster, allocate the target resource to the added pod, so as to increase a usage amount of the container cluster for the target resource, thereby increasing the cluster resource utilization rate of the container cluster for the target resource.
Based on fig. 1, the present embodiment proposes a fourth container cluster control method. In the method, the target resource may be a memory, and the method may further include:
when the cluster resource allocation rate of the target resource is greater than a third preset threshold, determining container nodes with the memory allocation rate greater than a fourth preset threshold in the container cluster as target container nodes;
in the target container node, all the pods are subjected to priority ranking based on the service quality level, and at least one pod with a low priority rank is determined as a target pod;
evicting the target pod.
The third preset threshold may be used to determine a level of a resource allocation rate of a memory in the container cluster. Optionally, when the cluster resource allocation rate of the memory is greater than a third preset threshold, the method and the device can determine that the cluster resource allocation rate of the memory is too high and the container cluster has a risk of memory shortage; when the cluster resource allocation rate of the memory is not greater than the third preset threshold, the method and the device can determine that the cluster resource allocation rate of the memory is not too high and the container cluster does not have the risk of memory shortage. Specifically, the third preset threshold may be set by a technician according to actual situations, and the present invention is not limited thereto.
It should be noted that, after the selling resource pool of the container cluster is over-configured, if it is determined that the memory of the container cluster has a shortage risk, the present invention may determine a container node with a large operating pressure from the container cluster in advance, determine a Pod to be evicted in the container node according to a predefined Pod eviction policy, evict the Pod to be evicted, release the memory, and eliminate or alleviate the memory shortage risk.
The fourth preset threshold value can be used for judging the degree of the operating pressure of the container node. Optionally, when the memory allocation rate of a certain container node is greater than a fourth preset threshold, the method of the invention may determine that the operating pressure of the container node is relatively high; when the memory allocation rate of a certain container node is not greater than the fourth preset threshold, the method can determine that the operating pressure of the container node is not large.
Wherein the target container node may comprise one or more container nodes. The target pod may also include one or more pods.
Specifically, after the target container node is determined, the Quality of Service (QoS) class of each pod in the target container node is determined, the eviction priority of each pod is determined according to the QoS ranking of each pod, and the pod which can be preferentially evicted is correspondingly determined based on the eviction priority of each pod.
Specifically, the present invention can confirm the QoS of each pod by configuring the sizes of the limits and requests values of the CPU/MEM. For a certain pod, when the request value of the pod is equal to the limit value, it may be determined that the QoS of the pod is Guaranteed, when the request value of the pod is less than the limit value, it may be determined that the QoS of the pod is Burstable, and when the pod does not have any memory or CPU limitation or request, it may be determined that the QoS of the pod is Best-efficiency. The eviction priority ranking of guarded, burst and Best-efficiency can be Best-efficiency > burst > guarded, that is, Pod of Best-efficiency grade will be evicted first when memory shortage occurs in the container node.
Optionally, in the fourth container cluster control method, the method may further include:
determining one of the target pods as a pod to be analyzed;
obtaining a configuration file of the pod to be analyzed, and reading a restart strategy of the pod to be analyzed from the configuration file of the pod to be analyzed;
after the pod to be analyzed is expelled, the pod to be analyzed is correspondingly controlled according to the restarting strategy of the pod to be analyzed;
and returning to the step of determining one of the target pods as the pod to be analyzed until the control of each pod in the target pods is finished according to the corresponding restart strategy.
Specifically, the present invention may set corresponding configuration files for the pod in advance, and may define corresponding restart policies in the configuration files of the pods, respectively. When a certain pod is evicted, the present invention may determine whether to reboot the pod, that is, determine whether to reboot the pod in container nodes other than the target container node in the container cluster, according to a reboot policy configured for the pod in advance. Specifically, the restart policy may include Always, OnFailure, and Never, where:
always: when the pod is invalid, the pod can be automatically restarted;
OnFailure: when the pod stops running and the exit code is not 0, the invention can automatically restart the pod;
never: regardless of the operational state of the pod, the present invention prohibits restarting the pod.
Optionally, when a large number of Pod fails, the present invention may query the reason of Pod restart, such as OOM kill, through the kubeccripte Pod.
The method for controlling a container cluster according to this embodiment may, after over-provisioning a selling resource pool of the container cluster, determine, if it is determined that there is a shortage risk in a memory of the container cluster, a container node with a large operating pressure from the container cluster in advance, determine, according to a predefined Pod eviction policy, a Pod that needs to be evicted in the container node, evict the Pod that needs to be evicted, release the memory, eliminate or alleviate the shortage risk of the memory, and implement optimal control on the container cluster.
Based on the second container cluster control method, a fifth container cluster control method is provided in this embodiment, where the fifth container cluster control method may further include:
obtaining a prepared resource matched with the super-proportion;
when the cluster resource utilization rate is greater than a fifth preset threshold, at least part of the prepared resources are allocated to at least one container node in the container cluster, so that the cluster resource utilization rate is reduced to be not greater than the fifth preset threshold;
and after the cluster resource utilization rate is not greater than a fifth preset threshold, adjusting the second super-allocation rate to be a third super-allocation rate, wherein the third super-allocation rate is smaller than the second super-allocation rate.
Wherein the provisioning resources may be part of the computer resources that the present invention provisions from the container cluster. The portion of the computer resources may be obtained from a container node of the container cluster or may be obtained from a location other than the container cluster (e.g., an electronic device not belonging to the container cluster).
The fifth preset threshold may be used to determine whether the target resource is in short supply. Specifically, when the cluster resource utilization rate of the target resource is greater than the fifth preset threshold, the method and the device can enable the prepared resource to allocate the prepared resource to the container cluster to avoid the pod with higher priority being evicted when it is determined that the target resource in the container cluster has the shortage risk, so that the shortage risk of the target resource appearing in the container cluster is relieved or eliminated. In this case, the present invention can also adjust the second super-ratio to reduce it to the third super-ratio.
Specifically, the third super-ratio may be set by a technician according to an actual situation, which is not limited in the present invention, for example, the third super-ratio may be the first super-ratio.
Optionally, in other container clustering methods proposed in this embodiment, the present invention may control the pod through the controller. Specifically, one controller may control a plurality of pods correspondingly.
Specifically, if a pod does not have a corresponding controller, when the pod is evicted and is not restarted, the method can recycle the cluster resources occupied by the pod, and mark the node state of the container node where the pod is located before as an insufficient resource, such as nodes.
Specifically, if a pod has a corresponding controller, such as a depolyenzyme/stateful set controller, when the pod is evicted from a container node, the present invention may reconstruct the pod in other container nodes in the container cluster, recycle corresponding resources in an original container node where the pod is located, and mark a node state of the original container node as an insufficient resource, such as a node. At this time, if the controller corresponding to the pod is a deployment controller, the name of the pod may change when it is rebuilt in other container nodes; if the controller is a statefullset controller, the name of the pod may not change when it is rebuilt in other container nodes.
It should be noted that, in order to avoid the situation that the pod with a higher priority is evicted and affects the running service, the service responsible person needs to deeply understand the CPU and memory resource requirements of the job and fully estimate the service load. After the cluster over-allocation is started, operators should reserve part of resources corresponding to the over-allocation ratio in advance in a resource allocation stage, and when the service load is overlarge and the utilization rate of the cluster resources exceeds a recommended value, the over-allocation ratio can be timely adjusted back to an original value.
Optionally, in the other container cluster control method provided in this embodiment, the present invention may monitor resource usage of the container cluster for a long time, and provide data reference for capacity analysis and super-ratio regulation. The method can be combined with the resource scheduling theory of the container cluster (such as Kubernets), prometheus monitoring indexes and visual monitoring views, and can be used for calculating a reasonable super-proportion and resource regulation scheme according to long-time container cluster capacity analysis, so that the method is suitable for application systems needing long-term maintenance, and is low in development cost and low in scheme implementation difficulty.
It should be noted that the present invention can comprehensively plan the resource utilization condition of the whole cluster, allocate appropriate cluster resources to the pod for use, ensure that the resources are fully utilized, improve the resource utilization rate, and ensure that the important pod can obtain enough cluster resources in the operation period to stably operate. The invention can solve the pain point of low resource utilization rate of the container cluster from the source with universality and high efficiency, carries out reasonable resource allocation by monitoring the resource use condition of the cluster for a long time, and provides a reasonable and effective long-term regulation and control scheme for operation and maintenance personnel.
The container cluster control method provided in this embodiment may enable the prepared resource to allocate the prepared resource to the container cluster, and alleviate or eliminate the shortage risk of the target resource appearing in the container cluster, in order to avoid the pod with a higher priority from being evicted when it is determined that the target resource in the container cluster has the shortage risk.
Corresponding to the method shown in fig. 1, as shown in fig. 2, the present embodiment provides a first container cluster control apparatus, which may include: a first determination unit 101, a first judgment unit 102, a first obtaining unit 103, a second determination unit 104, and a first control unit 105; wherein: a first determining unit 101, configured to determine a cluster resource utilization rate of a container cluster for a target resource;
a first determining unit 102, configured to determine whether a cluster resource utilization rate is smaller than a first preset threshold, if so, trigger a first obtaining unit 103;
a first obtaining unit 103, configured to obtain a determination result whether the cluster resource allocation rate of the target resource is smaller than a second preset threshold;
a second determining unit 104 configured to determine a target control object and a resource control manner corresponding to the determination result;
the first control unit 105 is configured to perform corresponding control on the target control object according to a resource control manner, so as to improve the cluster resource utilization rate of the target resource.
It should be noted that, the first determining unit 101, the first judging unit 102, the first obtaining unit 103, the second determining unit 104, and the first control unit 105 may refer to steps S101, S102, S103, S104, and S105 in fig. 1, respectively, and the related description contents of the first determining unit 101, the first judging unit 102, the first obtaining unit 103, the second determining unit 104, and the first control unit 105 are not repeated in the present invention.
Optionally, the second determining unit 104 includes: a third determination unit and a fourth determination unit;
a third determining unit, configured to determine that the target control object is the total available resource amount of the container cluster if the determination result is that the cluster resource allocation rate of the target resource is smaller than a second preset threshold;
a fourth determining unit, configured to determine that the resource control manner is: the total amount of saleable resources is increased by increasing the currently set first super-ratio to the second super-ratio.
Optionally, the second determining unit 104 includes: a fifth determining unit and a sixth determining unit;
a fifth determining unit, configured to determine that the target control object is a request value of at least one pod if the determination result is that the cluster resource allocation rate of the target resource is not less than the second preset threshold;
a sixth determining unit, configured to determine that the resource control manner is to decrease the request value of at least one pod.
Optionally, the target resource is a memory, and the apparatus further includes: a seventh determining unit, an eighth determining unit, and an eviction unit;
a seventh determining unit, configured to determine, when the cluster resource allocation rate of the target resource is greater than a third preset threshold, a container node in the container cluster whose memory allocation rate is greater than a fourth preset threshold as a target container node;
an eighth determining unit, configured to prioritize, in the target container node, all the pods based on the quality of service level, and determine at least one pod with a lower priority as the target pod;
an eviction unit to evict the target pod.
Optionally, the apparatus further comprises: the device comprises a ninth determining unit, a second obtaining unit, a reading unit, a second control unit and a triggering unit;
a ninth determining unit configured to determine one of the target pods as a pod to be analyzed;
a second obtaining unit configured to obtain a configuration file of the pod to be analyzed;
the reading unit is used for reading the restart strategy of the pod to be analyzed from the configuration file of the pod to be analyzed;
the second control unit is used for carrying out corresponding control on the pod to be analyzed according to the restarting strategy of the pod to be analyzed after the pod to be analyzed is expelled;
and the triggering unit is used for triggering the ninth determining unit until the control of each pod in the target pod is finished according to the corresponding restarting strategy.
Optionally, the apparatus further comprises: a third obtaining unit, a distributing unit and an adjusting unit;
a third obtaining unit, configured to obtain a prepared resource matching the super-ratio;
the allocation unit is used for allocating at least part of the prepared resources to at least one container node in the container cluster when the cluster resource utilization rate is greater than a fifth preset threshold value so as to reduce the cluster resource utilization rate to be not greater than the fifth preset threshold value;
and the adjusting unit is used for adjusting the second super-allocation ratio to a third super-allocation ratio after the cluster resource utilization ratio is not greater than a fifth preset threshold value, wherein the third super-allocation ratio is smaller than the second super-allocation ratio.
The container cluster control apparatus provided in this embodiment may determine a cluster resource utilization rate of a container cluster for a target resource, determine whether the cluster resource utilization rate is smaller than a first preset threshold, if so, obtain a determination result whether a cluster resource allocation rate of the target resource is smaller than a second preset threshold, determine a target control object and a resource control manner corresponding to the determination result, perform corresponding control on the target control object according to the resource control manner, add a pod to a container node of the container cluster, allocate the target resource to the added pod, so as to increase a usage amount of the container cluster for the target resource, thereby increasing the cluster resource utilization rate of the container cluster for the target resource.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A container cluster control method, comprising:
determining the cluster resource utilization rate of the container cluster to the target resource;
judging whether the cluster resource utilization rate is smaller than a first preset threshold, if so, obtaining a judgment result whether the cluster resource allocation rate of the target resource is smaller than a second preset threshold;
determining a target control object and a resource control mode corresponding to the judgment result;
and correspondingly controlling the target control object according to the resource control mode so as to improve the cluster resource utilization rate of the target resource.
2. The container cluster control method according to claim 1, wherein the determining a target control object and a resource control method corresponding to the determination result includes:
if the judgment result is that the cluster resource allocation rate of the target resource is smaller than the second preset threshold, determining that the target control object is the total available resource amount of the container cluster, and determining that the resource control mode is as follows: increasing the total amount of saleable resources by increasing a currently set first super-ratio to a second super-ratio.
3. The container cluster control method according to claim 1, wherein the determining a target control object and a resource control method corresponding to the determination result includes:
and if the judgment result is that the cluster resource allocation rate of the target resource is not less than the second preset threshold, determining that the target control object is the request value of at least one pod, and determining that the resource control mode is to reduce the request value of at least one pod.
4. The container cluster control method according to claim 1, wherein the target resource is a memory, the method further comprising:
when the cluster resource allocation rate of the target resource is greater than a third preset threshold, determining a container node with the memory allocation rate greater than a fourth preset threshold in the container cluster as a target container node;
in the target container node, prioritizing all the pods based on the quality of service level, and determining at least one pod with a low priority order as a target pod;
evicting the target pod.
5. The container cluster control method according to claim 4, characterized in that the method further comprises:
determining one of the target pods as a pod to be analyzed;
obtaining a configuration file of the pod to be analyzed, and reading a restart strategy of the pod to be analyzed from the configuration file of the pod to be analyzed;
after the pod to be analyzed is expelled, correspondingly controlling the pod to be analyzed according to a restarting strategy of the pod to be analyzed;
and returning to the step of determining one of the target pods as the pod to be analyzed until the control of each pod in the target pods is finished according to the corresponding restart strategy.
6. The container cluster control method according to claim 2, characterized in that the method further comprises:
obtaining a prepared resource matched with the super-proportion;
when the cluster resource utilization rate is greater than a fifth preset threshold, allocating at least part of the prepared resources to at least one container node in the container cluster to reduce the cluster resource utilization rate to be not greater than the fifth preset threshold;
after the cluster resource utilization rate is not greater than the fifth preset threshold, adjusting the second super-allocation rate to a third super-allocation rate, wherein the third super-allocation rate is smaller than the second super-allocation rate.
7. A container cluster control apparatus, comprising: the device comprises a first determining unit, a first judging unit, a first obtaining unit, a second determining unit and a first control unit; wherein:
the first determining unit is configured to determine a cluster resource utilization rate of the container cluster for the target resource;
the first judging unit is configured to judge whether the cluster resource utilization rate is smaller than a first preset threshold, and if so, trigger the first obtaining unit;
the first obtaining unit is configured to obtain a determination result whether the cluster resource allocation rate of the target resource is smaller than a second preset threshold;
the second determining unit is used for determining a target control object and a resource control mode corresponding to the judgment result;
and the first control unit is used for correspondingly controlling the target control object according to the resource control mode so as to improve the cluster resource utilization rate of the target resource.
8. The container cluster control device according to claim 7, wherein the second determination unit includes: a third determination unit and a fourth determination unit;
the third determining unit is configured to determine that the target control object is a total available resource amount of the container cluster if the determination result indicates that the cluster resource allocation rate of the target resource is smaller than the second preset threshold;
the fourth determining unit is configured to determine that the resource control manner is: increasing the total amount of saleable resources by increasing a currently set first super-ratio to a second super-ratio.
9. The container cluster control device according to claim 7, wherein the second determination unit includes: a fifth determining unit and a sixth determining unit;
the fifth determining unit is configured to determine that the target control object is a request value of at least one pod if the determination result indicates that the cluster resource allocation rate of the target resource is not less than the second preset threshold;
the sixth determining unit is configured to determine that the resource control manner is to decrease the request value of at least one pod.
10. The container cluster control device of claim 7, wherein the target resource is a memory, the device further comprising: a seventh determining unit, an eighth determining unit, and an eviction unit;
the seventh determining unit is configured to determine, as a target container node, a container node in the container cluster whose memory allocation rate is greater than a fourth preset threshold when the cluster resource allocation rate of the target resource is greater than a third preset threshold;
the eighth determining unit is configured to, in the target container node, prioritize all the pods based on the quality of service level, and determine at least one pod with a lower priority as a target pod;
the eviction unit is configured to evict the target pod.
CN202111414286.4A 2021-11-25 2021-11-25 Container cluster control method and device Pending CN114153604A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111414286.4A CN114153604A (en) 2021-11-25 2021-11-25 Container cluster control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111414286.4A CN114153604A (en) 2021-11-25 2021-11-25 Container cluster control method and device

Publications (1)

Publication Number Publication Date
CN114153604A true CN114153604A (en) 2022-03-08

Family

ID=80457638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111414286.4A Pending CN114153604A (en) 2021-11-25 2021-11-25 Container cluster control method and device

Country Status (1)

Country Link
CN (1) CN114153604A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115168057A (en) * 2022-09-02 2022-10-11 浙江大华技术股份有限公司 Resource scheduling method and device based on k8s cluster

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115168057A (en) * 2022-09-02 2022-10-11 浙江大华技术股份有限公司 Resource scheduling method and device based on k8s cluster

Similar Documents

Publication Publication Date Title
US9405563B2 (en) Resource management method and apparatus for virtual machine system, and virtual machine system
US10719343B2 (en) Optimizing virtual machines placement in cloud computing environments
JP5417287B2 (en) Computer system and computer system control method
CN102479108B (en) Terminal resource management system for multi-application process embedded system and method
US8381215B2 (en) Method and system for power-management aware dispatcher
US8495646B2 (en) Resource allocation system, resource allocation method and program which flexibly introduces a service
US8656404B2 (en) Statistical packing of resource requirements in data centers
CN101122872B (en) Method and system for managing application program workload
CN111694633A (en) Cluster node load balancing method and device and computer storage medium
KR100956636B1 (en) System and method for service level management in virtualized server environment
CN112269641A (en) Scheduling method, scheduling device, electronic equipment and storage medium
WO2012056596A1 (en) Computer system and processing control method
CN111399986A (en) Method and device for configuring Pod resource quota
CN104508634A (en) Dynamic resource allocation for virtual machines
CN111258746B (en) Resource allocation method and service equipment
CN103823714A (en) Virtualization-based method and device for adjusting QoS (quality of service) of node memory of NUMA (non uniform memory access architecture)
US10423217B1 (en) Dynamic power capping of multi-server nodes in a chassis based on real-time resource utilization
CN109960591B (en) Cloud application resource dynamic scheduling method for tenant resource encroachment
CN108123980A (en) A kind of resource regulating method and system
CN114153604A (en) Container cluster control method and device
CN114389955A (en) Embedded platform heterogeneous resource pooling management method
CN107203256B (en) Energy-saving distribution method and device under network function virtualization scene
US9515905B1 (en) Management of multiple scale out workloads
CN111240824A (en) CPU resource scheduling method and electronic equipment
JP2006323872A (en) Preliminary resource provision method of logical partition and computer system

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