Container group scheduling method, electronic device and storage medium
By obtaining the scheduling policy group identification field of the container group in the scheduling system and selecting the target node, the problem of low scheduling of the container group is solved, and a more efficient resource utilization and flexible scheduling process is achieved.
Patent Information
- Application Number
- CN202010843925.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-20
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2040-08-20
AI Technical Summary
The method of dispatching container groups in existing scheduling systems results in low efficiency in cluster node resource use.
By obtaining the scheduling policy group identification field of the container group, find the target scheduling policy group from the scheduling policy group collection on the scheduling side, and select the target node from all nodes based on the policy group, and schedule the container group to run on the target node, allowing multiple Selection of individual scheduling policy groups for increased flexibility.
It improves the efficiency of cluster node resources and simplifies the scheduling process, so that there is no need to change the scheduling end name when it is necessary to change the scheduling policy group.
Smart Images

Figure CN112035248B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing, and in particular to a container group scheduling method, an electronic device, and a storage medium. Background Art
[0002] The scheduling system (Kubernetes, K8s) has complete cluster management capabilities, multi-level security protection and access mechanisms, multi-tenant application support capabilities, powerful fault detection and self-repair capabilities, and multi-granular resource quota management capabilities. It is the current mainstream container orchestration system. In the scheduling system, scheduling refers to scheduling container groups (pods) to appropriate nodes so that the pods can run on the nodes. However, the scheduling system uses the method of scheduling the container group by the scheduler / scheduling end (Scheduler) to make the use of cluster node resources inefficient. Summary of the invention
[0003] The present application provides a container group scheduling method, an electronic device and a storage medium, which can solve the problem that the method of scheduling a container group by a scheduler in the prior art makes the utilization efficiency of all node resources not high enough.
[0004] In order to solve the above technical problems, a technical solution adopted by the present application is to provide a container group scheduling method. The method includes: obtaining a container group; searching for a target scheduling policy group from a scheduling policy group set of a scheduling end based on an identification field of a scheduling policy group corresponding to the container group, wherein the scheduling policy group set of the scheduling end includes multiple scheduling policy groups; selecting a target node from all nodes based on the target scheduling policy group; and scheduling the container group to run on the target node.
[0005] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, which includes a processor and a memory connected to the processor, wherein the memory stores program instructions; the processor is used to execute the program instructions stored in the memory to implement the above method.
[0006] In order to solve the above technical problem, another technical solution adopted by the present application is: providing a storage medium storing program instructions, which can implement the above method when executed.
[0007] Through the above method, the scheduling end of the present application has multiple scheduling policy groups, and the obtained container group corresponds to the identification field of the scheduling policy group. The identification field of the scheduling policy group points to the scheduling policy group in the scheduling policy group set of the scheduling end. Therefore, the scheduling end can find the target scheduling policy group from the scheduling policy group set of the scheduling end based on the identification field of the scheduling policy group, and select the target node from all nodes based on the target scheduling policy group, and schedule the container group to run on the target node. Therefore, when the present application schedules the container group, the scheduling policy group it relies on is no longer fixed. Compared with the existing method in which a scheduling end has only one default scheduling policy group and can only use the default scheduling policy group to schedule the container group, it can improve the flexibility of the scheduling process, and thus improve the utilization efficiency of node resources in the cluster; and when it is necessary to replace the scheduling policy group used to select the target node, it only needs to replace the identification field of the scheduling policy group included in the container group without changing the scheduling end name, making the scheduling process more simple. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] Figure 1 It is a flowchart of the first embodiment of the container group scheduling method of the present application;
[0009] Figure 2 It is a structural diagram of the scheduling system of this application;
[0010] Figure 3 yes Figure 1 The specific process diagram of S12;
[0011] Figure 4 yes Figure 1 The specific process diagram of S13;
[0012] Figure 5 It is a flowchart of the second embodiment of the container group scheduling method of the present application;
[0013] Figure 6 yes Figure 5 The specific process diagram of S21;
[0014] Figure 7 It is a structural schematic diagram of an embodiment of a container group scheduling device of the present application;
[0015] Figure 8 It is a structural schematic diagram of an embodiment of the electronic device of the present application;
[0016] Fig. 9 It is a structural diagram of an embodiment of a storage medium of the present application. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0018] The terms "first", "second", and "third" in this application are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first", "second", and "third" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0019] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments without conflict.
[0020] Figure 1 1 is a flow chart of the first embodiment of the container group scheduling method of the present application. It should be noted that if there are substantially the same results, this embodiment does not use Figure 1 The process sequence shown is limited. Figure 1 As shown, this embodiment may include:
[0021] S11: Get a container group.
[0022] The execution subject of the embodiment of the present application is the scheduler. The scheduler may belong to the scheduling system (Kubernetes, K8s). Figure 2 In addition to the dispatching end, the dispatching system may also include an interface end (API Server), a database (ETCD), and a control end (Controller). Figure 2 The scheduling systems shown are only some examples.
[0023] A pod is a group of containers to be run. The pod obtained by the scheduler corresponds to the task / service created by the user. In other words, the container group is created based on the task / service. The following describes the creation of tasks and the creation process of the container group corresponding to the task:
[0024] When a user has a task requirement, he can instruct the user terminal he holds to display the user interface (web) by touching, pressing keys, speaking, etc., so that the user can create the required task in the user interface, wherein the task created by the user includes an identification field of the scheduling strategy group. After receiving the task created by the user, the user terminal can send it to the service terminal (service).
[0025] The server can store the task in the first database (database ETCD of the scheduling system) through the interface. That is, the server can send the task to the interface, and the interface can store the task in the first database in a standardized form. In addition, the server can also store the task in a local database (DB).
[0026] The controller can monitor (watchlist) the tasks stored in the first database through the interface. That is, the interface can send an instruction to the controller to prompt the controller that a task is coming, and the controller can respond to the instruction to obtain the task from the first database through the interface. The controller can create a corresponding container group for the obtained task, and the created container group and the task include the same scheduling policy group identification field, and the container group can be stored in the first database through the interface.
[0027] The scheduling end can monitor the container group in the first database through the interface end. That is, when the first database has a container group stored, the interface end can send an instruction to the scheduling end to prompt the scheduling end that a new container group is stored in the first database, and the scheduling end can respond to the instruction of the interface end to obtain the container group from the first database through the interface end.
[0028] For example, the tasks created by the user are as follows:
[0029]
[0030] The container group corresponds to an identification field of the scheduling policy group. The identification field of the scheduling policy group may include the scheduling policy group name selected by the user, that is, the user has selected the scheduling policy group, or may not include the scheduling policy group name selected by the user, that is, the user has not selected the scheduling policy group.
[0031] For example, the identification field of the scheduling policy group in the above container group is: "scpolicy / scpolicy":"scpolicy_test1", which includes the scheduling policy group name "scpolicy_test1" selected by the user.
[0032] When the user does not select a scheduling policy group, the identification field of the scheduling policy group is: "scpolicy / scpolicy":"", which does not include the name of the scheduling policy group.
[0033] S12: Based on the identification field of the scheduling policy group corresponding to the container group, a target scheduling policy group is searched from the scheduling policy group set of the scheduling end.
[0034] The scheduling policy group set of the scheduling end includes multiple scheduling policy groups.
[0035] The scheduling end stores a scheduling policy group set, which includes a default scheduling policy group and at least one non-default scheduling policy group. The non-default scheduling policy group is customized by the user according to the needs. The specific method of obtaining the non-default scheduling policy group is described in the following embodiments.
[0036] See also Figure 3 , S12 may include the following sub-steps:
[0037] S121: Find the scheduling policy group pointed to by the identification field of the scheduling policy group from the scheduling end scheduling policy group set.
[0038] As mentioned above, the identification field of the scheduling policy group may include the scheduling policy group name selected by the user, or may not include the scheduling policy group name selected by the user.
[0039] If the identification field of the scheduling policy group includes the name of the scheduling policy group selected by the user, it means that the identification field of the scheduling policy group found points to one scheduling policy group, that is, the scheduling policy group selected by the user. If the identification field of the scheduling policy group does not include the name of the scheduling policy group selected by the user, it means that the identification field of the scheduling policy group found points to multiple scheduling policy groups, that is, all the scheduling policy groups in the scheduling policy group set.
[0040] S122: Select one scheduling policy group from the scheduling policy groups pointed to by the identification field of the scheduling policy group as a target scheduling policy group.
[0041] In a specific implementation, if the identification field of the scheduling policy group points to one scheduling policy group, the scheduling policy group pointed to by the identification field of the scheduling policy group can be used as the target scheduling policy group; if the field of the container group points to multiple scheduling policy groups, one of the scheduling policy groups pointed to by the identification field of the scheduling policy group is selected as the target scheduling policy group.
[0042] Among them, when the scheduling policy group's identification field points to one scheduling policy group, the scheduling policy group pointed to by the scheduling policy group's identification field may be the default scheduling policy group or a non-default scheduling policy group. The scheduling policy group pointed to by the scheduling policy group's identification field can be directly used as the target scheduling policy group. For example, if the scheduling policy of the container group includes the scheduling policy group name "mytestAscPolicy" in the identification field, "mytestAscPolicy" is used as the target scheduling policy group.
[0043] When the identification field of the scheduling policy group points to multiple scheduling policy groups, the scheduling policy group pointed to by the identification field of the scheduling policy group is all the scheduling policy groups in the scheduling policy group set. One can be randomly selected from all scheduling policy groups as the target scheduling policy group, or one can be selected from all scheduling policy groups as the target scheduling policy group according to a preset rule (such as the priority of the scheduling policy group).
[0044] In another specific implementation, if the identification field of the scheduling policy group points to one scheduling policy group, the scheduling policy group pointed to by the identification field of the scheduling policy group is used as the target scheduling policy group; if the identification field of the scheduling policy group points to multiple scheduling policy groups, the default scheduling policy group in the scheduling policy group set is used as the target scheduling policy group. That is, in this way, if the identification field of the scheduling policy group points to multiple scheduling policy groups, no further selection is made from the multiple scheduling policy groups, but the default scheduling policy group is directly used as the target scheduling policy group.
[0045] S13: Select a target node from all nodes based on the target scheduling policy group.
[0046] The node referred to in this step is a workload node Node included in the cluster corresponding to the scheduling system. Multiple nodes may be included from all nodes. A node may be selected as a target node from all nodes included in the cluster based on the target scheduling policy group.
[0047] The target scheduling strategy group may include a pre-selected scheduling strategy combination and a preferred scheduling strategy combination. The pre-selected scheduling strategy combination may include multiple pre-selected scheduling strategies, and the preferred scheduling strategy combination may include multiple preferred scheduling strategies.
[0048] For example, "mytestAscPolicy" includes the following:
[0049]
[0050]
[0051] Among them, "predicates":[……] is the pre-selected scheduling strategy combination, and "priorities":[……] is the preferred scheduling strategy combination.
[0052] Please refer to Figure 4 , S13 may include the following sub-steps:
[0053] S131: Based on the pre-selected scheduling strategy combination, a pre-selected node set is selected from all nodes.
[0054] Each pre-selected scheduling strategy in the pre-selected scheduling strategy combination can be used to filter all nodes, and all nodes (pre-selected node set) that meet the scheduling requirements can be selected.
[0055] S132: Based on the optimal scheduling strategy combination, select a target node from the pre-selected node set.
[0056] Each preferred scheduling strategy in the preferred scheduling strategy combination is used to score the nodes in the pre-selected node set, and a node is selected as the target node according to the scoring result.
[0057] S14: Use the scheduling end to schedule the container group to run on the target node.
[0058] Through the implementation of this embodiment, the scheduling end of the present application has multiple scheduling policy groups, and the obtained container group corresponds to the identification field of the scheduling policy group. The identification field of the scheduling policy group points to the scheduling policy group in the scheduling policy group set of the scheduling end. Therefore, the scheduling end can find the target scheduling policy group from the scheduling policy group set of the scheduling end based on the identification field of the scheduling policy group, and select the target node from all nodes based on the target scheduling policy group, and schedule the container group to run on the target node. Therefore, when the present application schedules the container group, the scheduling policy group it relies on is no longer fixed. Compared with the existing method in which a scheduling end has only one default scheduling policy group and can only use the default scheduling policy group to schedule the container group, it can improve the flexibility of the scheduling process, and thus improve the utilization efficiency of node resources in the cluster; and when it is necessary to replace the scheduling policy group used to select the target node, it only needs to replace the identification field of the scheduling policy group included in the container group without changing the scheduling end name, making the scheduling process more simple.
[0059] Figure 5 2 is a flow chart of the second embodiment of the container group scheduling method of the present application. It should be noted that if there are substantially the same results, this embodiment does not use Figure 5 This embodiment is an extension of the first embodiment. Figure 5 As shown, before S12, this embodiment may include:
[0060] S21: Obtain a non-default scheduling policy group.
[0061] Non-default scheduling policy groups (Scolicy) can be customized by the user. Continue to refer to Figure 2 For explanation, the user can instruct the user terminal he holds to display the first interface through buttons, touch, voice, etc., and the user terminal can display the pre-stored scheduling strategy / scheduling policy group on the first interface, or can obtain the scheduling strategy / scheduling policy group stored in the first database of the server and display it on the first interface.
[0062] The user can create a scheduling policy group of his / her own needs based on the scheduling policy / scheduling policy group displayed on the first interface. The user end can send the scheduling policy group created by the user to the server end.
[0063] The server may store the scheduling policy group created by the user in a database. The database used to store the scheduling policy group may be a database of the scheduling system to which the scheduling end belongs (i.e., the first database), or a database outside the scheduling system to which the scheduling segment belongs (i.e., the second database), such as a key-value (KV) storage database redis.
[0064] In addition, the server can also store the scheduling policy group created by the user in the local database so that the user can select and view it when creating a scheduling policy group later.
[0065] The scheduling system can obtain the scheduling policy group (non-default scheduling policy group) created by the user from the stored database. Specifically, when the non-default scheduling policy group is stored in the first database, the scheduling end can obtain the non-default scheduling policy group from the first database; when the non-default scheduling policy group is stored in the second database, the scheduling end can obtain the non-default scheduling policy group from the second database.
[0066] In which, when the non-default scheduling policy group is stored in the second database, the scheduling end can obtain the non-default scheduling policy group based on the read and write logic of the second database.
[0067] See also Figure 6 In the case where the non-default scheduling policy group is stored in the first database included in the scheduling system itself, S21 may include the following sub-steps:
[0068] S211: Receive instructions sent by the interface end.
[0069] When the interface end receives a non-default scheduling group sent by the service end, the interface end may store the non-default scheduling group in the first database, and may also send an instruction to the scheduling end to inform the scheduling end that a non-default scheduling policy group is stored in the first database.
[0070] S212: Respond to the instruction to obtain a non-default scheduling policy group from the database.
[0071] The scheduling end may respond to the instruction of the interface end and obtain the non-default scheduling policy group from the first database through the interface end.
[0072] S22: Store the non-default second scheduling policy group.
[0073] Through the implementation of this embodiment, the scheduling end can obtain and store non-default / user-defined scheduling policy groups. Therefore, in the process of scheduling container groups, the scheduling end is not limited to scheduling container groups using the scheduling end's default scheduling policy group, but can also schedule container groups using non-default / user-defined scheduling policy groups, thereby improving the flexibility of the scheduling process and further improving the utilization efficiency of node resources in the cluster.
[0074] Figure 7 : is a structural diagram of an embodiment of a container group scheduling device of the present application, such as Figure 7 As shown, the container group scheduling device may include an acquisition module 31 , a search module 32 , a selection module 33 and a scheduling module 34 .
[0075] The acquisition module 31 is used to acquire the container group.
[0076] The search module 32 is used to search for a target scheduling policy group from a scheduling end scheduling policy group set based on an identification field of the scheduling policy group corresponding to the container group, wherein the scheduling policy group set of the scheduling end includes multiple scheduling policy groups.
[0077] The selection module 33 is used to select a target node from all nodes based on the target scheduling policy group.
[0078] The scheduling module 34 is used to schedule the container group to run on the target node.
[0079] For a detailed description of this embodiment, please refer to the previous method embodiment description, which will not be repeated here.
[0080] Figure 8 Schematic diagram of the structure of an embodiment of the electronic device of the present application. Figure 8 As shown, the electronic device includes a processor 41 and a memory 42 coupled to the processor.
[0081] The memory 42 stores program instructions for implementing the method of any of the above embodiments; the processor 41 is used to execute the program instructions stored in the memory 42 to implement the steps of the above method embodiments. The processor 41 may also be referred to as a CPU (Central Processing Unit). The processor 41 may be an integrated circuit chip with signal processing capabilities. The processor 41 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0082] Fig. 9 Schematic diagram of the structure of an embodiment of the storage medium of the present application. Fig. 9 As shown, the computer-readable storage medium 50 of the embodiment of the present application stores program instructions 51, and the program instructions 51 are executed to implement the method provided in the above embodiment of the present application. Among them, the program instructions 51 can form a program file and be stored in the above computer-readable storage medium 50 in the form of a software product, so that a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) executes all or part of the steps of each implementation method of the present application. The aforementioned computer-readable storage medium 50 includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical disks, or terminal devices such as computers, servers, mobile phones, and tablets.
[0083] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0084] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. The above is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the description and drawings of this application, or directly or indirectly used in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A container group scheduling method, characterized in that: include: Get container group; Based on the identification field of the scheduling policy group corresponding to the container group, a target scheduling policy group is searched from a scheduling policy group set of the scheduling end, wherein the scheduling policy group set of the scheduling end includes multiple scheduling policy groups, and the scheduling policy group set includes a default scheduling policy group and at least one non-default scheduling policy group; Based on the target scheduling policy group, selecting a target node from all nodes; Scheduling the container group to run on the target node; The step of searching for a target scheduling policy group from a scheduling policy group set of the scheduling end based on an identification field of the scheduling policy group corresponding to the container group includes: Find the scheduling policy group pointed to by the identification field of the scheduling policy group from the scheduling policy group set of the scheduling end; One of the scheduling policy groups pointed to by the identification field of the scheduling policy group is selected as the target scheduling policy group.
2. The method according to claim 1, characterized in that The selecting one of the scheduling policy groups pointed to by the identification field of the scheduling policy group as the target scheduling policy group includes: If the scheduling policy group pointed to by the identification field of the scheduling policy group is one, taking the scheduling policy group pointed to by the identification field of the scheduling policy group as the target scheduling policy group; If the identification field of the scheduling policy group points to multiple scheduling policy groups, one of the scheduling policy groups pointed to by the identification field of the scheduling policy group is selected as the target scheduling policy group.
3. The method according to claim 1, characterized in that The selecting one of the scheduling policy groups pointed to by the identification field of the scheduling policy group as the target scheduling policy group includes: If the scheduling policy group pointed to by the identification field of the scheduling policy group is one, the scheduling policy group pointed to by the field of the container group is used as the target scheduling policy group; If the identification field of the scheduling policy group points to multiple scheduling policy groups, the default scheduling policy group in the scheduling policy group set is used as the target scheduling policy group.
4. The method according to claim 1, characterized in that: Before searching the target scheduling policy group from the scheduling policy group set of the scheduling end based on the field of the container group, the method includes: Obtaining the non-default scheduling policy group; The non-default second scheduling policy group is stored.
5. The method according to claim 4, characterized in that Obtain the non-default scheduling policy group, including: Receive instructions sent by the interface end; In response to the instruction, the non-default scheduling policy group is obtained from a database.
6. The method according to claim 5, characterized in that The database is a database of the scheduling system to which the scheduling end belongs, or a database outside the scheduling system to which the scheduling end belongs.
7. The method according to claim 1, characterized in that The target scheduling strategy group includes a pre-selected scheduling strategy combination and a preferred scheduling strategy combination, and the scheduling end selects a target node from all the nodes based on the target scheduling strategy group, including: Based on the pre-selected scheduling strategy combination, selecting a pre-selected node set from all the nodes; Based on the preferred scheduling strategy combination, the target node is selected from the pre-selected node set.
8. A container group scheduling device, characterized in that: include: An acquisition module, used to acquire a container group; A search module, used to search for a target scheduling policy group from a scheduling policy group set of a scheduling end based on an identification field of the scheduling policy group corresponding to the container group, wherein the scheduling policy group set of the scheduling end includes multiple scheduling policy groups, and the scheduling policy group set includes a default scheduling policy group and at least one non-default scheduling policy group, and the search for a target scheduling policy group from the scheduling policy group set of the scheduling end based on the identification field of the scheduling policy group corresponding to the container group includes: searching for the scheduling policy group pointed to by the identification field of the scheduling policy group from the scheduling policy group set of the scheduling end; and selecting one from the scheduling policy groups pointed to by the identification field of the scheduling policy group as the target scheduling policy group; A selection module, configured to select a target node from all nodes based on the target scheduling policy group; The scheduling module is used to schedule the container group to run on the target node.
9. An electronic device, characterized in that: The method comprises a processor and a memory connected to the processor, wherein: The memory stores program instructions; The processor is configured to execute the program instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores program instructions, and when the program instructions are executed, the method according to any one of claims 1 to 7 is implemented.
