CONTAINER ENGINE AND METHOD FOR REALIZING CONTAINER ENGINE
By partitioning the container engine into management and worker nodes with a communication protocol, the solution addresses excessive resource consumption and instability issues, enhancing efficiency and stability in resource-constrained environments.
Patent Information
- Application Number
- JP2024523513
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2021-10-18
- Filing Date
- 2022-10-18
- Publication Date
- 2024-11-13
- Estimated Expiration
- 2042-10-18
AI Technical Summary
Existing container engines, such as Docker, Containerd, and CRI-O, deployed with container orchestration systems on worker nodes consume excessive CPU and memory resources, particularly in resource-constrained environments like IoT clusters, leading to instability and high development loads.
The container engine is partitioned into a first device on a management node and a second device on a worker node, utilizing a communication protocol to manage container operations, reducing resource consumption by separating the container engine core module from the container spacer and runtime modules.
This architecture reduces resource consumption on worker nodes, stabilizes the system, and minimizes development efforts by maintaining the container engine core on the management node while offloading resource-intensive tasks to the worker node.
Smart Images

Figure 2024541872000001_ABST
Abstract
Description
[Technical field]
[0001] This disclosure claims priority to Chinese patent applications bearing application numbers CN202111212628.4 and N202111212628.4, filed with the State Intellectual Property Office on October 18, 2021, and entitled "Container engine and method for implementing container engine, electronic device, and storage medium," all of which are incorporated by reference.
[0002] The embodiments of the present disclosure relate to, but are not limited to, the field of cloud computing container technology, and more particularly, to a container engine and a method for implementing the container engine, an electronic device, and a computer-readable storage medium. [Background technology]
[0003] Container technology, a hot technology in the cloud computing field, provides business programs with an independent execution environment; at the same time, containers can be deployed, started, and removed quickly, with zero performance loss in the central processing unit (CPU), memory, and input / output (IO).
[0004] In the container field, container engines such as Docker, Containerd, and Container Runtime Interface Open (CRI-O) have appeared. These container engines provide application programming interfaces (APIs) and command lines to the outside world, and provide container image management and container file cycle management functions through the APIs and command lines. Currently, container engines such as Docker, Containerd, and CRI-O, which are widely used in the industry, are generally deployed with the node agent of the container orchestration system on the worker node, and only the API of the container orchestration system is deployed on the management node. In this deployment method, the container engine and the node agent of the container orchestration system on the worker node have the problem of excessive consumption of the CPU and memory resources of the worker node. Summary of the Invention [Problem to be solved by the invention]
[0005] The embodiments of the present disclosure provide a container engine, a method for implementing the container engine, an electronic device, and a computer-readable storage medium. [Means for solving the problem]
[0006] In a first aspect, an embodiment of the present disclosure provides a method for implementing a container engine applied to a first device provided in a management node, the method including the steps of: employing a communication protocol to send a container operation request to a second device; and employing the communication protocol to receive a container operation response sent by the second device.
[0007] In a second aspect, an embodiment of the present disclosure provides a method for implementing a container engine applied to a second device provided on a management node or a worker node, the method including the steps of: employing a communication protocol to receive a container operation request sent by the first device and performing a container operation; and employing the communication protocol to send a container operation response to the first device.
[0008] In a third aspect, the disclosed embodiments provide an electronic device comprising at least one processor and a memory having at least one program stored therein, the at least one program, when executed by the at least one processor, implementing any one of the container engine implementation methods.
[0009] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, the computer program implementing any one of the container engine implementation methods when executed by a processor.
[0010] In a fifth aspect, the disclosed embodiment provides a container engine including a first device provided on a management node and a second device provided on the management node or a worker node, the first device comprising a container engine core module having a container management submodule arranged to send a container operation request to a master agent submodule, and a master agent submodule arranged to employ a communication protocol to send the container operation request to the container operation submodule of the second device and to receive a container operation response sent by the container operation submodule of the second device, the second device comprising a container spacer module including the container operation submodule arranged to employ the communication protocol to receive the container operation request sent by the master agent submodule of the first device and to send the container operation request to a container runtime module, and a container runtime module arranged to perform a container operation and send a container operation response to the container operation submodule, the container operation submodule further arranged to employ the communication protocol to send the container operation response to the master agent submodule of the first device. [Brief description of the drawings]
[0011] [Figure 1] FIG. 1 is a schematic diagram of a container engine according to the related art. [Diagram 2] FIG. 2 is a block diagram of a container engine configuration provided by an embodiment of the present disclosure. [Diagram 3] FIG. 3 is a flowchart diagram of an implementation method of a container engine applied to a management node provided by one embodiment of the present disclosure. [Figure 4] FIG. 4 is a flowchart diagram of an implementation method of a container engine applied to a worker node provided by another embodiment of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0012] In order to enable persons skilled in the art to better understand the technical solutions of the present disclosure, the container engine and the implementation method of the container engine, electronic device, and computer-readable storage medium provided by the present disclosure are described in detail below in combination with the drawings.
[0013] Hereinafter, exemplary embodiments will be described in detail with reference to the drawings, but the exemplary embodiments may be embodied in different forms and should not be construed as being limited to the embodiments described herein. Rather, these embodiments are provided for the purpose of making this disclosure thorough and complete, and allowing those skilled in the art to fully understand the scope of the present disclosure.
[0014] The various embodiments of the present disclosure and the various features in the embodiments can be combined with each other unless they are inconsistent.
[0015] As used in this disclosure, the term "and / or" includes any and all combinations of at least one of the associated listed items.
[0016] The terms used herein are merely for the purpose of describing particular embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include the plural unless otherwise clearly stated in the context. It will be further understood that when the terms "comprise" and "consist of" are used herein, they specify the presence of the features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of at least one other feature, whole, step, operation, element, component, and / or group thereof.
[0017] All terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by those skilled in the art unless otherwise limited. It will be further understood that those terms defined in common usage shall have a meaning consistent with the meaning in the context of the relevant art and this disclosure, and shall not be construed as having an ideal or overly formal meaning unless expressly defined herein.
[0018] In the container field, container engines such as Docker, Containerd, and CRI-O have appeared. These container engines provide APIs and command lines to the outside world, and provide container image management and container lifecycle management functions through the APIs and command lines. Currently, container engines such as Docker, Containerd, and CRI-O, which are widely used in the industry, can be broadly divided into a container engine core module, a container spacer module, and a container runtime module in terms of function. As shown in Figure 1, the container engine core module specifically includes an API submodule, a client submodule, a container management submodule, a container image management submodule, a node management submodule, and an image storage submodule. The container spacer module specifically includes an input / output transfer submodule, a container resource recovery submodule, and a container operation submodule. The container runtime module specifically includes an Open Container Initiative (OCI) runtime submodule or an LXC (Linux (registered trademark) Container) submodule.
[0019] The function of each sub-module is described below.
[0020] The API submodule is responsible for exposing the container engine functionality and the service software interface submodule to the outside world (e.g., container orchestration systems).
[0021] The client submodule is responsible for the command line tools provided by the container engine for container and image manipulation.
[0022] The container management submodule is responsible for managing the lifecycle state of containers, such as creating, running, stopping and deleting them.
[0023] The container image management submodule is responsible for managing the image state and the relationships between images.
[0024] The node management submodule is responsible for managing information such as managed node resources and security status.
[0025] The Image Storage sub-module is responsible for managing the actual files or devices of the image and for reading and writing the image contents.
[0026] The I / O forwarding submodule is responsible for forwarding input from the outside to the inside of the container and output from the inside of the container to the container engine.
[0027] The container resource reclaiming submodule is responsible for reclaiming system resources consumed by dead containers.
[0028] The container operation sub-module is responsible for calling the container runtime module to directly initiate operations such as creating, running, stopping, deleting, and viewing containers.
[0029] The OCI runtime submodule is a container runtime tool that meets the definition of the OCI specification and is responsible for performing concrete operations such as creating, running, stopping, deleting, and viewing containers on the operating system.
[0030] The LXC submodule is provided by the open source Linux Container project to create, run, stop, remove and browse container tools or dynamic libraries on Linux.
[0031] The container engine provides API submodules or client submodules to the container orchestration system, and the container orchestration system (e.g., K8S (Kubernetes), K3S, etc.) uses the API submodules or client submodules to instruct the container engine to complete container management functions such as image creation, image deletion, image query, image import, image export, image pull from repository, image push to repository, and container creation, container deletion, container start, container stop, container pause, container resume, container status query, etc. In the current container engine realization, functions such as container creation, container deletion, container start, container stop, container pause, container resume, etc., which are realized by calling the underlying operating system, are integrated into the OCI runtime submodule or LXC submodule. The container engine internally maintains state management of the container lifecycle, and container operations are performed by the container operation submodule calling the OCI runtime submodule or LXC submodule. Additionally, each container engine includes a container spacer module to handle resource reclamation when processes inside the container exit, and to relay the standard input, standard output, and standard error of processes inside the container.
[0032] With the emergence of major container orchestration systems such as K8S, K3S, and Docker Swarm, the deployment and upgrade of containers in a cluster environment has become more convenient. This has led to the formation of a set of cloud computing clusters, with the container orchestration system as the management portal and the container engine as the working implementation unit. Business developers can use the container orchestration system to quickly deploy business processes in container form to the internal nodes of the cluster. In such cloud computing clusters, individual physical devices (such as servers or single boards) are divided into management nodes and worker nodes according to the functional units mounted on them. The management node is often a server or single board with relatively sufficient CPU, memory, and storage resources, and a container orchestration system is deployed on the management node. The worker node is usually a server or single board device with relatively insufficient CPU, memory, and storage resources. A container orchestration agent and a container engine are deployed on the worker node, and the container is exactly executed on the container engine. Depending on the reliability, response speed, and other metrics of the cluster design, one or more management nodes can be deployed in the cluster, and depending on the worker load metrics of the cluster, one or more worker nodes can be deployed in the cluster. In extreme cases, the management node and the worker node may be deployed on the same physical device.
[0033] In a typical cloud computing cluster node, the API of the container orchestration system is deployed on the management node, while the node agent and container engine of the container orchestration system are deployed on the worker node. When a user needs to create a container, they only need to send a command to the API of the container orchestration system located on the management node, and the API of the container orchestration system will instruct the container engine to complete the actual container creation, launch, and management work through the node agent. However, the container engine and the node agent of the container orchestration system on the worker node have the problem of consuming excessive CPU and memory resources of the worker node. Take the open source Containerd engine as an example, creating and launching 500 containers requires 300 megabytes (M) of memory space. This is unacceptable for resource-constrained clusters that use embedded devices as worker nodes, especially in the IoT (Internet Of Things) cluster space. In addition, if only the OCI runtime submodule or the LXC submodule is deployed to a worker node, it is necessary to develop an adapter module that meets the requirements for the container orchestration system to call the container engine, which can result in a heavy development load and system instability.
[0034] 2 is a block diagram of a container engine configuration provided by an embodiment of the present disclosure. As shown in FIG. 2, the embodiment of the present disclosure modifies the deployment configuration of the container engine on the cluster, and divides the container engine into a first device 201 and at least one second device 202, and the first device 201 and the second device 202 are completely independent.
[0035] Here, the first device 201 and the second device 202 are in a master-slave mode, for example, one master-one slave, one master-multiple slaves, etc. Specifically, the first device 201 is a master device provided in a management node, and the second device 202 is a slave device provided in a worker node. In some cases, the first device 201 and the second device 202 may be provided in a management node at the same time, that is, the management node also performs the function of a working node.
[0036] Between the first device 201 and the second device 202, any one of a bus technology, a wired network technology, and a wireless network technology may be adopted as a link.
[0037] The first device 201 includes a container engine core module 2011 , and the second device 202 includes a slave agent module 2021 , a container spacer module 2022 and a container runtime module 2023 .
[0038] The Container Engine Core Module 2011 includes an API submodule, a client submodule, a container management submodule, a container image management submodule and a master agent submodule.
[0039] In some exemplary embodiments, the slave agent module 2021 includes a communication submodule, an image storage submodule, and a node management submodule. In further exemplary embodiments, the slave agent module 2021 includes a communication submodule and a node management submodule, and the image storage submodule is a separate module. In further exemplary embodiments, the slave agent module 2021 includes a communication submodule and an image storage submodule, and the node management submodule is a separate module. In further exemplary embodiments, the slave agent module 2021 includes a communication submodule, the image storage submodule is a separate module, and the node management submodule is also a separate module.
[0040] The container spacer module 2022 includes an input / output transfer sub-module, a container resource recovery sub-module and a container operation sub-module.
[0041] The container runtime module 2023 includes an OCI runtime submodule or an LXC submodule.
[0042] In some exemplary embodiments, the first device 201 communicates with the second device 202 by adopting a Remote Procedure Call Protocol (RPC), i.e., by adopting an RPC to call the second device 202 to realize corresponding functions. For example, the master agent sub-module communicates with the slave agent module 2021 by adopting an RPC, i.e., by adopting an RPC to call the slave agent module 2021 to realize corresponding functions.
[0043] In some exemplary embodiments, when the first device 201 and the second device 202 are simultaneously installed in the management node, the first device 201 communicates with the second device 202 by adopting Unix Sockets (Sock) or Inter-Process Communication (IPC). For example, the master agent sub-module communicates with the slave agent module 2021 by adopting Unix Sock or IPC.
[0044] In some exemplary embodiments, a C / S model is adopted to establish communication between the first device 201 and the second device 202. For example, the first device 201 is a client, and the second device 202 is a service. In this way, the second device 202 listens on the address and port of the second device 202 after booting up, and the first device 201 obtains the address and port of the second device 202 after powering on, and spontaneously establishes a link with the second device 202 according to the address and port of the second device 202, and registers with the second device 202.
[0045] In some exemplary embodiments, when the image storage sub-module is a separate module, the slave agent module 2021 and the image storage sub-module communicate with each other using IPC. When the image storage sub-module is a sub-module of the slave agent module 2021, the image storage sub-module shares the same process with the slave agent module 2021, thereby reducing the occupation of process resources by the second device 202.
[0046] In some exemplary embodiments, when the image storage sub-module is a separate module, the master agent sub-module employs RPC to indirectly communicate with the image storage sub-module via the slave agent module 2021. In further exemplary embodiments, when the image storage sub-module is a separate module, the master agent sub-module employs RPC to directly communicate with the image storage sub-module.
[0047] In some exemplary embodiments, when the node management sub-module is a separate module, the slave agent module 2021 and the node management sub-module communicate with each other using IPC. When the node management sub-module is a sub-module of the slave agent module 2021, the node management sub-module shares the same process with the slave agent module 2021, thereby reducing the occupation of process resources by the second device 202.
[0048] In some exemplary embodiments, when the node management sub-module is a separate module, the master agent sub-module employs RPC to indirectly communicate with the node management sub-module via the slave agent module 2021. In further exemplary embodiments, when the node management sub-module is a separate module, the master agent sub-module employs RPC to directly communicate with the node management sub-module.
[0049] In some exemplary embodiments, the container spacer module 2022, the container runtime module 2023, and the slave agent module 2021 are each implemented using an independent process, and the container spacer module 2022 communicates with the slave agent module 2021 using IPC, and the container runtime module 2023 communicates with the slave agent module 2021 using IPC.
[0050] In some exemplary embodiments, the master agent sub-module employs ttrpc to communicate directly with the container spacer module 2022, thereby accelerating the speed of container operations, where trpc is the code name for open source software projects such as GRPC for low-memory environments.
[0051] In some exemplary embodiments, the master agent submodule employs RPCs to communicate indirectly with the container spacer module 2022 via the slave agent module 2021 .
[0052] In some exemplary embodiments, the container spacer module 2022 calls the container runtime module 2023 to perform container operations, facilitating the slave agent module 2021 .
[0053] Due to the above-mentioned changes to the container engine architecture, some of the internal implementation methods of the container engine have changed. The following describes the internal implementation methods of the container engine based on these changes. However, the following method description is not the entire container engine implementation process, but a part of the implementation process that is different from the internal implementation method of the container engine before the change, and the described implementation method is not used to limit the implementation process of the container engine after the change.
[0054] FIG. 3 is a flowchart diagram of an implementation method of a container engine applied to a management node provided by one embodiment of the present disclosure.
[0055] In a first aspect, referring to FIG. 3 , an embodiment of the present disclosure provides a method for implementing a container engine applied to a first device provided in a management node, the method including steps 300 and 301.
[0056] Step 300: Employing a communication protocol, a container operation request is sent to a second device.
[0057] In some exemplary embodiments, the communication protocol includes any one of RPC, socket, and IPC. Specifically, when the first device and the second device are simultaneously installed on a management node, the communication protocol adopted may be socket or IPC, and when the first device is installed on a management node and the second device is installed on a worker node, the communication protocol adopted may be RPC.
[0058] In some exemplary embodiments, when receiving an API request sent by the container orchestration system, a communication protocol can be adopted according to the content requested in the API request to send a container operation request to the second device. If the API request requests a container operation, the communication protocol can be directly used to send the container operation request to the second device to realize the container operation, or the communication protocol can be adopted to first send a container image operation request to the second device to realize the container image operation, and then the communication protocol can be adopted to send the container operation request to the second device to realize the container operation. For example, when creating a container, a container image needs to be created first, and then a container needs to be created. When a container needs to be created, an API request can be sent first to realize the creation of a container image, and then an API request can be sent to realize the creation of a container, or only one API request can be sent to realize the creation of a container image and a container.
[0059] In some exemplary embodiments, API requests can be listened for through a socket file or a specified network port in Unix.
[0060] In some example embodiments, the container operations include at least one of: create container, delete container, run container, stop container, pause container, resume container, create new process in container, query container information, and the like.
[0061] In some example embodiments, the container image operations include at least one of creating a container image, deleting a container mirror, querying container mirror information, converting a format, creating a container read / write layer, and the like.
[0062] Step 301: Receive a container operation response sent by a second device by adopting a communication protocol.
[0063] In some example embodiments, prior to the step of employing the communication protocol to transmit the container operation request to the second device, the method further comprises: Sending a node status inquiry request to a second device using a communication protocol, and receiving a node status inquiry response including the node status information sent by the second device using the communication protocol; Sending a first node resource application request to a second device by employing a communication protocol, and receiving a first node resource application response sent by the second device by employing a communication protocol; Sending a second node resource application request to a second device by adopting a communication protocol, and receiving a second node resource application response sent by the second device by adopting a communication protocol; The method further includes at least one of the steps of employing the communication protocol to send a container image operation request to the second device, and employing the communication protocol to receive a container image operation response sent by the second device.
[0064] In some example embodiments, upon receiving an API request sent by the container orchestration system, a container image operation request can be sent to a second device employing a communication protocol according to the content requested in the API request. In some exemplary embodiments, the method includes: receiving a console type parameter indicating a link type of standard input, standard error, and standard output; The method further includes the step of employing a communication protocol to send the console type parameter in a container creation request or a process creation request to the second device.
[0065] In some example embodiments, the link types for standard input, standard error, and standard output include linking standard input, standard error, and standard output to a specified console, linking standard input, standard error, and standard output to a specified file, and not linking.
[0066] In some example embodiments, the console type parameter may be sent to the first device by a container orchestration system or other external system.
[0067] In some exemplary embodiments, when the console type parameter is used to indicate that the standard input, standard error, and standard output should be linked to the specified console, the method further comprises: employing a communication protocol to send a container creation request or a process creation request including a port of the first device to the second device; Sending a standard input of the container to a second device through a port of the first device using a communication protocol; The method further includes the steps of adopting a communication protocol to listen to a port of the first device to receive the standard output and standard error of the container sent by the second device, and outputting the standard output and standard error of the container to a designated console.
[0068] In some exemplary embodiments, when the console type parameter is used to indicate that the standard input, standard error, and standard output are to be linked to a specified file, the method further comprises: The method further includes the step of employing a communication protocol to include the file name of the specified file in a container creation request or a process creation request and sending the request to the second device.
[0069] In some exemplary embodiments, when the first device employs the C / S model to communicate with the second device, the first device and the second device need to establish a link, and when the first device is a client, the first device needs to register with the second device. Specifically, the method is realized as follows: before the step of employing the communication protocol to send a container operation request to the second device, the method further includes the steps of employing the communication protocol to send a link establishment request to the second device based on the address and port of the second device preset, and employing the communication protocol to receive a link establishment response sent by the second device, to complete the link establishment; and employing the communication protocol to send a registration command to the second device, and employing the communication protocol to receive a registration response sent by the second device, to complete the registration.
[0070] In some example embodiments, the address and port of the second device may be pre-configured in a configuration file.
[0071] If there are two or more second devices, the address and port of each second device are respectively configured in the configuration file, and the first device establishes a link with each second device and registers with each second device.
[0072] In some exemplary embodiments, after the step of employing the communication protocol to receive the registration response sent by the second device, the method further includes the step of employing the communication protocol to periodically send keep-alive information to the second device to realize a health check mechanism.
[0073] In some example embodiments, prior to the step of transmitting the first node resource application request to the second device, the method further comprises: The method further includes employing the communication protocol to send a container spacer module creation request to a second device, and employing the communication protocol to receive a container spacer module creation response sent by the second device.
[0074] In some exemplary embodiments, the container spacer module create response includes the port of the container spacer module.
[0075] FIG. 4 is a flowchart diagram of an implementation method of a container engine applied to a worker node provided by another embodiment of the present disclosure.
[0076] In a second aspect, referring to FIG. 4 , another embodiment of the present disclosure provides a method for implementing a container engine applied to a second device provided in a management node or a worker node, the method including step 400 and step 401.
[0077] Step 400: Receive a container operation request sent by a first device by adopting a communication protocol, and perform the container operation.
[0078] In some exemplary embodiments, the communication protocol includes any one of RPC, socket, and IPC. Specifically, when the first device and the second device are simultaneously installed on a management node, the communication protocol adopted may be socket or IPC, and when the first device is installed on a management node and the second device is installed on a worker node, the communication protocol adopted may be RPC.
[0079] In some example embodiments, the container operations include at least one of: create container, delete container, run container, stop container, pause container, resume container, create new process in container, query container information, and the like.
[0080] Step 401: Employ a communication protocol to send a container operation response to a first device.
[0081] In some exemplary embodiments, prior to the step of receiving the container operation request sent by the first device employing the communication protocol, the method further comprises: receiving a node status inquiry request sent by the first device using a communication protocol, inquiring about node status information, and sending a node status inquiry response to the first device using the communication protocol, the node status inquiry response including the node status information; receiving a first node resource application request sent by the first device by employing a communication protocol, allocating a first node resource for the first device, and sending a first node resource application response to the first device by employing a communication protocol; receiving a second node resource application request sent by the first device through the communication protocol, allocating a second node resource for the first device, and sending a second node resource application response to the first device through the communication protocol; The method further includes at least one of steps of employing the communication protocol to receive a container image operation request sent by the first device, performing a container image operation, and employing the communication protocol to send a container image operation response to the first device.
[0082] In some example embodiments, the container image operations include at least one of creating a container image, deleting a container mirror, querying container mirror information, converting a format, creating a container read / write layer, and the like.
[0083] In some exemplary embodiments, the method includes: The method further includes the step of employing the communication protocol to receive a console type parameter sent by the first device, the console type parameter indicating a link type of standard input, standard error and standard output.
[0084] In some exemplary embodiments, when the console type parameter is used to indicate that the standard input, standard error, and standard output should be linked to the specified console, the method further comprises: receiving a port of the first device transmitted by the first device using a communication protocol; Receive a standard input of the container sent by the first device through a port of the first device by adopting a communication protocol, and input the standard input of the container into the container; The method further includes receiving a standard output and a standard error of the container, and employing a communication protocol to send the standard output and the standard error of the container to the first device through a port of the first device.
[0085] In some exemplary embodiments, when the console type parameter is used to indicate that the standard input, standard error, and standard output are to be linked to a specified file, the method further comprises: receiving a file name of the designated file sent by the first device using a communication protocol; The method further includes the step of creating a designated file with the file name of the received designated file as the file name, and writing the standard input and standard error of the container to the designated file.
[0086] In some exemplary embodiments, when the first device and the second device communicate with each other by adopting the C / S model, the first device and the second device need to establish a link, and when the first device is a client, the first device needs to register with the second device. Specifically, the method is realized as follows: before the step of adopting the communication protocol to receive a container operation request sent by the first device, the method further includes the steps of adopting the communication protocol to listen to the pre-configured address and port of the second device to receive a link establishment request sent by the first device, and adopting the communication protocol to send a link establishment response to the first device, so as to complete the link establishment; and adopting the communication protocol to receive a registration command sent by the first device, execute the registration command, and adopt the communication protocol to send a registration response to the first device, so as to complete the registration.
[0087] In some exemplary embodiments, the address and port of the second device may be pre-configured. The specific configuration method is not particularly limited, and may be configured in a configuration file, for example.
[0088] If there are two or more second devices, the address and port of each second device are respectively configured in the configuration file, and the first device establishes a link with each second device and registers with each second device.
[0089] In some exemplary embodiments, after the step of employing the communication protocol to send a registration response to the first device, the method further includes a step of employing the communication protocol to periodically receive keep-alive information sent by the first device, to realize a health check mechanism.
[0090] In some exemplary embodiments, prior to the step of receiving the first node resource application request transmitted by the first device, the method further comprises: The method further includes the steps of employing a communication protocol to receive a container spacer module creation request sent by the first device, creating a container spacer module, and employing the communication protocol to send a container spacer module creation response to the first device. In some exemplary embodiments, the container spacer module create response includes the port of the container spacer module.
[0091] In a third aspect, another embodiment of the present disclosure provides an electronic device comprising at least one processor and a memory having at least one program stored therein, the at least one program, when executed by the at least one processor, implementing any one of the container engine implementation methods.
[0092] Here, the processor is a device having data processing capabilities, including, but not limited to, a central processing unit (CPU), etc. The memory is a device having data storage capabilities, including, but not limited to, a random access memory (RAM, more specifically, SDRAM, DDR, etc.), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), and a flash memory (FLASH).
[0093] In some embodiments, the processor and memory are coupled to each other and to other components of the computing device via a bus.
[0094] In a fourth aspect, another embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, the computer program implementing any one of the above container engine implementation methods when executed by a processor.
[0095] As shown in FIG. 2, in a fifth aspect, another embodiment of the present disclosure provides a container engine including a first device 201 and a second device 202, where the first device is disposed in a management node and the second device is disposed in a management node or a worker node.
[0096] Here, the first apparatus comprises a container engine core module 2011 having a container management submodule arranged to send a container operation request to a master agent submodule, and a master agent submodule arranged to employ a communication protocol to send the container operation request to the container operation submodule of the second apparatus and to employ the communication protocol to receive a container operation response sent by the container operation submodule of the second apparatus.
[0097] Here, the second device 202 comprises a container spacer module 2022 including a container operation submodule arranged to receive a container operation request sent by the master agent submodule of the first device 201 using a communication protocol and send the container operation request to the container runtime module 2023, and a container runtime module 2023 arranged to perform a container operation and send a container operation response to the container operation submodule, which is further arranged to send the container operation response to the master agent submodule of the first device 201 using a communication protocol.
[0098] In some exemplary embodiments, the master agent sub-module employs ttrpc to communicate directly with the container spacer module 2022, thereby accelerating the speed of container operations.
[0099] In a further exemplary embodiment, the master agent sub-module employs RPC to indirectly communicate with the container spacer module 2022 via the relay of the slave agent module 2021. In this case, the second device 202 further includes a slave agent module 2021, which includes a communication sub-module arranged to realize communication with the master agent sub-module employing a communication protocol.
[0100] In some exemplary embodiments, when the first device and the second device communicate using the C / S model, the first device and the second device need to establish a link, and when the first device is a client, the first device needs to register with the second device. Specifically, this is realized as follows: That is, the master agent submodule is further configured to adopt a communication protocol to send a link establishment request to the slave agent module 2021 according to the pre-configured address and port of the slave agent module 2021, adopt the communication protocol to receive the link establishment response sent by the slave agent module 2021, thereby completing the link establishment, adopt the communication protocol to send a registration command to the slave agent module 2021, adopt the communication protocol to receive the registration response sent by the slave agent module 2021, thereby completing the registration.
[0101] The second device 202 further includes a slave agent module 2021 configured to receive a link establishment request sent by the master agent sub-module by employing the communication protocol, by listening to the address and port of the pre-configured slave agent module 2021, complete the link establishment by employing the communication protocol, receive a registration command sent by the master agent sub-module, execute the registration command, and complete the registration by employing the communication protocol, by sending a registration response to the master agent sub-module.
[0102] In some example embodiments, the address and port of the slave agent module 2021 may be pre-configured in a configuration file.
[0103] If there are two or more second devices, the address and port of each second device are respectively configured in the configuration file, and the first device establishes a link with each second device and registers with each second device.
[0104] In some example embodiments, the master agent sub-module is further configured to employ a communication protocol to periodically send keep-alive information to the slave agent module 2021 to realize the health check mechanism. The slave agent module 2021 is further configured to employ a communication protocol to periodically receive the keep-alive information sent by the master agent sub-module of the first device to realize the health check mechanism.
[0105] In some exemplary embodiments, the container engine core module 2011 of the first device 201 further includes an API submodule arranged to receive an API request sent by the container orchestration system, and send a container operation request to the container management submodule or send a container image operation request to the container image management submodule according to the content requested in the API request, and a container image management submodule arranged to receive the container image operation request sent by the API submodule, employ a communication protocol to send the container image operation request to the image storage submodule of the second device, and employ a communication protocol to receive a container image operation response sent by the image storage submodule of the second device. The container management submodule is further arranged to receive the container operation request sent by the API submodule, employ a communication protocol to send the container operation request to the container operation submodule of the second device, and employ a communication protocol to receive a container operation response sent by the container operation submodule of the second device.
[0106] The second device 202 further includes a slave agent module 2021, which includes an image storage submodule arranged to employ the communication protocol to receive a container image operation request sent by the container image management submodule of the first device, perform a container image operation, and send a container image operation response to the container image management submodule of the first device. The container operation submodule is further arranged to employ the communication protocol to receive a container operation request sent by the container management submodule of the first device, perform a container operation, and send a container operation response to the container management submodule of the first device.
[0107] In some exemplary embodiments, the container management submodule is further configured to send a node status query request to the master agent submodule, and the master agent submodule is further configured to employ the communication protocol to send the node status query request to the node management submodule of the second device, employ the communication protocol to receive a node status query response sent by the node management submodule of the second device, the node status query response including the node status information, and send the node status query response to the container management submodule.
[0108] The second device 202 further includes a slave agent module 2021, which includes a node management sub-module arranged to receive, by employing the communication protocol, a node status query request sent by the master agent sub-module of the first device, query node status information, and to send, by employing the communication protocol, a node status query response including the node status information to the master agent sub-module of the first device.
[0109] In some exemplary embodiments, the container management submodule is further configured to send a first node resource application request to the master agent submodule, and the master agent submodule is further configured to employ a communication protocol to send the first node resource application request to the node management submodule of the second device, employ a communication protocol to receive the first node resource application response sent by the node management submodule of the second device, and send the first node resource application response to the container management submodule.
[0110] The second device 202 further includes a slave agent module 2021, which includes a node management submodule configured to receive, by employing a communication protocol, a first node resource application request sent by the master agent submodule of the first device, allocate a first node resource for the first device, and send, by employing a communication protocol, a first node resource application response to the master agent submodule of the first device.
[0111] In some exemplary embodiments, the container management submodule is further configured to send a second node resource application request to the master agent submodule, and the master agent submodule is further configured to employ the communication protocol to send the second node resource application request to the node management submodule of the second device, employ the communication protocol to receive the second node resource application response sent by the node management submodule of the second device, and send the second node resource application response to the container management submodule.
[0112] The second device 202 further includes a slave agent module 2021, which includes a node management submodule configured to receive, by employing a communication protocol, a second node resource application request sent by the master agent submodule of the first device, allocate second node resources for the first device, and send, by employing a communication protocol, a second node resource application response to the master agent submodule of the first device.
[0113] In some example embodiments, the container engine core module 2011 further includes a client submodule configured to receive a console type parameter indicating link types of standard input, standard error, and standard output, and to send the console type parameter to a container management submodule, which is further configured to send the console type parameter to a master agent submodule, which is further used to employ a communication protocol to send the console type parameter in a container creation request or a process creation request to an I / O forwarding submodule of the second device.
[0114] The container spacer module 2022 further includes an input / output forwarding submodule arranged to receive the console type parameter and to send the console type parameter to the container operations submodule.
[0115] In some exemplary embodiments, the container management submodule is further configured to send the port of the container management submodule to the master agent submodule when the console type parameter is used to indicate that the standard input, standard error and standard output are to be linked to the designated console. The master agent submodule is further configured to employ a communication protocol to include the port of the container management submodule in a container creation request or a process creation request sent to the I / O forwarding submodule of the second device, employ a communication protocol to send the standard input of the container by the port of the container management submodule to the I / O forwarding submodule of the second device, employ a communication protocol to listen to the port of the container management submodule to receive the standard output and standard error of the container sent by the I / O forwarding submodule of the second device, and send the standard output and standard error of the container to the container management submodule. The container management submodule is further configured to output the standard output and standard error of the container to the designated console.
[0116] The input / output forwarding submodule is further configured to, when the console type parameter is used to indicate that the standard input, standard error and standard output are to be linked to the specified console, receive, using the communication protocol, a port of the container management submodule sent by the master agent submodule of the first device, receive, using the communication protocol, a port of the container management submodule, send the standard input of the container to the container operations submodule, and send the standard output and standard error of the container to the container management submodule by the port of the container management submodule.
[0117] The container operation submodule is further configured to input the container's standard input to the container, receive the container's standard output and standard error, and send the container's standard output and standard error to the input / output forwarding submodule.
[0118] In some exemplary embodiments, the container management submodule is further configured to send the console type parameter to the master agent submodule if the console type parameter is used to indicate that the standard input, standard error and standard output are to be linked to a designated file, and the master agent submodule is further configured to employ a communication protocol to send a file name of the designated file in a container creation request or a process creation request to the I / O forwarding submodule of the second device.
[0119] The input / output forwarding submodule is further configured to, when the console type parameter is used to indicate that the standard input, the standard error and the standard output are to be linked to the designated file, employ the communication protocol to receive a file name of the designated file sent by the first device, create a designated file with the received file name of the designated file as a file name, and send the file name of the designated file to the container operation submodule. The container operation submodule is further configured to write the standard input and standard error of the container to the designated file.
[0120] The container engine provided by the embodiment of the present disclosure is realized by dividing the container engine into a first device and a second device, the first device is provided on a management node, the second device is provided on a management node or a worker node, and the container engine core module is held on the first device without changing the manner of docking the container engine orchestration system to the container engine, and the container spacer module and the container runtime module are held on the second device. Because the resource consumption of the container spacer module and the container runtime module is small and the resource consumption of the container engine core module is large, the embodiment of the present disclosure adopts the original container engine orchestration system to dock the container engine, while saving the resource consumption of the worker node.
[0121] In some exemplary embodiments, the master agent sub-module is further configured to employ the communication protocol to send a container spacer module creation request to the communication sub-module of the second device, and to employ the communication protocol to receive a container spacer module creation response sent by the communication sub-module of the second device.
[0122] The slave agent module 2021 further includes a communication sub-module configured to receive a container spacer module creation request sent by the first device using the communication protocol, create a container spacer module, and send a container spacer module creation response to the first device using the communication protocol.
[0123] Those skilled in the art will understand that all or some of the functional modules / units of the steps, systems, and devices in the methods disclosed hereinabove may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware embodiments, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components. For example, one physical component may have multiple functions, and one function or step may be performed by the cooperation of several physical components. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). As is well known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic memory, or any other medium that can be used to store the desired information and that can be accessed by a computer. Additionally, those skilled in the art will know that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0124] Although examples of embodiments have been disclosed herein and specific terms have been used, they are used and should be interpreted as being generally descriptive only and not limiting. In some instances, it will be apparent to those skilled in the art that the features, characteristics, and / or elements described in combination with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in other examples, unless otherwise expressly indicated. Thus, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as defined by the appended claims.
Claims
1. A method for implementing a container engine applied to a first device provided in a management node, comprising: Sending a container operation request to a second device employing a communication protocol; and receiving a container operation response sent by the second device using the communication protocol.
2. prior to the step of transmitting the container operation request to the second device using a communication protocol; sending a node status inquiry request to the second device using the communication protocol, and receiving a node status inquiry response sent by the second device using the communication protocol, the node status inquiry response including node status information; employing the communication protocol to send a first node resource request to the second device, and employing the communication protocol to receive a first node resource request response sent by the second device; employing the communication protocol to send a second node resource application request to the second device, and employing the communication protocol to receive a second node resource application response sent by the second device; A method for implementing a container engine as described in claim 1, comprising at least one of steps of employing the communication protocol to send a container image operation request to the second device and employing the communication protocol to receive a container image operation response sent by the second device.
3. receiving a console type parameter indicating a link type for standard input, standard error, and standard output; employing the communication protocol to send the console type parameter in a create container or create process request to the second device; 2. The method of claim 1 further comprising:
4. If the console type parameter is used to indicate that the standard input, standard error, and standard output should be linked to the specified console, then employing the communication protocol to send the container creation request or process creation request including a port of the first device to the second device; employing said communication protocol to transmit a standard input of a container to said second device via a port of said first device; 4. The method for implementing a container engine as described in claim 3, further comprising the steps of: employing the communication protocol to listen to a port of the first device to receive standard output and standard error of the container sent by the second device, and outputting the standard output and standard error of the container to the designated console.
5. If the console type parameter is used to indicate that the standard input, standard error, and standard output should be linked to a specified file, 4. A method for implementing a container engine as described in claim 3, further comprising the step of employing the communication protocol to include a file name of the specified file in the container creation request or process creation request and sending it to the second device.
6. prior to the step of transmitting the container operation request to the second device using a communication protocol; sending a link establishment request to the second device using the communication protocol based on a preset address and port of the second device, and receiving a link establishment response sent by the second device using the communication protocol; A method for implementing a container engine as described in any one of claims 1 to 5, further comprising the steps of employing the communication protocol to send a registration command to the second device, and employing the communication protocol to receive a registration response sent by the second device.
7. Prior to the step of transmitting a first node resource application request to a second device, A method for implementing a container engine as described in any one of claims 1 to 5, further comprising the steps of employing the communication protocol to send a container spacer module creation request to the second device, and employing the communication protocol to receive a container spacer module creation response sent by the second device.
8. 8. The method of claim 7, wherein the container spacer module create response includes a port of the container spacer module.
9. The method for implementing a container engine according to any one of claims 1 to 5, wherein the communication protocol includes any one of a remote procedure call protocol (RPC), a socket, and an inter-process communication (IPC).
10. A method for implementing a container engine applied to a second device provided on a management node or a worker node, comprising: receiving a container operation request sent by the first device using a communication protocol and performing a container operation; and employing the communication protocol to transmit a container operation response to the first device.
11. before the step of receiving a container operation request sent by the first device by adopting a communication protocol; employing the communication protocol to receive a node status inquiry request sent by the first device, inquiring about node status information, and employing the communication protocol to send a node status inquiry response to the first device, the node status inquiry response including the node status information; receiving a first node resource request sent by a first device using the communication protocol, allocating a first node resource for the first device, and sending a first node resource request response to the first device using the communication protocol; receiving a second node resource request sent by the first device using the communication protocol, allocating second node resources for the first device, and sending a second node resource request response to the first device using the communication protocol; or The method for implementing a container engine as described in claim 10, further comprising at least one of steps of employing the communication protocol to receive a container image operation request sent by the first device, performing a container image operation, and employing the communication protocol to send a container image operation response to the first device.
12. 11. The method for implementing a container engine as described in claim 10, further comprising the step of employing the communication protocol to receive a console type parameter sent by the first device, the console type parameter indicating a link type for standard input, standard error and characterization output.
13. If the console type parameter is used to indicate that the standard input, standard error, and standard output should be linked to the specified console, then receiving the first device's port transmitted by the first device using the communication protocol; Employing the communication protocol to receive a standard input of a container sent by the first device through a port of the first device, and inputting the standard input of the container into the container; 13. The method of implementing a container engine as described in claim 12, further comprising the steps of receiving a standard output and a standard error of a container, and employing the communication protocol to send the standard output and standard error of the container to the first device via a port of the first device.
14. If the console type parameter is used to indicate that the standard input, standard error, and standard output should be linked to a specified file, receiving a file name of the specified file sent by the first device using the communication protocol; The method for implementing a container engine according to claim 12, further comprising the steps of: creating the designated file with the file name of the received designated file as its file name; and writing standard input and standard error of the container to the designated file.
15. before the step of receiving a container operation request sent by the first device by adopting a communication protocol; employing the communication protocol to listen to a pre-configured address and port of the second device to receive a link establishment request sent by the first device, and employing the communication protocol to send a link establishment response to the first device; A method for implementing a container engine as described in any one of claims 10 to 14, further comprising the steps of employing the communication protocol to receive a registration command sent by the first device, executing the registration command, and employing the communication protocol to send a registration response to the first device.
16. Prior to the step of receiving a first node resource application request sent by the first device, A method for implementing a container engine as described in any one of claims 10 to 14, further comprising the steps of employing the communication protocol to receive a container spacer module creation request sent by the first device, creating a container spacer module, and employing the communication protocol to send a container spacer module creation response to the first device.
17. 20. The method of claim 16, wherein the container spacer module create response includes a port of the container spacer module.
18. The method for implementing a container engine according to any one of claims 10 to 14, wherein the communication protocol includes any one of a remote procedure call protocol (RPC), a socket, and an inter-process communication (IPC).
19. At least one processor; An electronic device comprising: a memory in which at least one program is stored, and which, when executed by the at least one processor, realizes the method for realizing a container engine described in any one of claims 1 to 9 or the method for realizing a container engine described in any one of claims 10 to 18.
20. A computer-readable storage medium on which a computer program is stored, the computer-readable storage medium realizing, when the computer program is executed by a processor, a method for realizing a container engine according to any one of claims 1 to 9, or a method for realizing a container engine according to any one of claims 10 to 18.
21. A container engine including a first device provided on a management node and a second device provided on the management node or a worker node, The first device comprises: a container management submodule arranged to send container operation requests to the master agent submodule; a master agent sub-module configured to employ a communication protocol to send a container operation request to the container operation sub-module of the second device, and to employ the communication protocol to receive a container operation response sent by the container operation sub-module of the second device; a container engine core module having The second device comprises: a container spacer module including a container operation sub-module arranged to employ the communication protocol to receive a container operation request sent by a master agent sub-module of the first device and to send the container operation request to a container runtime module; a container runtime module arranged to perform container operations and send container operation responses to said container operations sub-module; Equipped with The container engine, wherein the container operation sub-module is further configured to employ the communication protocol to transmit a container operation response to a master agent sub-module of the first device.
22. The container engine according to claim 21, wherein a link between the first device and the second device is implemented using any one of a bus technology, a wired network technology, and a wireless network technology.
Citation Information
Patent Citations
A physical security system with multiple server nodes
JP2015535970A
Information processing system, information processing method, and program
JP2019128617A
