Container scheduling method and device, storage medium and electronic equipment
By identifying and selecting suitable real-time nodes for container scheduling in the real-time operating system, the lack of real-time container scheduling and node management in the prior art is solved, and unified management and efficient resource utilization of real-time systems are realized.
Patent Information
- Application Number
- CN202411130374.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-20
AI Technical Summary
The lack of real-time container scheduling and real-time node management solutions in the prior art leads to poor universality of real-time systems.
Provide a container scheduling method and device, by determining that the container is a real-time or non-real-time container when receiving a target creation instruction, and identifying a real-time node from the target cluster, selecting a suitable real-time node according to resource type, utilization rate and priority rules. Container scheduling is performed to ensure that real-time containers start immediately when resources are available.
It realizes unified management of real-time container applications, non-real-time container applications, real-time nodes and non-real-time nodes, improves the overall performance and resource utilization efficiency of the real-time system, and solves the technical problems of real-time container scheduling and node management.
Smart Images

Figure CN119166275A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of real-time operating systems, and in particular to a container scheduling method, device, storage medium, and electronic device. Background Art
[0002] Real-time systems, especially real-time operating systems (RTOS), play a vital role in the current scientific and technological field. They are widely used to handle application scenarios that need to respond to external inputs within a specified time, such as medical equipment, aerospace, industrial automation and other fields, which have extremely high requirements for system reliability and real-time performance. Real-time containers realize unified encapsulation of applications based on real-time systems, solving the problem of rapid distribution and deployment of real-time system applications. However, there are few real-time container scheduling and real-time node management solutions for real-time systems on the market, and their versatility is poor. Summary of the invention
[0003] The present application provides a container scheduling method, device, storage medium and electronic device to solve the technical problem of lack of real-time container scheduling and real-time node management solutions in the prior art.
[0004] In a first aspect, the present application provides a container scheduling method, comprising: upon receiving a target creation instruction for creating a target container in a target cluster, determining whether the target container is a non-real-time container or a real-time container; when the target container is a real-time container, determining the real-time nodes contained in the target cluster, wherein the target cluster includes non-real-time nodes and real-time nodes, the non-real-time nodes are nodes that start containers on the nodes when the current node is available while waiting for the next scheduling cycle, and the real-time nodes are nodes that immediately start containers on the nodes when the current node is available; determining a target real-time node from the real-time nodes; and creating the target container on the target real-time node.
[0005] In a second aspect, the present application provides a container scheduling device, comprising: a first determination module, for determining whether the target container is a non-real-time container or a real-time container when receiving a target creation instruction for creating a target container in a target cluster; a second determination module, for determining, when the target container is a real-time container, the real-time nodes contained in the target cluster, wherein the target cluster comprises non-real-time nodes and real-time nodes, the non-real-time nodes being nodes that start containers on the nodes when the current node is available while waiting for the next scheduling cycle, and the real-time nodes being nodes that immediately start containers on the nodes when the current node is available; a third determination module, for determining a target real-time node from the real-time nodes; and a creation module, for creating the target container on the target real-time node.
[0006] As an optional example, the third determination module includes: an acquisition unit, used to acquire the requested resource type and requested resource amount of the target container, the resource type and resource utilization of the real-time node, the scheduling conditions of the target container, and the priority rules of the target container; a first determination unit, used to determine the target real-time node from the real-time nodes according to the requested resource type and requested resource amount of the target container, the resource type, total resource amount and resource utilization of the real-time node, the scheduling conditions of the target container, and the priority rules of the target container.
[0007] As an optional example, the first determination unit includes: a selection subunit, used to select a first real-time node that meets the above scheduling conditions from the above real-time nodes according to the above scheduling conditions; a first calculation subunit, used to calculate a first score for the above first real-time node according to the requested resource type and requested resource amount of the above target container, and the resource type, total resource amount and resource utilization of the above first real-time node; a second calculation subunit, used to calculate a second score for the above first real-time node according to the priority rule of the above target container; a first determination subunit, used to determine a weighted sum of the above first score and the above second score as a total score; and a second determination subunit, used to determine the first real-time node with the highest total score as the above target real-time node.
[0008] As an optional example, the above-mentioned device also includes: a processing module, used to add multiple first nodes in the above-mentioned target container before receiving the above-mentioned target creation request, wherein each of the above-mentioned first nodes corresponds to a physical computer; and a configuration module, used to configure the node configuration of the real-time node for the above-mentioned first node.
[0009] As an optional example, the configuration module includes: a configuration unit, configured to configure a real-time system for the physical computer; and a second determination unit, configured to determine the first node corresponding to the physical computer configured with the real-time system as a real-time node.
[0010] As an optional example, the above-mentioned device also includes: a first definition module, used to define real-time node custom resources before receiving the above-mentioned target creation request; a second definition module, used to define real-time container custom resources; a third definition module, used to define real-time scheduler custom resources; a fourth definition module, used to define real-time container gateway custom resources; a fifth definition module, used to define real-time application access service custom resources; and an installation module, used to install the defined custom resources to the above-mentioned target cluster.
[0011] As an optional example, the creation module includes: an execution unit, which is used to execute a creation instruction for creating the target container by calling a container gateway on a target real-time node; a download unit, which is used to call the container gateway, download an image file of the target container, and execute the image file to start the target container.
[0012] In a third aspect, the present application provides a storage medium storing a computer program, wherein the computer program executes the above-mentioned container scheduling method when executed by a processor.
[0013] In a fourth aspect, the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the container scheduling method through the computer program.
[0014] In an embodiment of the present application, when a target creation instruction for creating a target container in a target cluster is received, it is determined that the target container is a non-real-time container or a real-time container; when the target container is a real-time container, the real-time nodes contained in the target cluster are determined, wherein the target cluster includes non-real-time nodes and real-time nodes, the non-real-time nodes are nodes that start the container on the node when the current node is available while waiting for the next scheduling cycle, and the real-time nodes are nodes that immediately start the container on the node when the current node is available; the target real-time node is determined from the real-time nodes; a method for creating the target container on the target real-time node is adopted, because in the above method, the target cluster is used as the basic container scheduling and node management framework to implement a general real-time operating system-based real-time container scheduling and management mechanism, thereby achieving the purpose of unified management of real-time container applications, non-real-time container applications, real-time nodes and non-real-time nodes, thereby solving the technical problem of the lack of real-time container scheduling and real-time node management solutions in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0017] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0018] Figure 1 is a flowchart of an optional container scheduling method according to an embodiment of the present application;
[0019] Figure 2 is a schematic structural diagram of an optional container scheduling device according to an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are 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 making creative work are within the scope of protection of this application.
[0022] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0023] According to a first aspect of an embodiment of the present application, a container scheduling method is provided. Optionally, as follows: Figure 1 As shown, the above method includes:
[0024] S102, upon receiving a target creation instruction for creating a target container in a target cluster, determining whether the target container is a non-real-time container or a real-time container;
[0025] S104, when the target container is a real-time container, determine the real-time nodes included in the target cluster, wherein the target cluster includes non-real-time nodes and real-time nodes, the non-real-time nodes are nodes that start the container on the node when the current node is available and wait for the next scheduling cycle, and the real-time nodes are nodes that immediately start the container on the node when the current node is available;
[0026] S106, determining a target real-time node from the real-time nodes;
[0027] S108, creating a target container on the target real-time node.
[0028] Optionally, in this embodiment, kubernetes is used as the basic container scheduling and node management framework to make the deployment and management of real-time containerized applications that meet the OCI (Open Container Initiative) standard simpler. Kubernetes is an open source container orchestration platform for automating the deployment, management and expansion of containerized applications.
[0029] Optionally, in this embodiment, in a target cluster including real-time nodes and non-real-time nodes, a target container (which may be a real-time container or a non-real-time container) is created and scheduled. Specifically, when an instruction to create a target container in a target cluster is received, it is first necessary to determine whether the target container is a non-real-time container or a real-time container. When the current node resources are available, the non-real-time container may wait for the next scheduling cycle to start again. The real-time container needs to be started immediately when the current node resources are available to ensure real-time performance. If the target container is a real-time container, it is necessary to determine which nodes are real-time nodes in the target cluster. The target cluster contains two types of nodes, real-time nodes and non-real-time nodes. Non-real-time nodes are used for general container scheduling. The container will wait for resources to be idle before starting. Real-time nodes are used for containers that require real-time performance. Once resources are available, the container is started immediately. Then, according to the requested resource type and requested resource amount of the target container, the resource type and resource utilization of the real-time node, the scheduling conditions of the target container, and the priority rules of the target container, the most suitable node is selected from the real-time nodes to schedule the target container. Once the target real-time node is determined, the container creation instruction is executed by calling the container controller service interface on the node, downloading the image file of the target container from the image repository, executing the image file, and starting the target container.
[0030] Optionally, in this embodiment, the real-time container is scheduled and run on the real-time node to ensure that it starts immediately when resources are available, meeting the requirements for low latency and high response. Through the automated scheduling and deployment process, human intervention is reduced and work efficiency is improved. The unified container controller service interface simplifies the operation steps and facilitates management and maintenance.
[0031] Optionally, in this embodiment, the target cluster is used as the basic container scheduling and node management framework to implement a general real-time operating system-based real-time container scheduling and management mechanism, thereby achieving the purpose of unified management of real-time container applications, non-real-time container applications, real-time nodes and non-real-time nodes, thereby solving the technical problem of the lack of real-time container scheduling and real-time node management solutions in the prior art.
[0032] As an optional example, determining the target real-time node from the real-time nodes includes:
[0033] Obtain the requested resource type and requested resource amount of the target container, the resource type and resource utilization of the real-time node, the scheduling conditions of the target container, and the priority rules of the target container;
[0034] The target real-time node is determined from the real-time nodes according to the requested resource type and requested resource amount of the target container, the resource type, total resource amount and resource utilization of the real-time node, the scheduling condition of the target container and the priority rule of the target container.
[0035] As an optional example, determining the target real-time node from the real-time nodes according to the requested resource type and requested resource amount of the target container, the resource type, total resource amount and resource utilization of the real-time node, the scheduling condition of the target container and the priority rule of the target container includes:
[0036] From the real-time nodes, according to the scheduling condition, select the first real-time node that meets the scheduling condition;
[0037] Calculate a first score for the first real-time node according to the requested resource type and the requested resource amount of the target container, and the resource type, the total resource amount, and the resource utilization rate of the first real-time node;
[0038] Calculate a second score for the first real-time node according to a priority rule of the target container;
[0039] Determine a weighted sum of the first score and the second score as a total score;
[0040] The first real-time node with the highest total score is determined as the target real-time node.
[0041] Optionally, in this embodiment, when selecting the most suitable node from the real-time nodes to schedule the target container, the factors considered include: the requested resource type and requested resource amount of the target container, the resource type, total resource amount and resource utilization of the real-time node, and the scheduling conditions and priority rules of the target container. Specifically, first, the nodes that meet the scheduling conditions of the target container are screened out from the real-time nodes. For each screened real-time node, a preliminary score (first score) needs to be calculated based on the following factors: the requested resource type and requested resource amount of the target container: resource requirements such as CPU and memory, the resource type, total resource amount and resource utilization of the real-time node: understand the current resource usage and available resource amount of the node. When the node resources are tight, these parameters will affect the scoring of the node. Specifically, the score of the node with higher resource utilization will be reduced accordingly, and the score of the node with less available resources will be reduced accordingly, which helps to ensure that the target container is scheduled to a node with sufficient resources. Next, the second score is calculated for each node according to the priority rules of the target container. These priority rules may include: the priority of the container (high-priority containers may need to run on better nodes), and the performance indicators of the node (such as response time, network bandwidth, etc.). According to the actual needs of the cluster administrator, custom priority rules can be defined to better meet specific scheduling needs. The first score and the second score of each node are weighted and summed to obtain the total score. The formula for weighted summation can be as follows: total score = α × first score + β × second score, where α and β are weight coefficients used to balance the importance of the two scores. Compare the total scores of all qualified real-time nodes, and select the node with the highest total score as the target real-time node. This node will be used to deploy the target container to ensure optimal resource utilization and performance. Through the above process, determining the target real-time node can significantly improve the overall performance and resource utilization efficiency of the Kubernetes cluster, and ensure the reliable operation and efficient management of various container tasks.
[0042] As an optional example, before receiving the target creation request, the method further includes:
[0043] Adding multiple first nodes in the target container, wherein each first node corresponds to a physical computer;
[0044] Configure the node configuration of the real-time node for the first node.
[0045] Optionally, in this embodiment, before receiving the target creation request, in order to ensure that the real-time container can run efficiently and reliably on the real-time node, some pre-configuration and preparation work need to be performed. Specifically, in the configuration of the target container, multiple first nodes need to be added, and these first nodes are nodes in the cluster for deploying and running containers. Each first node corresponds to a physical computer, and these physical computers are the actual hardware resources of the cluster. The first node is a logical node, indicating a unit in the cluster that can run the container. The physical computer is an actual hardware device, and each physical computer corresponds to a first node. In order to ensure that the real-time container can run efficiently on these first nodes, it is necessary to perform special configuration on these first nodes to make them real-time nodes. The physical computer needs to run a real-time operating system (Real-Time Operating System, RTOS) to ensure that low latency and high deterministic performance can be provided when running the real-time container, install and configure the real-time operating system for the physical computer, optimize the operating system kernel to support real-time performance, and configure the real-time task scheduler to ensure that the task can be scheduled and executed in time. Once the physical computer is configured with a real-time system, the first node corresponding to the physical computer will be determined as a real-time node.
[0046] Optionally, in this embodiment, by pre-configuring multiple first nodes as real-time nodes, the cluster can flexibly respond to real-time container requests of different numbers and types, thereby improving the scalability of the system. Real-time nodes can be dynamically increased or decreased according to demand, and resource allocation can be flexibly adjusted to adapt to changes in actual workloads.
[0047] As an optional example, configuring the node configuration of the real-time node for the first node includes:
[0048] Configure real-time systems for physical computers;
[0049] A first node corresponding to a physical computer configured with a real-time system is determined as a real-time node.
[0050] Optionally, in this embodiment, each first node corresponds to a physical computer, and these physical computers are the actual hardware resources of the cluster. The first node is a logical node, which represents a unit in the cluster that can run a container. The physical computer is an actual hardware device, and each physical computer corresponds to a first node. The physical computer needs to run a real-time operating system (Real-Time Operating System, RTOS) to ensure that low latency and high deterministic performance can be provided when running real-time containers. The real-time operating system is installed and configured for the physical computer, the operating system kernel is optimized to support real-time performance, and the real-time task scheduler is configured to ensure that tasks can be scheduled and executed in time. Once the physical computer is configured with a real-time system, the first node corresponding to the physical computer will be determined as a real-time node.
[0051] As an optional example, before receiving the target creation request, the method further includes:
[0052] Define real-time node custom resources;
[0053] Define real-time container custom resources;
[0054] Define real-time scheduler custom resources;
[0055] Define a real-time container gateway custom resource;
[0056] Define custom resources for real-time application access services;
[0057] Install the defined custom resources to the target cluster.
[0058] Optionally, in this embodiment, in order to effectively manage and schedule real-time containers, a series of custom resources (Custom Resource Definitions, CRDs) need to be defined and installed to the target cluster before receiving the target creation request. These custom resources will extend the functionality of Kubernetes and support the management and scheduling of real-time containers. Real-time node custom resources are used to describe and manage real-time nodes in the cluster, which are specifically used to run real-time containers and provide low latency and high deterministic performance. RT Node Custom Resource (RtNode-CRD): defines the characteristics and status information of real-time nodes, including the resource type, total resource amount, resource utilization, etc. of the node. Real-time container custom resources are used to describe and manage the life cycle of real-time containers, which need to run on real-time nodes to ensure real-time performance. RT Pod CustomResource (RtPod-CRD): defines the characteristics and status information of real-time containers, including the resource requirements, scheduling conditions, priority rules, etc. of the container. Real-time scheduler custom resources are used to describe and manage the behavior and configuration of the real-time scheduler, which is responsible for scheduling real-time containers to appropriate real-time nodes. RT Scheduler Custom Resource (RtScheduler-CRD): defines the characteristics and scheduling algorithms of the real-time scheduler, including how to select the appropriate real-time node based on resource requirements, resource utilization, and priority rules. Real-time Container Gateway Custom Resource is used to describe and manage the network access and connection of real-time containers. The real-time container gateway is responsible for managing the network configuration of the container to ensure that the container can communicate with external systems efficiently and reliably. RT Gateway Custom Resource (RtGateway-CRD): defines the network configuration and management strategy of the real-time container, including network bandwidth, latency requirements, etc. Real-time Application Access Service Custom Resource is used to describe and manage the access service of the real-time application. The real-time application access service is responsible for routing external requests to the real-time container to ensure that the requests can be processed in a timely and reliable manner. RT Service Custom Resource (RtService-CRD): defines the characteristics and configuration of the real-time application access service, including service type, port configuration, access control policy, etc. Once the above custom resources are defined, they need to be installed in the target cluster. This step registers these custom resources with the Kubernetes API, making them part of cluster management. The defined CRDs are registered with the target cluster through the Kubernetes API (Application Programming Interface), making them manageable resources of the cluster.
[0059] Optionally, in this embodiment, by defining and installing custom resources, the functionality of Kubernetes is extended to enable it to support and manage real-time containers and real-time nodes. Custom resources enable Kubernetes to handle specific real-time performance requirements and provide more refined resource management and scheduling.
[0060] As an optional example, creating a target container on a target real-time node includes:
[0061] By calling the container gateway on the target real-time node, execute the creation instruction of the target container;
[0062] Call the container gateway, download the image file of the target container, execute the image file, and start the target container.
[0063] Optionally, in this embodiment, once the target real-time node is determined, the instruction to create a container is executed by calling the container gateway on the node, downloading the image file of the target container from the image repository, executing the image file, and starting the target container.
[0064] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0065] According to another aspect of the embodiment of the present application, a container scheduling device is also provided. Figure 2 As shown, including:
[0066] A first determination module 202, configured to determine whether the target container is a non-real-time container or a real-time container when receiving a target creation instruction for creating a target container in a target cluster;
[0067] The second determination module 204 is used to determine the real-time nodes included in the target cluster when the target container is a real-time container, wherein the target cluster includes non-real-time nodes and real-time nodes, the non-real-time nodes are nodes that start the container on the node when the current node is available and wait for the next scheduling cycle, and the real-time nodes are nodes that immediately start the container on the node when the current node is available;
[0068] A third determination module 206, configured to determine a target real-time node from the real-time nodes;
[0069] The creation module 208 is used to create a target container on the target real-time node.
[0070] Optionally, in this embodiment, kubernetes is used as the basic container scheduling and node management framework to make the deployment and management of real-time containerized applications that meet the OCI (Open Container Initiative) standard simpler. Kubernetes is an open source container orchestration platform for automating the deployment, management and expansion of containerized applications.
[0071] Optionally, in this embodiment, in a target cluster including real-time nodes and non-real-time nodes, a target container (which may be a real-time container or a non-real-time container) is created and scheduled. Specifically, when an instruction to create a target container in a target cluster is received, it is first necessary to determine whether the target container is a non-real-time container or a real-time container. When the current node resources are available, the non-real-time container may wait for the next scheduling cycle to start again. The real-time container needs to be started immediately when the current node resources are available to ensure real-time performance. If the target container is a real-time container, it is necessary to determine which nodes are real-time nodes in the target cluster. The target cluster contains two types of nodes, real-time nodes and non-real-time nodes. Non-real-time nodes are used for general container scheduling. The container will wait for resources to be idle before starting. Real-time nodes are used for containers that require real-time performance. Once resources are available, the container is started immediately. Then, according to the requested resource type and requested resource amount of the target container, the resource type and resource utilization of the real-time node, the scheduling conditions of the target container, and the priority rules of the target container, the most suitable node is selected from the real-time nodes to schedule the target container. Once the target real-time node is determined, the container creation instruction is executed by calling the container controller service interface on the node, downloading the image file of the target container from the image repository, executing the image file, and starting the target container.
[0072] Optionally, in this embodiment, the real-time container is scheduled and run on the real-time node to ensure that it starts immediately when resources are available, meeting the requirements for low latency and high response. Through the automated scheduling and deployment process, human intervention is reduced and work efficiency is improved. The unified container controller service interface simplifies the operation steps and facilitates management and maintenance.
[0073] Optionally, in this embodiment, the target cluster is used as the basic container scheduling and node management framework to implement a general real-time operating system-based real-time container scheduling and management mechanism, thereby achieving the purpose of unified management of real-time container applications, non-real-time container applications, real-time nodes and non-real-time nodes, thereby solving the technical problem of the lack of real-time container scheduling and real-time node management solutions in the prior art.
[0074] As an optional example, the third determining module includes:
[0075] An acquisition unit, used to acquire the requested resource type and requested resource amount of the target container, the resource type and resource utilization rate of the real-time node, the scheduling condition of the target container, and the priority rule of the target container;
[0076] The first determination unit is used to determine a target real-time node from real-time nodes according to the requested resource type and requested resource amount of the target container, the resource type, total resource amount and resource utilization of the real-time node, the scheduling condition of the target container and the priority rule of the target container.
[0077] As an optional example, the first determining unit includes:
[0078] A selection subunit is used to select a first real-time node that meets the scheduling condition from the real-time nodes according to the scheduling condition;
[0079] A first calculation subunit, configured to calculate a first score for the first real-time node according to a requested resource type and a requested resource amount of the target container, and a resource type, a total resource amount, and a resource utilization rate of the first real-time node;
[0080] A second calculation subunit, configured to calculate a second score for the first real-time node according to a priority rule of the target container;
[0081] A first determining subunit, configured to determine a weighted sum of the first score and the second score as a total score;
[0082] The second determining subunit is configured to determine the first real-time node with the highest total score as the target real-time node.
[0083] Optionally, in this embodiment, when selecting the most suitable node from the real-time nodes to schedule the target container, the factors considered include: the requested resource type and requested resource amount of the target container, the resource type, total resource amount and resource utilization of the real-time node, and the scheduling conditions and priority rules of the target container. Specifically, first, the nodes that meet the scheduling conditions of the target container are screened out from the real-time nodes. For each screened real-time node, a preliminary score (first score) needs to be calculated based on the following factors: the requested resource type and requested resource amount of the target container: resource requirements such as CPU and memory, the resource type, total resource amount and resource utilization of the real-time node: understand the current resource usage and available resource amount of the node. When the node resources are tight, these parameters will affect the scoring of the node. Specifically, the score of the node with higher resource utilization will be reduced accordingly, and the score of the node with less available resources will be reduced accordingly, which helps to ensure that the target container is scheduled to a node with sufficient resources. Next, the second score is calculated for each node according to the priority rules of the target container. These priority rules may include: the priority of the container (high-priority containers may need to run on better nodes), and the performance indicators of the node (such as response time, network bandwidth, etc.). According to the actual needs of the cluster administrator, custom priority rules can be defined to better meet specific scheduling needs. The first score and the second score of each node are weighted and summed to obtain the total score. The formula for weighted summation can be as follows: total score = α × first score + β × second score, where α and β are weight coefficients used to balance the importance of the two scores. Compare the total scores of all qualified real-time nodes, and select the node with the highest total score as the target real-time node. This node will be used to deploy the target container to ensure optimal resource utilization and performance. Through the above process, determining the target real-time node can significantly improve the overall performance and resource utilization efficiency of the Kubernetes cluster, and ensure the reliable operation and efficient management of various container tasks.
[0084] As an optional example, the above device further includes:
[0085] A processing module, configured to add a plurality of first nodes in a target container before receiving a target creation request, wherein each first node corresponds to a physical computer;
[0086] The configuration module is used to configure the node configuration of the real-time node for the first node.
[0087] Optionally, in this embodiment, before receiving the target creation request, in order to ensure that the real-time container can run efficiently and reliably on the real-time node, some pre-configuration and preparation work need to be performed. Specifically, in the configuration of the target container, multiple first nodes need to be added, and these first nodes are nodes in the cluster for deploying and running containers. Each first node corresponds to a physical computer, and these physical computers are the actual hardware resources of the cluster. The first node is a logical node, indicating a unit in the cluster that can run the container. The physical computer is an actual hardware device, and each physical computer corresponds to a first node. In order to ensure that the real-time container can run efficiently on these first nodes, it is necessary to perform special configuration on these first nodes to make them real-time nodes. The physical computer needs to run a real-time operating system (Real-Time Operating System, RTOS) to ensure that low latency and high deterministic performance can be provided when running the real-time container, install and configure the real-time operating system for the physical computer, optimize the operating system kernel to support real-time performance, and configure the real-time task scheduler to ensure that the task can be scheduled and executed in time. Once the physical computer is configured with a real-time system, the first node corresponding to the physical computer will be determined as a real-time node.
[0088] Optionally, in this embodiment, by pre-configuring multiple first nodes as real-time nodes, the cluster can flexibly respond to real-time container requests of different numbers and types, thereby improving the scalability of the system. Real-time nodes can be dynamically increased or decreased according to demand, and resource allocation can be flexibly adjusted to adapt to changes in actual workloads.
[0089] As an optional example, the configuration module includes:
[0090] a configuration unit for configuring the real-time system for a physical computer;
[0091] The second determining unit is configured to determine a first node corresponding to a physical computer configured with a real-time system as a real-time node.
[0092] Optionally, in this embodiment, each first node corresponds to a physical computer, and these physical computers are the actual hardware resources of the cluster. The first node is a logical node, which represents a unit in the cluster that can run a container. The physical computer is an actual hardware device, and each physical computer corresponds to a first node. The physical computer needs to run a real-time operating system (Real-Time Operating System, RTOS) to ensure that low latency and high deterministic performance can be provided when running real-time containers. The real-time operating system is installed and configured for the physical computer, the operating system kernel is optimized to support real-time performance, and the real-time task scheduler is configured to ensure that tasks can be scheduled and executed in time. Once the physical computer is configured with a real-time system, the first node corresponding to the physical computer will be determined as a real-time node.
[0093] As an optional example, the above device further includes:
[0094] A first definition module, used for defining a real-time node custom resource before receiving a target creation request;
[0095] The second definition module is used to define the real-time container custom resources; the third definition module is used to define the real-time scheduler custom resources;
[0096] The fourth definition module is used to define the real-time container gateway custom resources;
[0097] A fifth definition module is used to define a real-time application access service custom resource;
[0098] The installation module is used to install the defined custom resources to the target cluster.
[0099] Optionally, in this embodiment, in order to effectively manage and schedule real-time containers, a series of custom resources (Custom Resource Definitions, CRDs) need to be defined and installed to the target cluster before receiving the target creation request. These custom resources will extend the functionality of Kubernetes and support the management and scheduling of real-time containers. Real-time node custom resources are used to describe and manage real-time nodes in the cluster, which are specifically used to run real-time containers and provide low latency and high deterministic performance. RT Node Custom Resource (RtNode-CRD): defines the characteristics and status information of real-time nodes, including the resource type, total resource amount, resource utilization, etc. of the node. Real-time container custom resources are used to describe and manage the life cycle of real-time containers, which need to run on real-time nodes to ensure real-time performance. RT Pod CustomResource (RtPod-CRD): defines the characteristics and status information of real-time containers, including the resource requirements, scheduling conditions, priority rules, etc. of the container. Real-time scheduler custom resources are used to describe and manage the behavior and configuration of the real-time scheduler, which is responsible for scheduling real-time containers to appropriate real-time nodes. RT Scheduler Custom Resource (RtScheduler-CRD): defines the characteristics and scheduling algorithms of the real-time scheduler, including how to select the appropriate real-time node based on resource requirements, resource utilization, and priority rules. Real-time Container Gateway Custom Resource is used to describe and manage the network access and connection of real-time containers. The real-time container gateway is responsible for managing the network configuration of the container to ensure that the container can communicate with external systems efficiently and reliably. RT Gateway Custom Resource (RtGateway-CRD): defines the network configuration and management strategy of the real-time container, including network bandwidth, latency requirements, etc. Real-time Application Access Service Custom Resource is used to describe and manage the access service of the real-time application. The real-time application access service is responsible for routing external requests to the real-time container to ensure that the requests can be processed in a timely and reliable manner. RT Service Custom Resource (RtService-CRD): defines the characteristics and configuration of the real-time application access service, including service type, port configuration, access control policy, etc. Once the above custom resources are defined, they need to be installed in the target cluster. This step registers these custom resources with the Kubernetes API, making them part of cluster management. The defined CRDs are registered with the target cluster through the Kubernetes API (Application Programming Interface), making them manageable resources of the cluster.
[0100] Optionally, in this embodiment, by defining and installing custom resources, the functionality of Kubernetes is extended to enable it to support and manage real-time containers and real-time nodes. Custom resources enable Kubernetes to handle specific real-time performance requirements and provide more refined resource management and scheduling.
[0101] As an optional example, create a module including:
[0102] An execution unit, used to execute a creation instruction for creating a target container by calling a container gateway on a target real-time node;
[0103] The download unit is used to call the container gateway, download the image file of the target container, execute the image file, and start the target container.
[0104] Optionally, in this embodiment, once the target real-time node is determined, the instruction to create a container is executed by calling the container gateway on the node, downloading the image file of the target container from the image repository, executing the image file, and starting the target container.
[0105] For other examples of this embodiment, please refer to the above examples and will not be repeated here.
[0106] Figure 3 is a schematic diagram of an optional electronic device according to an embodiment of the present application, such as Figure 3 As shown, it includes a processor 302, a communication interface 304, a memory 306 and a communication bus 308, wherein the processor 302, the communication interface 304 and the memory 306 communicate with each other through the communication bus 308, wherein,
[0107] Memory 306, used for storing computer programs;
[0108] The processor 302 is used to implement the following steps when executing the computer program stored in the memory 306:
[0109] Upon receiving a target creation instruction for creating a target container in a target cluster, determining whether the target container is a non-real-time container or a real-time container;
[0110] When the target container is a real-time container, determine the real-time nodes included in the target cluster, wherein the target cluster includes non-real-time nodes and real-time nodes, the non-real-time node is a node that starts the container on the node when the current node is available and waits for the next scheduling cycle, and the real-time node is a node that immediately starts the container on the node when the current node is available;
[0111] Determine a target real-time node from the real-time nodes;
[0112] Create a target container on the target real-time node.
[0113] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The communication interface is used for communication between the above electronic device and other devices.
[0114] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0115] As an example, the memory 306 may include, but is not limited to, the first determination module 202, the second determination module 204, the third determination module 206, and the creation module 208 in the container scheduling device. In addition, other module units in the container scheduling device may also be included but are not limited to, which will not be repeated in this example.
[0116] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0117] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0118] It can be understood by those skilled in the art that Figure 3The structure shown is for illustration only. The device for implementing the above container scheduling method may be a terminal device, which may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 3 The structure of the electronic device is not limited. For example, the electronic device may also include Figure 3 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 3 Different configurations shown.
[0119] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.
[0120] According to another aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps in the above container scheduling method are executed.
[0121] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0122] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0123] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0124] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0125] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the 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 through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0126] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0127] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0128] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A container scheduling method, characterized in that: include: Upon receiving a target creation instruction for creating a target container in a target cluster, determining whether the target container is a non-real-time container or a real-time container; When the target container is a real-time container, determine the real-time nodes included in the target cluster, wherein the target cluster includes non-real-time nodes and real-time nodes, the non-real-time nodes are nodes that start the container on the node when the current node is available while waiting for the next scheduling cycle, and the real-time nodes are nodes that immediately start the container on the node when the current node is available; Determine a target real-time node from the real-time nodes; The target container is created on the target real-time node.
2. The method according to claim 1, characterized in that Determining the target real-time node from the real-time nodes includes: Acquire the requested resource type and requested resource amount of the target container, the resource type and resource utilization of the real-time node, the scheduling condition of the target container, and the priority rule of the target container; The target real-time node is determined from the real-time nodes according to the requested resource type and requested resource amount of the target container, the resource type, total resource amount and resource utilization of the real-time node, the scheduling condition of the target container and the priority rule of the target container.
3. The method according to claim 2, characterized in that Determining the target real-time node from the real-time nodes according to the requested resource type and requested resource amount of the target container, the resource type, total resource amount and resource utilization rate of the real-time node, the scheduling condition of the target container and the priority rule of the target container includes: From the real-time nodes, according to the scheduling condition, selecting a first real-time node that meets the scheduling condition; Calculate a first score for the first real-time node according to the requested resource type and the requested resource amount of the target container, and the resource type, the total resource amount, and the resource utilization rate of the first real-time node; Calculate a second score for the first real-time node according to the priority rule of the target container; Determine a weighted sum of the first score and the second score as a total score; The first real-time node with the highest total score is determined as the target real-time node.
4. The method according to claim 1, characterized in that: Before receiving the target creation request, the method further includes: Adding multiple first nodes in the target container, wherein each of the first nodes corresponds to a physical computer; A node configuration of a real-time node is configured for the first node.
5. The method according to claim 4, characterized in that The node configuration of configuring a real-time node for the first node includes: configuring a real-time system for the physical computer; The first node corresponding to the physical computer configured with the real-time system is determined as a real-time node.
6. The method according to claim 1, characterized in that Before receiving the target creation request, the method further includes: Define real-time node custom resources; Define real-time container custom resources; Define real-time scheduler custom resources; Define a real-time container gateway custom resource; Define custom resources for real-time application access services; Install the defined custom resources to the target cluster.
7. The method according to claim 1, characterized in that The creating the target container on the target real-time node comprises: By calling the container gateway on the target real-time node, executing a creation instruction for creating the target container; The container gateway is called to download the image file of the target container, and the image file is executed to start the target container.
8. A container scheduling device, characterized in that: include: A first determination module, configured to, upon receiving a target creation instruction for creating a target container in a target cluster, determine whether the target container is a non-real-time container or a real-time container; A second determination module is used to determine the real-time nodes included in the target cluster when the target container is a real-time container, wherein the target cluster includes non-real-time nodes and real-time nodes, the non-real-time nodes are nodes that start the container on the node when the current node is available while waiting for the next scheduling cycle, and the real-time nodes are nodes that immediately start the container on the node when the current node is available; The third determining module is used to determine a target real-time node from the real-time nodes; the creating module is used to create the target container on the target real-time node.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
Citation Information
Cited By
Hybrid scheduling method based on containerized mixed-criticality system
WO2026137766A1
