K8s cluster adaptive scheduling method and device, computer equipment and storage medium

By dynamically adjusting the weight configuration of the Kubernetes scheduling module, the problem that traditional scheduling methods cannot adapt to task diversity is solved, efficient resource utilization and scheduling optimization is achieved, and the stability and expansion capabilities of the system are improved.

CN119806833APending Publication Date: 2025-04-11E-SURFING DIGITAL LIFE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411911113.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The traditional Kubernetes scheduling method relies on a fixed weight scoring mechanism and cannot adapt to the diversity of task requirements, resulting in problems such as reduced scheduling efficiency and uneven resource utilization in specific scenarios.

Method used

A k8s cluster adaptive scheduling method is provided, which dynamically adjusts the weight configuration of the resource balance module, the mirror priority module and the resource minimum allocation module, and schedules according to task requests and node resource status.

Benefits of technology

Automatic optimization scheduling for different task requests is realized, resource utilization is improved, resource allocation is optimized, resource waste and delay are avoided, efficient system operation is ensured, task stability and system elastic expansion capabilities are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806833A_ABST
    Figure CN119806833A_ABST
Patent Text Reader

Abstract

The invention relates to a k8s cluster adaptive scheduling method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: generating an execution unit in a k8s cluster according to a task request; obtaining an execution unit attribute, and according to the execution unit attribute, setting weight configuration of a resource balancing module, a mirror image priority module and a resource minimum allocation module of the k8s cluster to obtain an updated scheduling parameter; and performing node allocation on the execution unit based on the updated scheduling parameter, and starting the execution unit to run the task at the allocated node. By dynamically adjusting the weight configuration of the resource balancing module, the mirror image priority module and the minimum resource allocation module, the problem of node resource overload or idleness is effectively reduced, and efficient operation of the system is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a k8s cluster adaptive scheduling method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] With the development of cloud computing technology, the deployment and management of containerized applications has gradually become a hot technology. Kubernetes (K8S), as a widely used container orchestration technology, has flexible resource management and efficient scheduling capabilities, and performs well in supporting application expansion and disaster recovery. In the Kubernetes architecture, the scheduler, as a core component, has functions such as resource quota management, mandatory policy verification, and dynamic configuration. It selects the most suitable running node for Pod (the smallest deployable computing unit in Kubernetes) by combining multiple factors.

[0003] Traditional scheduling methods usually rely on a fixed-weight scoring mechanism to select target nodes based on factors such as resource allocation balance, image cache status, and node utilization. However, due to the fixed scoring weights, it is unable to adapt to the diversity of task requirements, resulting in reduced scheduling efficiency and low resource utilization in specific scenarios. For example, when processing tasks with large differences in resource requirements, it may not be possible to flexibly match node performance; and in tasks involving large images, failure to fully consider the image distribution may lead to resource waste and increased latency. Summary of the invention

[0004] Based on this, it is necessary to provide a k8s cluster adaptive scheduling method, device, computer equipment, computer-readable storage medium and computer program product that can dynamically adjust the strategy of allocating nodes of the execution unit according to the state of the k8s cluster and the state of the execution unit to achieve refined scheduling in response to the above technical problems.

[0005] In a first aspect, the present application provides a k8s cluster adaptive scheduling method. The method includes:

[0006] Generate execution units in the k8s cluster according to task requests;

[0007] Get the execution unit attributes, and set the weight configuration of the resource balancing module, image priority module, and minimum resource allocation module of the k8s cluster according to the execution unit attributes to obtain the updated scheduling parameters;

[0008] The execution units are allocated to nodes based on the updated scheduling parameters, and the execution units are started to run tasks on the allocated nodes.

[0009] In one embodiment, after generating an execution unit in a k8s cluster according to a task request, the following steps are included:

[0010] Determine whether the exclusive resource pool of the execution unit is full and generate the initial scheduling parameters of the k8s cluster;

[0011] When the dedicated resource pool is sufficient, the initial scheduling parameters are evenly allocated by the resource balancing module, the image priority module, and the resource minimum allocation module;

[0012] When the dedicated resource pool is insufficient, the weight of the least resource allocation module in the initial scheduling parameters is increased so that the weight of the least resource allocation module is greater than the weights of the resource balancing module and the mirror priority module.

[0013] In one embodiment, allocating nodes to execution units based on updated scheduling parameters, and starting execution units to run tasks on the allocated nodes includes:

[0014] Determine the relationship between the image capacity and the preset capacity when running the execution unit;

[0015] When the image capacity is greater than the preset capacity, the weight configurations of the resource balancing module, image priority module, and resource minimum allocation module of the k8s cluster are set according to the properties of the execution unit to obtain updated scheduling parameters;

[0016] When the mirror capacity is not greater than the preset capacity, the priority of the module with the least resource allocation in the scheduling parameters is increased, so that the module with the least resource allocation has priority in obtaining the updated scheduling parameters.

[0017] In one of the embodiments, when the image capacity is greater than the preset capacity, the weight of the resource balancing module is increased, and the weights of the image priority module and the minimum resource allocation module are reduced on the basis of the initial scheduling parameters.

[0018] In one of the embodiments, when the mirror capacity is not greater than the preset capacity, scheduling is performed with the initial scheduling parameters.

[0019] In one of the embodiments, the attributes of the execution unit include resource requirements, storage requirements, and image attributes of the execution unit.

[0020] In the second aspect, the present application also provides a k8s cluster adaptive scheduling device. The device includes:

[0021] The request module is used to generate execution units in the k8s cluster according to task requests;

[0022] The parameter update module is used to obtain the execution unit attributes, and according to the execution unit attributes, set the weight configuration of the resource balancing module, image priority module and resource minimum allocation module of the k8s cluster to obtain the updated scheduling parameters;

[0023] The allocation module is used to allocate nodes to execution units based on the updated scheduling parameters, and start the execution units to run tasks on the allocated nodes.

[0024] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0025] Generate an execution unit on the management platform according to the task request;

[0026] Obtain the execution unit attributes, and according to the execution unit attributes, set the weight configuration of the resource balancing module, the image priority module, and the resource minimum allocation module of the management platform to obtain the updated scheduling parameters;

[0027] The execution units are allocated to nodes based on the updated scheduling parameters, and the execution units are started to run tasks on the allocated nodes.

[0028] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0029] Generate an execution unit on the management platform according to the task request;

[0030] Obtain the execution unit attributes, and according to the execution unit attributes, set the weight configuration of the resource balancing module, the image priority module, and the resource minimum allocation module of the management platform to obtain the updated scheduling parameters;

[0031] The execution units are allocated to nodes based on the updated scheduling parameters, and the execution units are started to run tasks on the allocated nodes.

[0032] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0033] Generate an execution unit on the management platform according to the task request;

[0034] Obtain the execution unit attributes, and according to the execution unit attributes, set the weight configuration of the resource balancing module, the image priority module, and the resource minimum allocation module of the management platform to obtain the updated scheduling parameters;

[0035] The execution units are allocated to nodes based on the updated scheduling parameters, and the execution units are started to run tasks on the allocated nodes.

[0036] The above-mentioned k8s cluster adaptive scheduling method, device, computer equipment, storage medium and computer program product realize automatic optimization scheduling for different task requests by dynamically adjusting the weight configuration of the resource balancing module, the image priority module and the resource minimum allocation module. By obtaining the resource requirements, storage requirements and image properties of the execution unit, the k8s cluster can reasonably allocate computing resources according to the characteristics of the task and improve resource utilization. At the same time, it can dynamically adjust the module priority according to factors such as the image size, schedule to the appropriate node, optimize resource allocation, and avoid resource waste and delay. Dynamic adjustment according to the status of node resources effectively reduces the problem of node resource overload or idleness, ensures the efficient operation of the system, and thus improves the task stability and the elastic expansion capability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 This is an application environment diagram of a k8s cluster adaptive scheduling method in an embodiment;

[0038] Figure 2 A schematic diagram of a flow chart of a k8s cluster adaptive scheduling method in one embodiment;

[0039] Figure 3 A schematic diagram of a flow chart of a k8s cluster adaptive scheduling method in another embodiment;

[0040] Figure 4 It is a structural block diagram of a k8s cluster adaptive scheduling device in one embodiment;

[0041] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0043] The k8s cluster adaptive scheduling method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0044] In one embodiment, Figure 2 As shown, a k8s cluster adaptive scheduling method is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:

[0045] Step 202: Generate an execution unit in the k8s cluster according to the task request.

[0046] Among them, the execution unit refers to the computing or resource instance generated by the k8s cluster for carrying and executing specific tasks, usually in the form of containers or virtual machines. Task request refers to an operation requirement or running instruction submitted by a user, system or application to the k8s cluster, which usually contains the relevant information and resource requirements required to execute a specific task. It is the starting point of the k8s cluster scheduling process and is used to trigger the generation of executable execution units.

[0047] Step 204, obtain the execution unit attributes, and set the weight configuration of the resource balancing module, the image priority module and the resource minimum allocation module of the k8s cluster according to the execution unit attributes to obtain the updated scheduling parameters.

[0048] Among them, the resource balancing module is used to balance the resource utilization between nodes during the scheduling process to prevent node overload or resource waste; for example, it calculates the difference in the proportion of CPU and memory usage on the node and gives a score. The higher the score, the more balanced the resource allocation. The image priority module is used to give priority to nodes where images already exist or have lower transmission costs based on the size of the image required by the execution unit and the availability of the image on the node; for example, it prefers nodes that have cached container images to reduce image pulling time. The resource minimum allocation module aims to minimize the allocation of new resources, prioritizes scheduling to nodes with less resource usage, selects nodes with the lowest resource utilization for scheduling, and balances resource usage between nodes. The scheduling parameters are used to guide the k8s cluster to select key configuration values ​​for nodes, including the weight allocation of the resource balancing module, the image priority module, and the resource minimum allocation module.

[0049] Step 206: Allocate nodes to the execution units based on the updated scheduling parameters, and start the execution units to run tasks on the allocated nodes.

[0050] Among them, a node is a carrier of physical resources or virtualized resources that performs specific tasks (such as running containers and executing workloads).

[0051] Exemplarily, the k8s cluster is Kubernetes (k8s, an open source platform for managing containerized applications), which can provide the ability to automatically deploy, expand and manage containerized applications. When a task request is submitted through Kubernetes, after Kubernetes receives the task request, it creates an execution unit pod (the smallest logical unit for task operation) in Kubernetes according to the amount of resources required by the task (such as CPU, memory, storage and image information, etc.). After Kubernetes generates the pod, it analyzes the properties of the pod. According to the extracted execution unit properties, Kubernetes dynamically adjusts the weights of the resource balancing module, the image priority module and the minimum resource allocation module through scheduling rules: if the resource demand of the pod is high, it tends to give priority to adjusting the weight of the resource balancing module to achieve balanced allocation between nodes; if the image file is large, the weight of the image priority module is given priority to reduce the image transmission delay; if the resource demand is low, the weight of the minimum resource allocation module is increased so that the task is preferentially allocated to the node with low resource utilization. Based on the updated scheduling parameters, the Kubernetes scheduler selects a node that meets the conditions and allocates the execution unit to the node.

[0052] In the above-mentioned k8s cluster adaptive scheduling method, automatic optimization scheduling for different task requests is achieved by dynamically adjusting the weight configuration of the resource balancing module, the image priority module, and the resource minimum allocation module. By obtaining the resource requirements, storage requirements, and image properties of the execution unit, the k8s cluster can reasonably allocate computing resources according to the characteristics of the task and improve resource utilization. At the same time, it can dynamically adjust the module priority according to factors such as the image size, schedule to the appropriate node, optimize resource allocation, and avoid resource waste and delays; dynamic adjustment according to the status of node resources effectively reduces the problem of node resource overload or idleness, ensures the efficient operation of the system, and thus improves the task stability and the elastic expansion capability of the system.

[0053] In one embodiment, after generating an execution unit in a k8s cluster according to a task request, the method includes: determining whether an exclusive resource pool of the execution unit is sufficient, and generating initial scheduling parameters of the k8s cluster; when the exclusive resource pool is sufficient, the initial scheduling parameters are evenly distributed among a resource balancing module, a mirror priority module, and a minimum resource allocation module; when the exclusive resource pool is insufficient, the weight of the minimum resource allocation module in the initial scheduling parameters is increased, so that the weight of the minimum resource allocation module is greater than the weights of the resource balancing module and the mirror priority module.

[0054] Among them, the dedicated resource pool is a group of nodes, node pools, and dedicated node groups specially allocated to specific workloads or tenants, isolating different types of workloads or users, ensuring the dedicatedness and isolation of resources to meet performance, compliance, security and other requirements.

[0055] Specifically, the execution unit attributes are obtained. According to the execution unit attributes, the execution unit attributes include the resource requirements, storage requirements, and image attributes of the execution unit. After the simple implementation of Kubernetes' admission control, it is packaged into a docker image (Docker Image, a lightweight, independent and executable software package that contains all the content required to run an application, including code, runtime, libraries, environment variables, and configuration files), and the packaged docker image is deployed in the form of Deployment. Among them, Deployment is a controller in Kubernetes that is used to declaratively manage and maintain the deployment and life cycle of applications; through Deployment, the number of Pods, image versions, update policies, etc. can be defined, and Kubernetes can ensure that the application always runs in the expected state.

[0056] After the execution unit pod is generated, Kubernetes checks the status of the exclusive resource pool of the current execution unit. When the computing resources in the exclusive resource pool are sufficient, the Kubernetes scheduler sets the weights of the resource balancing module, image priority module, and minimum resource allocation module in the initial scheduling parameters to be equal; when the computing resources in the exclusive resource pool are insufficient, the Kubernetes scheduler sets resource priority and increases the priority of the minimum resource allocation module in the initial scheduling parameters, so that the weight of the minimum resource allocation module in the initial scheduling parameters is greater than the weights of the resource balancing module and the image priority module.

[0057] In this embodiment, after the execution unit is generated, the initial scheduling parameters are dynamically adjusted by judging the adequacy of the exclusive resource pool, which can flexibly adapt to the resource requirements in different task scenarios; not only the adaptability of the scheduling strategy is enhanced, but also computing, storage and network resources can be reasonably allocated under different task loads, thereby further optimizing resource allocation efficiency and node operation performance, which can effectively reduce task execution delays and improve the timeliness of task completion in practical applications.

[0058] In one embodiment, node allocation is performed on the execution unit based on the updated scheduling parameters, and the execution unit running task is started on the allocated node, including: determining the relationship between the image capacity and the preset capacity when running the execution unit; when the image is larger than the preset capacity, according to the properties of the execution unit, setting the weight configuration of the resource balancing module, the image priority module and the minimum resource allocation module of the k8s cluster to obtain the updated scheduling parameters; when the image capacity is not larger than the preset capacity, increasing the priority of the minimum resource allocation module in the scheduling parameters, and obtaining the updated scheduling parameters with the minimum resource allocation module as the priority.

[0059] Among them, image capacity refers to the size of the container image file that the execution unit depends on. The image file contains the operating system, application and its dependent environment required to execute the task. The capacity will affect the loading speed and the use of node resources. The preset capacity is the image size threshold set by the k8s cluster based on experience or system configuration. It is used to distinguish images of different sizes and optimize the corresponding scheduling strategy.

[0060] Exemplarily, when the pod's exclusive resource pool is sufficient, the Kubernetes scheduler sets the weights of the resource balancing module, image priority module and minimum resource allocation module in the initial scheduling parameters to be equal, such as setting the weights of the resource balancing module, image priority module and minimum resource allocation module to 1; when the pod's exclusive resource pool is sufficient, the Kubernetes scheduler is set to resource priority, increases the priority of the minimum resource allocation module in the initial scheduling parameters, and makes the weight of the minimum resource allocation module in the initial scheduling parameters greater than the weights of the resource balancing module and the image priority module, such as the weight of the resource balancing module is 0.5, the weight of the image priority module is 0.5 and the weight of the minimum resource allocation module is 2.

[0061] Further determine the relationship between the image capacity and the preset capacity. When the image capacity is greater than the preset capacity, dynamically adjust the weight configuration of each scheduling module in the k8s cluster according to the attributes of the execution unit, such as the resource requirements, storage requirements and image loading characteristics of the execution unit. Specifically, increase the weight of the resource balancing module to better allocate system resources and reduce the impact of large-capacity image loading on the overall system performance. At the same time, reasonably reduce the weight of the image priority module and the least resource allocation module, so as to obtain the updated scheduling parameters adapted to the current execution unit. When the image capacity is not greater than the preset capacity, increase the priority of the least resource allocation module in the scheduling parameters, and give priority to the least resource allocation module to obtain the updated scheduling parameters. If the judgment result shows that the image capacity is not greater than the preset capacity, increase the priority of the least resource allocation module in the scheduling parameters. By increasing the weight of the least resource allocation module, give priority to nodes that occupy less system resources to avoid excessive resource consumption of the system; appropriately reduce the weight configuration of the resource balancing module and the image priority module, optimize the task scheduling process, and improve the overall execution efficiency.

[0062] In this embodiment, the scheduling parameters are dynamically adjusted according to the relationship between the image capacity of the execution unit and the preset capacity, thereby improving the flexibility and efficiency of resource allocation; when the image capacity is greater than the preset capacity, the system can optimize the weighted balancing configuration of the resource balancing module, the image priority module and the resource minimum allocation module according to the properties of the execution unit to ensure that the high-capacity image can run smoothly on a suitable node; and when the image capacity is less than the preset capacity, the priority of the resource minimum allocation module is increased to ensure maximum resource utilization and avoid node overload; not only the resource utilization of the node is improved, but also the stability of task execution is enhanced, the waste of system resources is reduced, and the resource scheduling strategy of the k8s cluster is effectively optimized.

[0063] In one embodiment, when the image capacity is greater than the preset capacity, based on the initial scheduling parameters, the weight of the resource balancing module is increased, and the weights of the image priority module and the resource minimum allocation module are reduced. When the image is not greater than the preset capacity, based on the initial scheduling parameters, the weight of the resource balancing module is reduced, and the weights of the image priority module and the resource minimum allocation module are increased.

[0064] Exemplarily, when the pod's exclusive resource pool is sufficient, the Kubernetes scheduler sets the weights of the resource balancing module, image priority module and minimum resource allocation module in the initial scheduling parameters to be equal, such as setting the weights of the resource balancing module, image priority module and minimum resource allocation module to 1; when the pod's exclusive resource pool is insufficient, the Kubernetes scheduler is set to resource priority, increases the priority of the minimum resource allocation module in the initial scheduling parameters, and makes the weight of the minimum resource allocation module in the initial scheduling parameters greater than the weights of the resource balancing module and the image priority module, such as the weight of the resource balancing module is 0.5, the weight of the image priority module is 0.5 and the weight of the minimum resource allocation module is 2.

[0065] Determine the size relationship between the image capacity and the preset capacity, taking the preset capacity of 1G as an example. When the image capacity is greater than the preset capacity and the exclusive resource pool of the execution unit is insufficient, on the basis of the initial scheduling parameters, increase the weight of the resource balancing module, and reduce the weights of the image priority module and the minimum resource allocation module. For example, the updated parameters are that the weight of the resource balancing module is 0.5, the weight of the image priority module is 1, and the weight of the minimum resource allocation module is 2. When the image capacity is not greater than the preset capacity and the exclusive resource pool of the execution unit is insufficient, schedule with the initial scheduling parameters, that is, the weight of the resource balancing module is 0.5, the weight of the image priority module is 0.5, and the weight of the minimum resource allocation module is 2.

[0066] When the image capacity is greater than the preset capacity and the exclusive resource pool of the execution unit is sufficient, the weight of the image priority module is increased on the basis of the initial scheduling parameters, such as the weight of the resource balancing module is 1, the weight of the image priority module is 2, and the weight of the minimum resource allocation module is 1; when the image capacity is not greater than the preset capacity and the exclusive resource pool of the execution unit is sufficient, scheduling is performed with the initial scheduling parameters, that is, the weights of the resource balancing module, the image priority module, and the minimum resource allocation module are all set to 1.

[0067] In this embodiment, the weight configurations of the resource balancing module, the image priority module, and the minimum resource allocation module can be dynamically adjusted according to the size of the image capacity and the status of the exclusive resource pool, so as to achieve flexible optimization of the scheduling strategy, help reduce the task startup time, improve the scheduling efficiency and the overall operating performance of the system, and effectively meet the diverse resource scheduling needs in different scenarios.

[0068] In one embodiment, Figure 3 As shown, a k8s cluster adaptive scheduling method is provided, including the following steps:

[0069] Step 302: Generate an execution unit in the k8s cluster according to the task request.

[0070] Step 304, determine whether the exclusive resource pool of the execution unit is full, and generate the initial scheduling parameters of the k8s cluster.

[0071] Step 306: When the dedicated resource pool is sufficient, the initial scheduling parameters are evenly distributed by the resource balancing module, the mirroring priority module and the resource minimum allocation module.

[0072] Step 308: When the dedicated resource pool is insufficient, increase the weight of the least resource allocation module in the initial scheduling parameters so that the weight of the least resource allocation module is greater than the weights of the resource balancing module and the mirror priority module.

[0073] Step 310, obtain the execution unit attributes, and set the weight configuration of the resource balancing module, image priority module and resource minimum allocation module of the k8s cluster according to the execution unit attributes to obtain updated scheduling parameters.

[0074] Step 312, determining the relationship between the image capacity and the preset capacity when running the execution unit.

[0075] Step 314, when the image capacity is greater than the preset capacity, the weight configurations of the resource balancing module, the image priority module and the resource minimum allocation module of the k8s cluster are set according to the properties of the execution unit to obtain updated scheduling parameters.

[0076] Step 316: When the image capacity is greater than the preset capacity, based on the initial scheduling parameters, the weight of the resource balancing module is increased, and the weights of the image priority module and the minimum resource allocation module are reduced.

[0077] Step 318: When the mirror capacity is not greater than the preset capacity, the priority of the module with the least resource allocation in the scheduling parameters is increased so that the module with the least resource allocation has priority in obtaining the updated scheduling parameters.

[0078] Step 302: When the mirror capacity is not greater than the preset capacity, scheduling is performed with the initial scheduling parameters.

[0079] Step 320: allocate nodes to execution units based on the updated scheduling parameters, and start the execution units to run tasks on the allocated nodes.

[0080] In this embodiment, by dynamically adjusting the weight configuration of the resource balancing module, the image priority module, and the resource minimum allocation module, automatic optimization scheduling for different task requests is achieved. By obtaining the resource requirements, storage requirements, and image properties of the execution unit, the k8s cluster can reasonably allocate computing resources according to the characteristics of the task and improve resource utilization. At the same time, the module priority can be dynamically adjusted according to factors such as the image size, and the module can be scheduled to the appropriate node to optimize resource allocation and avoid resource waste and delay. Dynamic adjustment based on the status of node resources effectively reduces the problem of node resource overload or idleness, ensures the efficient operation of the system, and thus improves the task stability and the elastic expansion capability of the system.

[0081] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are shown in sequence, these steps are not necessarily executed in sequence in the order indicated. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.

[0082] Based on the same inventive concept, the embodiment of the present application also provides a k8s cluster adaptive scheduling device for implementing the k8s cluster adaptive scheduling method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more k8s cluster adaptive scheduling device embodiments provided below can refer to the limitations of the k8s cluster adaptive scheduling method above, and will not be repeated here.

[0083] In one embodiment, Figure 4 As shown, a k8s cluster adaptive scheduling device is provided, including: a request module 402, a parameter update module 404 and an allocation module 406, wherein:

[0084] The request module 402 is used to generate an execution unit in the k8s cluster according to the task request.

[0085] The parameter updating module 404 is used to obtain the execution unit attributes, and according to the execution unit attributes, set the weight configuration of the resource balancing module, the image priority module and the resource minimum allocation module of the k8s cluster to obtain the updated scheduling parameters.

[0086] The allocation module 406 is used to allocate nodes to the execution units based on the updated scheduling parameters, and start the execution units to run tasks on the allocated nodes.

[0087] In one embodiment, the apparatus further comprises:

[0088] The initial parameter module is used to determine whether the exclusive resource pool of the execution unit is full and generate the initial scheduling parameters of the k8s cluster.

[0089] The first sub-allocation module is used for evenly allocating the initial scheduling parameters of the resource balancing module, the mirror priority module and the resource minimum allocation module when the dedicated resource pool is sufficient.

[0090] The second sub-allocation module is used to increase the weight of the least resource allocation module in the initial scheduling parameters when the exclusive resource pool is insufficient, so that the weight of the least resource allocation module is greater than the weights of the resource balancing module and the mirror priority module.

[0091] In one embodiment, the allocation module 406 includes:

[0092] The comparison module is used to determine the relationship between the image capacity and the preset capacity when running the execution unit.

[0093] The first update module is used to set the weight configuration of the resource balancing module, the image priority module and the resource minimum allocation module of the k8s cluster according to the properties of the execution unit when the image capacity is greater than the preset capacity, so as to obtain the update scheduling parameters.

[0094] The second updating module is used to increase the priority of the least resource allocation module in the scheduling parameters when the mirror capacity is not greater than the preset capacity, so that the least resource allocation module obtains the updated scheduling parameters first.

[0095] In one embodiment, the apparatus further comprises:

[0096] The first sub-update module is used to increase the weight of the resource balancing module and reduce the weight of the image priority module and the resource minimum allocation module based on the initial scheduling parameters when the image capacity is greater than the preset capacity.

[0097] In one embodiment, the apparatus further comprises:

[0098] The second sub-update module performs scheduling with the initial scheduling parameters when the image capacity is not greater than the preset capacity.

[0099] In one embodiment, the apparatus further comprises:

[0100] The attribute module is used for the attributes of the execution unit, including the resource requirements, storage requirements and image attributes of the execution unit.

[0101] Each module in the above-mentioned k8s cluster adaptive scheduling device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0102] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a k8s cluster adaptive scheduling method is implemented.

[0103] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0104] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0105] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0106] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0107] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0108] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0109] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0110] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A k8s cluster adaptive scheduling method, characterized in that: The method comprises: Generate execution units in the k8s cluster according to task requests; Obtain the execution unit attributes, and according to the execution unit attributes, set the weight configurations of the resource balancing module, the image priority module, and the resource minimum allocation module of the k8s cluster to obtain updated scheduling parameters; The execution unit is allocated to a node based on the updated scheduling parameters, and the execution unit is started to run the task at the allocated node.

2. The method according to claim 1, characterized in that After generating the execution unit in the k8s cluster according to the task request, the following steps are included: Determine whether the exclusive resource pool of the execution unit is full, and generate the initial scheduling parameters of the k8s cluster; In the case where the dedicated resource pool is sufficient, the initial scheduling parameters are evenly distributed by the resource balancing module, the mirror priority module and the resource minimum allocation module; In the case that the dedicated resource pool is insufficient, the weight of the least resource allocation module in the initial scheduling parameters is increased so that the weight of the least resource allocation module is greater than the weights of the resource balancing module and the mirror priority module.

3. The method according to claim 2, characterized in that The step of allocating nodes to the execution units based on the updated scheduling parameters and starting the execution units to run tasks on the allocated nodes includes: Determine the relationship between the image capacity and the preset capacity when running the execution unit; When the image capacity is greater than the preset capacity, according to the properties of the execution unit, the weight configurations of the resource balancing module, the image priority module and the resource minimum allocation module of the k8s cluster are set to obtain updated scheduling parameters; When the mirror capacity is not greater than the preset capacity, the priority of the module with the least resource allocation in the scheduling parameters is increased so that the module with the least resource allocation has priority in obtaining the updated scheduling parameters.

4. The method according to claim 3, characterized in that When the mirror capacity is greater than the preset capacity, the weight of the resource balancing module is increased, and the weights of the mirror priority module and the minimum resource allocation module are reduced on the basis of the initial scheduling parameters.

5. The method according to claim 3, characterized in that: When the mirror capacity is not greater than the preset capacity, scheduling is performed with the initial scheduling parameters.

6. The method according to claim 1, characterized in that The attributes of the execution unit include resource requirements, storage requirements and mirroring attributes of the execution unit.

7. A k8s cluster adaptive scheduling device, characterized in that: The device comprises: The request module is used to generate execution units in the k8s cluster according to task requests; A parameter updating module is used to obtain the execution unit attributes, and according to the execution unit attributes, set the weight configuration of the resource balancing module, the image priority module and the resource minimum allocation module of the k8s cluster to obtain updated scheduling parameters; The allocation module is used to allocate nodes to the execution units based on the updated scheduling parameters, and start the execution units to run tasks on the allocated nodes.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.