Container operation method, system, storage medium and server

By deploying an interception processing device between the container scheduling node and the container operation platform, intercepting container operation requests and performing extended parameter processing, the problem of limited container parameters in Kubernetes is solved, and flexible expansion of container parameters is achieved, reducing maintenance costs.

CN113590266BActive Publication Date: 2025-02-07TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Application Number
CN202110882745.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-02
Publication Date
2025-02-07
Estimated Expiration
2041-08-02

AI Technical Summary

Technical Problem

In the prior art, the container parameters covered by the container operation tasks initiated by users through Kubernetes are limited and cannot meet all usage scenarios, resulting in the need to modify Kubernetes code to extend the container parameters, which is not only unfavorable to promotion, but also increases the cost of later maintenance.

Method used

By deploying an interception processing device between the container scheduling node and the container operation platform, intercepting container operation requests, determining the processing timing and performing extended parameter processing, the expansion processing of the container operation results is realized and returned to the container scheduling node.

Benefits of technology

There is no need to modify Kubernetes code, which simplifies the cost of container parameter expansion, is highly scalable, and can adapt to more container parameter expansion needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113590266B_ABST
    Figure CN113590266B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a container operation method, system, storage medium and server, which are applied in the field of information processing technology. In the process of a container scheduling node initiating a container operation request to a container operation platform, the container operation request is intercepted by an interception processing device, and a processing time based on the extended parameters of the corresponding container is determined, and then when the processing time arrives, corresponding processing is performed based on the extended parameters of the corresponding container. In this way, when the container operation task triggered by the user through the container scheduling platform covers fewer container parameters, in order to adaptively implement container processing based on extended parameters when expanding container parameters, container processing based on extended parameters can be implemented through the interception processing device deployed between the container scheduling node and the container operation platform, without the need to modify the code of the container scheduling platform, which simplifies the cost of container parameter expansion and has strong scalability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information processing technology, and in particular to a container operation method, system, storage medium and server. Background Art

[0002] In the existing technology, operations on containers are generally used to achieve the purposes of resource deployment and expansion, and can be widely used in practical scenarios such as the Internet of Things, banking, government, transportation, industry, and education.

[0003] Among them, a container refers to a file formed by packaging at least one program and all its dependencies. One or more containers are encapsulated into a structure to form a Pod. Here, Pod is the smallest scheduling unit of container orchestration, and contains various parameter configurations of the container to guide the various startup parameters of the container. An existing resource scheduling management platform for container orchestration, Kubernetes, provides a user interaction interface through which users can initiate tasks for Pod operations; Kubernetes will use the corresponding container operation platform, Docker, to perform corresponding operations based on the tasks triggered by the user, such as creating, starting, stopping or deleting containers.

[0004] However, the tasks initiated by users through Kubernetes only cover a small number of container parameters, while many parameters are not covered. However, these parameters actually have usage scenarios and user demands. In order to expand the container parameters of Kubernetes in the existing technology, it is generally necessary to modify the Kubernete code. This method is not conducive to promotion and is not compatible with the Kubernetes platforms of other cloud vendors. The subsequent maintenance cost is high, especially when Kubernetes is rapidly upgraded and iterated. Summary of the invention

[0005] The embodiment of the present invention provides a container operation method, system, storage medium and server, which realize a simple expansion of container parameters.

[0006] An embodiment of the present invention provides a container operation method, including:

[0007] Intercept container operation requests initiated by the container scheduling node to the container operation platform;

[0008] Determining, according to the container operation request, a processing timing for performing processing based on an extended parameter of a corresponding container;

[0009] If the processing timing is after the container operation platform performs a corresponding operation on the container operation request, forwarding the container operation request to the container operation platform;

[0010] When receiving the container operation result returned by the container operation platform according to the container operation request, performing corresponding processing based on the extended parameters of the container related to the container operation result to obtain the processed container operation result;

[0011] The processed container operation result is returned to the container scheduling node.

[0012] Another aspect of an embodiment of the present invention provides a container operating system, including:

[0013] An interception unit, used to intercept a container operation request initiated by a container scheduling node to a container operation platform;

[0014] A processing timing unit, configured to determine, according to the container operation request, a processing timing for performing processing based on an extended parameter of a corresponding container;

[0015] a request forwarding unit, configured to forward the container operation request to the container operation platform if the processing timing is after the container operation platform performs a corresponding operation on the container operation request;

[0016] an extended processing unit, configured to, upon receiving the container operation result returned by the container operation platform according to the container operation request, perform corresponding processing based on the extended parameters of the container related to the container operation result to obtain a processed container operation result;

[0017] The result returning unit is used to return the processed container operation result to the container scheduling node.

[0018] Another aspect of the embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of computer programs, wherein the computer programs are suitable for being loaded by a processor and executing the container operation method as described in one aspect of the embodiment of the present invention.

[0019] Another aspect of the embodiment of the present invention further provides a server, including a processor and a memory;

[0020] The memory is used to store multiple computer programs, and the computer programs are used to be loaded by the processor and execute the container operation method as described in one aspect of an embodiment of the present invention; the processor is used to implement each computer program in the multiple computer programs.

[0021] It can be seen that in the method of this embodiment, in the process of the container scheduling node initiating a container operation request to the container operation platform, the container operation request is intercepted by the interception processing device, and the processing time based on the extended parameters of the corresponding container is determined, and then when the processing time arrives, the corresponding processing is performed based on the extended parameters of the corresponding container. In this way, when the container operation task triggered by the user through the container scheduling platform covers fewer container parameters, in order to adaptively implement container processing based on extended parameters when expanding container parameters, container processing based on extended parameters can be implemented through the interception processing device deployed between the container scheduling node and the container operation platform, without the need to modify the code of the container scheduling platform, which simplifies the cost of container parameter expansion and has strong scalability. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present invention 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, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0023] Figure 1 is a schematic diagram of a container operation method provided by an embodiment of the present invention;

[0024] Figure 2 is a flow chart of a container operation method provided by one embodiment of the present invention;

[0025] Figure 3 is a flow chart of another container operation method provided by one embodiment of the present invention;

[0026] Figure 4 is a schematic diagram of a system used in a container operation method in an application embodiment of the present invention;

[0027] Figure 5 is a schematic diagram of a container operation method provided in an application embodiment of the present invention;

[0028] Figure 6 is a schematic diagram of a container operation method provided in another application embodiment of the present invention;

[0029] Figure 7 is a schematic diagram of a distributed system to which a container operation method in another application embodiment of the present invention is applied;

[0030] Figure 8 is a schematic diagram of a block structure in another application embodiment of the present invention;

[0031] Fig. 9is a schematic diagram of the logical structure of a container operating system provided by an embodiment of the present invention;

[0032] Fig.10 It is a schematic diagram of the logical structure of a server provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0035] The embodiment of the present invention provides a container operation method, which is mainly used in Figure 1 In the system shown, the system includes a container scheduling platform 10, a plurality of (n are used as an example in the figure) container scheduling nodes 11, a container operation platform 12, an interception processing device 13 and an extended parameter processing device 14, wherein:

[0036] The container scheduling platform 10 may provide a user interaction interface, so that the user may trigger a container operation task through the user interaction interface, and the container scheduling platform 10 may call a corresponding container scheduling node 11 according to the container involved in the operation task triggered by the user to implement the operation on the container.

[0037] Any container scheduling node 11 is used to schedule and manage the operation of one or more containers, and can initiate a container operation request to the container operation platform 12. The parameter information of the managed container is also stored in the container scheduling node 11. Multiple container scheduling nodes 11 are deployed in a cluster manner.

[0038] The container operation platform 12 is used to perform corresponding operations according to the container operation request after receiving the container operation request, such as starting the container, traversing the container, creating a container or deleting the container. One container operation platform 12 may correspond to one or more container scheduling nodes 11.

[0039] The interception processing device 13 is specifically used to intercept the container operation request initiated by the container scheduling platform during the process of the container scheduling node 11 calling the container operation platform 12 to perform container operation, and trigger the extended parameter processing device 14 to perform certain processing on the extended parameters of the container involved in the container operation request. Here, the interception processing device 13 can be connected to one or more extended parameter processing devices 14 (only one is drawn in the figure). In actual applications, the functions implemented by the interception processing device 13 and the extended parameter processing device 14 can be deployed in the same physical device, that is, intercepting the container operation request and performing certain processing on the extended parameters of the container are both implemented by the physical device.

[0040] Furthermore, the user can also initiate a process of creating a container encapsulation structure through the container scheduling platform 10, through which the parameters of the container can be expanded. Specifically, the container scheduling platform 10 will display a creation interface of the container encapsulation structure, and the user will input the setting parameters of the container encapsulation structure to be created in the creation interface of the container encapsulation structure and initiate a creation request of the container encapsulation structure through the creation interface of the container encapsulation structure, and the container scheduling platform 10 will select a container scheduling node 11 according to the creation request of the container encapsulation structure, and store the setting parameters of the container encapsulation structure to be created input by the user in the selected container scheduling node 11. In this way, the user can trigger the operation task of the container encapsulated in the created container encapsulation structure through the user interaction interface provided by the container scheduling platform 10.

[0041] The container encapsulation structure is used to encapsulate one or more containers, and the setting parameters that the user inputs into the creation interface may include parameters of the container encapsulated in the container encapsulation structure to be created, such as existing parameters and extended parameters of the container.

[0042] In a specific implementation, if the container scheduling platform 10 is specifically a Kubernetes platform, the container scheduling node 11 is specifically a Kubelet node, which is a management component responsible for starting and running one or more Pods, wherein a Pod is the smallest scheduling unit of container orchestration, which contains various parameter configurations of the container to guide the various startup parameters for starting the container, and a Pod encapsulates one or more containers; the container operation platform 12 is specifically Docker, which is specifically a component for managing the container life cycle, such as creating a container, starting a container, stopping a container, deleting a container, etc.; the extended parameter processing device 14 is specifically a Plugin, which is a component for setting extended parameters.

[0043] In this case, the user can also initiate the process of creating a Pod through the container scheduling platform 10, where Pod is a container encapsulation structure and is the smallest scheduling unit for container orchestration on the Kubernetes platform. It can encapsulate various parameters of the container. Specifically, the container scheduling platform 10 will display the Pod creation interface. The user enters the setting parameters of the Pod to be created in the Pod creation interface and initiates a Pod creation request through the Pod creation interface. The container scheduling platform 10 will select a container scheduling node 11 according to the Pod creation request, and store the setting parameters of the Pod to be created entered by the user in the selected container scheduling node 11. In this way, the user can trigger the operation task of the container encapsulated by the created Pod through the user interaction interface provided by the container scheduling platform 10.

[0044] Specifically, the above-mentioned interception processing device 13 can implement the container operation process through the following steps:

[0045] Intercepting a container operation request initiated by a container scheduling node to a container operation platform; determining a processing timing based on extended parameters of a corresponding container according to the container operation request; forwarding the container operation request to the container operation platform if the processing timing is after the container operation platform performs a corresponding operation on the container operation request; upon receiving a container operation result returned by the container operation platform according to the container operation request, performing corresponding processing based on extended parameters of the container related to the container operation result to obtain a processed container operation result; and returning the processed container operation result to the container scheduling node.

[0046] In this way, when the container operation task triggered by the user through the container scheduling platform covers fewer container parameters, in order to adaptively implement container processing based on extended parameters when expanding container parameters, container processing based on extended parameters can be implemented through an interception processing device deployed between the container scheduling node and the container operation platform without modifying the code of the container scheduling platform, which simplifies the cost of container parameter expansion and has strong scalability.

[0047] It should be noted that the container operation method in the embodiment of the present invention can be applied to a server deployment scenario based on cloud technology, and the corresponding container can be deployed in the cloud server. Among them, cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize the calculation, storage, processing, and sharing of data. It is mainly a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the application of cloud computing business model, which can form a resource pool, which is used on demand and flexible and convenient. Cloud computing technology will become an important support. The background service of the technical network system requires a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, each item may have its own identification mark in the future, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately, and all kinds of industry data require strong system backing support, which can only be achieved through cloud computing.

[0048] An embodiment of the present invention provides a container operation method, which is mainly performed by the above-mentioned interception processing device. The flow chart is as follows: Figure 2 As shown, including:

[0049] Step 101: intercept a container operation request initiated by a container scheduling node to a container operation platform.

[0050] It can be understood that a user can create a container in any container scheduling node through the container scheduling platform and store the parameter information of the container, so that the user can initiate the operation task of the container through the user interaction interface provided by the container scheduling platform. Among them, the parameter information of the container stored in any container scheduling node may include: the container parameter information covered by the operation task of the container triggered by the user through the container scheduling platform, and the container parameter information that cannot be supported by the operation task of the container, that is, the extended parameter information.

[0051] Furthermore, when a user triggers a container operation task through a user interaction interface provided by the container scheduling platform, the container scheduling platform will call the container scheduling node corresponding to the container involved in the operation task and initiate a container operation request to the container operation platform according to the actual needs of the operation task. The interception processing device of the embodiment of the present invention will intercept the container operation request when the container scheduling node initiates the container operation request to the container operation platform.

[0052] Here, the container operation request can be a request to create a container, a request to start a container, a request to stop a container, a request to delete a container, or a request to traverse a container, etc., and an operation task of the container triggered by the above user can correspond to one or more container operation requests, that is, when the user triggers the operation task of the container, the container scheduling node will initiate one or more container operation requests to the container operation platform as needed. For example: if the operation task of the container triggered by the user is to delete the container that meets certain conditions, the container scheduling node will first initiate a container traversal request to the container operation platform to request the container operation platform to traverse all containers managed by at least one container scheduling node to find a container that meets certain conditions; then the container scheduling node will initiate a container deletion request to request the container operation platform to delete the container found before.

[0053] The container operation request may include information such as identification information of the container to be operated.

[0054] Step 102: Determine, according to the container operation request, a processing timing for processing based on the extended parameters of the corresponding container.

[0055] Here, the extended parameters of the container refer to the container parameter information that cannot be covered by the container operation tasks triggered by the user through the container scheduling platform.

[0056] The processing timing based on the extended parameters of the container may include: after the container operation platform performs a corresponding operation on the container operation request, and before the container operation platform performs a corresponding operation on the container operation request. The processing timing can be determined specifically according to the request type of the container operation request. For example, if the request type is a traversal container request, the processing timing is after the container operation platform performs a corresponding operation on the container operation request. If the request type is a start container request or a stop container request, the processing timing is before the container operation platform performs a corresponding operation on the container operation request.

[0057] Step 103: If the processing timing is after the container operation platform performs a corresponding operation on the container operation request, the container operation request is first forwarded to the container operation platform, and the container operation platform first performs a corresponding operation according to the container operation request to obtain a container operation result.

[0058] Step 104: when receiving the container operation result returned by the container operation platform according to the container operation request, corresponding processing is performed based on the extended parameters of the container related to the container operation result to obtain the processed container operation result.

[0059] Specifically, the interception processing device can directly perform corresponding processing based on the extended parameters of the container related to the container operation result; or, the interception processing device can transmit the container operation result to the extended parameter processing device, and the extended parameter processing device performs corresponding processing based on the extended parameters of the related container.

[0060] Specifically, when performing corresponding processing based on the extended parameters of the container related to the container operation result, it is necessary to first obtain the first parameter information of the container related to the container operation result. If the extended parameters are included in the obtained first parameter information, the container operation result is processed accordingly according to the first parameter value of the extended parameters in the first parameter information, wherein the corresponding processing here mainly involves performing certain processing on the container involved in the container operation result, such as modifying the attribute value of the container, etc., and the specific processing method needs to be determined according to the first parameter information; if the obtained first parameter information does not include the extended parameters, or it is determined not to process the container operation result according to the first parameter value of the obtained first parameter information, it means that the container operation result does not need to be further processed, and the container operation result can be directly returned to the container scheduling node.

[0061] When obtaining the first parameter information, the container scheduling node to which the container related to the container operation result belongs may be used to obtain information about the container encapsulation structure (such as the above-mentioned Pod) that encapsulates the related container, which may include the first parameter information. Here, the various parameter information of the container encapsulated in the container encapsulation structure (including the parameters covered by the operation task of the container triggered by the user through the container scheduling platform and the extended parameters not covered) is set by the container scheduling platform.

[0062] For example, the container operation request is a container traversal request, and the container operation result includes information of multiple traversed containers. If the first parameter value of an extended parameter of a container among the multiple containers includes hidden, the container is filtered from the container operation result, and the processed container operation result obtained includes information of the remaining containers after filtering; if the extended parameter of another container among the multiple containers is that at least one attribute of the other container has been modified, and the first parameter value of the extended parameter of the other container includes a modified attribute value of at least one attribute of the other container (such as a container name and tag information, etc.), then the attribute value of the corresponding at least one attribute of the other container in the container operation result is replaced with the modified attribute value.

[0063] Step 105: Return the processed container operation result to the container scheduling node.

[0064] Further, steps 103 to 105 are processing methods in a case of a processing opportunity. In another case, Figure 3 As shown, after executing step 102, the interception processing device may execute the following steps:

[0065] Step 201: if the processing timing is before the container operation platform performs a corresponding operation on the container operation request, the container operation request is modified according to the extended parameters of the container corresponding to the container operation request to obtain a modified container operation request.

[0066] Specifically, the interception processing device can first obtain the second parameter information of the corresponding container. If the second parameter information includes an extended parameter, the container operation request is modified according to the second parameter value of the extended parameter in the second parameter information; if the second parameter information does not include the extended parameter, or it is determined not to modify the container operation request according to the second parameter value of the extended parameter in the second parameter information, the container operation request is sent to the container operation platform, so that the container operation platform performs the container operation according to the container operation request.

[0067] Among them, when obtaining the second parameter information, the container scheduling node to which the container corresponding to the container operation request belongs can be specifically obtained from the container encapsulation structure (such as the above-mentioned Pod) that encapsulates the relevant container, which may include the second parameter information. Here, the various parameter information of the container encapsulated in the container encapsulation structure (including the parameters covered by the operation task of the container triggered by the user through the container scheduling platform and the extended parameters not covered) is set by the container scheduling platform, which can be specifically described in the above embodiment and will not be repeated here.

[0068] For example, if the container operation request is a container creation request, and the second parameter value of the extended parameter includes an extended attribute value of the corresponding container, such as adding 128M shared content, setting the maximum number of open files, setting the container control group (Cgroup) path, etc., a field for creating an extended attribute value of the corresponding container is added to the container creation request. Here, Cgroup refers to a mechanism that can limit and record the physical resources used by isolated process groups.

[0069] Step 202: Send the modified container operation request to the container operation platform, so that the container operation platform performs the container operation according to the modified container operation request.

[0070] It can be seen that in the method of this embodiment, in the process of the container scheduling node initiating a container operation request to the container operation platform, the container operation request is intercepted by the interception processing device, and the processing time based on the extended parameters of the corresponding container is determined, and then when the processing time arrives, the corresponding processing is performed based on the extended parameters of the corresponding container. In this way, when the container operation task triggered by the user through the container scheduling platform covers fewer container parameters, in order to adaptively implement container processing based on extended parameters when expanding container parameters, container processing based on extended parameters can be implemented through the interception processing device deployed between the container scheduling node and the container operation platform, without the need to modify the code of the container scheduling platform, which simplifies the cost of container parameter expansion and has strong scalability.

[0071] The following is a specific application example to illustrate the container operation method of the embodiment of the present invention, which can be applied as follows: Figure 4 The system shown includes: Kubernetes platform (i.e., the container scheduling platform mentioned above), multiple Kubelet nodes (i.e., the container scheduling nodes mentioned above), Docker (i.e., the container operation platform mentioned above), interception processing device and Plugin (i.e., the extended parameter processing device mentioned above). In order to implement the container operation method of the present invention, it is necessary to first deploy the interception processing device and the extended parameter processing device. Specifically, the following configurations can be performed:

[0072] (1) It is necessary to pre-set a configuration file in the interception processing device. Specifically, the configuration file may include parameters used by the interception processing device in executing the container operation method in the embodiment of the present invention, and may specifically include parameter values ​​of the following configuration parameters: version number of the configuration file, type of the configuration file, monitoring address and information of the extended parameter processing device. The information of the extended parameter processing device may include connection configuration, name, connection address and processing timing based on the extended parameters, etc.

[0073] In a specific implementation, the configuration file may include parameter values ​​of the configuration parameters shown in Table 1 below:

[0074]

[0075] Table 1

[0076] (2) Configure the Kubelet node and Plugin. Specifically, the user needs to configure the parameter value of the connection address parameter of the Kubelet node to connect to Docker to the parameter value of the monitoring address of the interception processing device, namely, listenAddress, and at the same time, start the corresponding Plugin.

[0077] In a specific implementation, Figure 5As shown, the system of this embodiment can implement container operation by using the following steps:

[0078] In step 301, a user triggers an operation task on a container packaged in a Pod through a user interaction interface provided by the Kubernetes platform.

[0079] Among them, since the containers stored in the Kubelet node are all encapsulated in the Pod, that is, the Pod is the smallest unit of container operation, the operation task on a certain container triggered by the user is specifically an operation task on the container encapsulated in a certain Pod.

[0080] In step 302, the Kubernetes platform determines that the corresponding Pod belongs to a certain Kubelet node for management and scheduling according to the operation task. The Kubernetes platform will call the Kubelet node to implement the operation on the container. Specifically, the operation task can be sent to the Kubelet node.

[0081] In step 303, the Kubelet node determines that it needs to initiate a container operation request to the corresponding Docker according to the operation task. In this embodiment, a container creation request is used as an example. Specifically, the Kubelet node will initiate a Post request with a Uniform Resource Locator (URL) of / container / create.

[0082] Because before the Kubelet node initiates the request to create a container, a Pod, i.e., a container encapsulation structure, has been created in the Kubelet node, and various parameter information has been set, including the extended parameters of the container and the parameters supported by the operation tasks of the container initiated by the Kubernetes platform, when the Kubelet node initiates the request to create a container in this step 303, it is necessary to specify a Pod in the Kubelet node as the encapsulation structure for creating the container, and the initiated request to create a container will not involve the extended parameters of the container, and the request to create a container will be modified in the subsequent step 306.

[0083] In step 304, the interception processing device intercepts the container creation request and determines the processing time based on the extended parameters of the corresponding container, specifically the PreHook stage, that is, before Docker performs corresponding operations on the container creation request, it sends the container creation request to Plugin for processing.

[0084] Step 305, after receiving the request to create a container, the Plugin will obtain the second parameter information of the container corresponding to the request to create a container, which can be specifically the Annotations of the Pod encapsulated by the container. Among them, an annotation parameter on the Pod of Kubernetes can add some information to the Pod to help identify the Pod or provide additional information.

[0085] Step 306, if the second parameter information includes the second parameter value of the extended parameter of the corresponding container, the Plugin modifies the container creation request according to the second parameter value, such as adding fields or deleting fields in the container creation request, or modifying existing fields, etc., obtains the modified container creation request and returns it to the interception processing device, and the interception processing device sends the modified container creation request to Docker. After Docker performs corresponding operations on the modified container creation request, it can return the first operation result obtained based on the modified container creation request to the Kubelet node through the interception processing device.

[0086] Step 307 (indicated by a dotted arrow in the figure), if the second parameter information does not include the second parameter value of the extended parameter of the corresponding container, or it is determined based on the second parameter value that the start container creation request does not need to be modified, the Plugin returns the original container creation request to the interception processing device, and the interception processing device sends the start container request to Docker. After Docker performs corresponding operations on the container creation request, it can return the second operation result obtained according to the container creation request to the Kubelet node through the interception processing device.

[0087] In another specific implementation, Figure 6 As shown, the system of this embodiment can implement container operation by using the following steps:

[0088] In step 401, a user triggers an operation task on a container packaged in a Pod through a user interaction interface provided by the Kubernetes platform.

[0089] In step 402, the Kubernetes platform determines that the corresponding Pod belongs to a certain Kubelet node for management and scheduling according to the operation task. The Kubernetes platform will call the Kubelet node to implement the operation on the container. Specifically, the operation task can be sent to the Kubelet node.

[0090] In step 403, the Kubelet node determines that it needs to initiate a container operation request to the corresponding Docker according to the operation task. In this embodiment, the container traversal request is used as an example. Specifically, the Kubelet node initiates a Get request with the URL / containers / json.

[0091] In step 404, the interception processing device intercepts the traversal container request and determines the processing time based on the extended parameters of the corresponding container, specifically the PostHook stage, that is, after Docker performs the corresponding operation on the traversal container request, it sends the traversal container request to Docker.

[0092] Step 405: Docker obtains the container operation result according to the traversal container request, including information of multiple Pod encapsulated containers, and returns the container operation result to the interception processing device, which sends the container operation result to the Plugin.

[0093] Step 406, after receiving the container operation result, the Plugin obtains the first parameter information of the container corresponding to the container operation result, which may specifically be the Annotations of the Pod encapsulated by the container.

[0094] Step 407, if the first parameter information includes the first parameter value of the extended parameter of the corresponding container, the Plugin performs corresponding processing according to the first parameter value, such as filtering the container encapsulated by a Pod in the container operation result, obtaining the processed container operation result and returning it to the interception processing device, and the interception processing device returns the processed container operation result to the Kubelet node.

[0095] Step 408 (indicated by a dotted arrow in the figure), if the first parameter information does not include the first parameter value of the extended parameter of the corresponding container, or it is determined based on the first parameter value that no further processing of the container operation result is required, the Plugin will directly return the container operation result to the interception processing device, and the interception processing device will return the container operation result to the Kubelet node.

[0096] It can be seen that the container operation method in this embodiment is mainly based on the container cloud scenario of Kubernetes, and solves the problem that different iteration cycles of Kubernetes cannot support the advanced parameter characteristics of the underlying container operation platform, namely Docker, through a bypass interception and forwarding mechanism, namely the implementation of the above-mentioned interception processing device. In addition, in this embodiment, when expanding the parameters of the encapsulated container in the Pod, it is not necessary to invade the internal code logic of Kubernetes to implement container operations based on extended parameters, which has strong scalability, and users can also flexibly configure the configuration file and plug-in of the interception processing device, namely the above-mentioned Plugin, according to their own needs to provide more parameter functions.

[0097] The following is another specific application example to illustrate the container operation method in the present invention. The container operating system in the embodiment of the present invention is mainly a distributed system 100, which may include a client 300 and multiple nodes 200 (any form of computing device in the access network, such as a server, a user terminal), and the client 300 is connected to the node 200 through network communication.

[0098] Take the distributed system as the blockchain system as an example, see Figure 7 This is an optional structural diagram of the distributed system 100 provided by the embodiment of the present invention applied to the blockchain system, which is formed by multiple nodes 200 (any form of computing devices in the access network, such as servers and user terminals) and clients 300, and a peer-to-peer (P2P) network is formed between the nodes. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP) protocol. In a distributed system, any machine such as a server or a terminal can join and become a node, and the node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0099] See also Figure 7 The functions of each node in the blockchain system shown include:

[0100] 1) Routing: a basic function of a node, used to support communication between nodes.

[0101] In addition to the routing function, the node can also have the following functions:

[0102] 2) Applications, which are deployed in the blockchain to implement specific businesses according to actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to the temporary block when they successfully verify the source and integrity of the record data.

[0103] For example, the business implemented by the application includes code that implements the container operation function, and the container operation function mainly includes:

[0104] Intercepting a container operation request initiated by a container scheduling node to a container operation platform; determining a processing timing based on extended parameters of a corresponding container according to the container operation request; forwarding the container operation request to the container operation platform if the processing timing is after the container operation platform performs a corresponding operation on the container operation request; upon receiving a container operation result returned by the container operation platform according to the container operation request, performing corresponding processing based on extended parameters of the container related to the container operation result to obtain a processed container operation result; and returning the processed container operation result to the container scheduling node.

[0105] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.

[0106] See also Figure 8 An optional schematic diagram of the block structure provided by the embodiment of the present invention, each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block, and each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.

[0107] The embodiment of the present invention also provides a container operating system, the structural diagram of which is as follows Fig. 9 As shown, it may specifically include:

[0108] The interception unit 20 is used to intercept the container operation request initiated by the container scheduling node to the container operation platform.

[0109] The processing timing unit 21 is used to determine a processing timing for processing based on the extended parameters of the corresponding container according to the container operation request intercepted by the interception unit 20.

[0110] The processing timing unit 21 is specifically configured to determine a processing timing for processing based on the extended parameters of the corresponding container according to the request type of the container operation request.

[0111] The request forwarding unit 22 is configured to forward the container operation request to the container operation platform if the processing timing determined by the processing timing unit 21 is after the container operation platform performs a corresponding operation on the container operation request.

[0112] The extended processing unit 23 is used to receive the container operation result returned by the container operation platform according to the container operation request forwarded by the request forwarding unit 22, and perform corresponding processing based on the extended parameters of the container related to the container operation result to obtain the processed container operation result.

[0113] The extension processing unit 23 is specifically used to obtain the first parameter information of the container related to the container operation result; if the first parameter information includes an extension parameter, the container operation result is processed accordingly according to the first parameter value of the extension parameter in the first parameter information. Wherein, when obtaining the first parameter information, the extension processing unit 23 is specifically used to obtain the parameter information of the container encapsulation structure encapsulating the related container from the container scheduling node to which the container related to the container operation result belongs, and the parameter information of the container encapsulation structure includes the first parameter information; wherein the various parameter information of the container encapsulated in the container encapsulation structure is set by the container scheduling platform.

[0114] Furthermore, the extended processing unit 23 is also used to notify the result return unit 24 to return the container operation result to the container operation platform if the first parameter information does not include an extended parameter, or if it is determined not to process the container operation result based on the first parameter value of the extended parameter in the first parameter information.

[0115] For example: the container operation request is a container traversal request, and the container operation result includes information of multiple traversed containers; when the extension processing unit 23 performs corresponding processing on the container operation result according to the first parameter value of the extension parameter in the first parameter information, it is specifically used to filter the container from the container operation result if the first parameter value of the extension parameter of a container among the multiple containers is hidden; if the first parameter value of the extension parameter of another container among the multiple containers includes a modified attribute value of at least one attribute of the another container, replace the corresponding at least one attribute value of the other container in the container operation result with the modified attribute value.

[0116] The result returning unit 24 is used to return the processed container operation result obtained by the extended processing unit 23 to the container scheduling node.

[0117] Furthermore, the container operating system of this embodiment may also include:

[0118] The request modification unit 25 is used to modify the container operation request according to the extended parameters of the corresponding container to obtain a modified container operation request if the processing timing obtained by the processing timing unit 21 is before the container operation platform performs a corresponding operation on the container operation request.

[0119] The request modification unit 25 is specifically used to obtain the second parameter information of the corresponding container; if the second parameter information includes an extended parameter, the container operation request is modified according to the second parameter value of the extended parameter in the second parameter information. The request modification unit 25 is also used to notify the request sending unit 26 to send the container operation request to the container operation platform if the second parameter information does not include an extended parameter, or if it is determined not to modify the container operation request according to the second parameter value of the extended parameter in the second parameter information, so that the container operation platform performs container operation according to the container operation request. Wherein, when obtaining the second parameter information, the request modification unit 25 is specifically used to obtain the parameter information of the container encapsulation structure that encapsulates the corresponding container from the container scheduling node to which the corresponding container belongs, and the parameter information of the container encapsulation structure includes the second parameter information; wherein, the various parameter information of the container encapsulated in the container encapsulation structure is set by the container scheduling platform.

[0120] For example, when the container operation request is a request to create a container, the request modification unit 25 modifies the container operation request according to the second parameter value of the extended parameter in the second parameter information, and is specifically used to add a field for creating an extended attribute value of the corresponding container in the container creation request if the second parameter value includes an extended attribute value of the corresponding container.

[0121] The request sending unit 26 is used to send the modified container operation request obtained by the request modifying unit 25 to the container operation platform, so that the container operation platform performs the container operation according to the modified container operation request.

[0122] It can be seen that when the container operation task triggered by the user through the container scheduling platform covers fewer container parameters, in order to adaptively implement container processing based on extended parameters when expanding container parameters, the container operating system in this embodiment can be deployed between the container scheduling node and the container operation platform to implement container processing based on extended parameters without modifying the code of the container scheduling platform, which simplifies the cost of container parameter expansion and has strong scalability.

[0123] The embodiment of the present invention further provides a server, the structural diagram of which is shown in Fig.10As shown, the server may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 30 (for example, one or more processors) and memory 31, and one or more storage media 32 (for example, one or more mass storage devices) storing application programs 321 or data 322. Among them, the memory 31 and the storage medium 32 can be short-term storage or permanent storage. The program stored in the storage medium 32 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 30 can be configured to communicate with the storage medium 32 and execute a series of instruction operations in the storage medium 32 on the server.

[0124] Specifically, the application 321 stored in the storage medium 32 includes an application for container operation, and the program may include the interception unit 20, the processing timing unit 21, the request forwarding unit 22, the extension processing unit 23, the result return unit 24, the request modification unit 25 and the request sending unit 26 in the above-mentioned container operating system, which are not described in detail here. Furthermore, the central processor 30 can be configured to communicate with the storage medium 32 and execute a series of operations corresponding to the application for container operation stored in the storage medium 32 on the server.

[0125] The server may also include one or more power supplies 33, one or more wired or wireless network interfaces 34, one or more input and output interfaces 35, and / or one or more operating systems 323, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, FreeBSD TM, etc.

[0126] The steps performed by the interception processing device in the above method embodiment can be based on the Fig.10 The structure of the server is shown.

[0127] Another aspect of the embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of computer programs, wherein the computer programs are suitable for being loaded by a processor and executing the container operation method executed by the above-mentioned interception processing device.

[0128] Another aspect of the embodiment of the present invention further provides a server, including a processor and a memory;

[0129] The memory is used to store multiple computer programs, and the computer programs are used to be loaded by the processor and execute the container operation method executed by the above-mentioned interception processing device; the processor is used to implement each computer program in the multiple computer programs.

[0130] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the container operation method provided in the above-mentioned various optional implementations.

[0131] A person skilled in the art may understand that all or part of the steps in the various methods of the above-mentioned embodiments may be completed by instructing the relevant hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0132] The above is a detailed introduction to a container operation method, system, storage medium and server provided in an embodiment of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A container operation method, characterized in that: include: Intercept container operation requests initiated by the container scheduling node to the container operation platform; Determining, according to the request type of the container operation request, a processing timing for performing processing based on an extended parameter of a corresponding container; If the processing timing is after the container operation platform performs a corresponding operation on the container operation request, forwarding the container operation request to the container operation platform; When receiving the container operation result returned by the container operation platform according to the container operation request, performing corresponding processing based on the extended parameters of the container related to the container operation result to obtain the processed container operation result; The processed container operation result is returned to the container scheduling node; wherein the corresponding processing based on the extended parameters of the container related to the container operation result specifically includes: Acquire first parameter information of a container related to the container operation result; If the first parameter information includes an extended parameter, the container operation result is processed accordingly according to the first parameter value of the extended parameter in the first parameter information; If the first parameter information does not include an extended parameter, or if it is determined not to process the container operation result according to the first parameter value of the extended parameter in the first parameter information, the container operation result is returned to the container operation platform.

2. The method according to claim 1, characterized in that The obtaining of the first parameter information of the container related to the container operation result specifically includes: Acquire, from a container scheduling node to which a container related to the container operation result belongs, parameter information of a container encapsulation structure encapsulating the related container, where the parameter information of the container encapsulation structure includes the first parameter information; Among them, various parameter information of the container encapsulated in the container encapsulation structure is set through the container scheduling platform.

3. The method according to claim 1, characterized in that The container operation request is a container traversal request, and the container operation result includes information of multiple traversed containers; The corresponding processing of the container operation result according to the first parameter value of the extended parameter in the first parameter information specifically includes: If a first parameter value of an extended parameter of a container among the multiple containers is hidden, filtering the container from the container operation results; If the first parameter value of the extended parameter of another container in the multiple containers includes a modified attribute value of at least one attribute of the another container, the corresponding at least one attribute value of the another container in the container operation result is replaced with the modified attribute value.

4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: If the processing timing is before the container operation platform performs a corresponding operation on the container operation request, modifying the container operation request according to the extended parameters of the corresponding container to obtain a modified container operation request; The modified container operation request is sent to the container operation platform, so that the container operation platform performs the container operation according to the modified container operation request.

5. The method according to claim 4, characterized in that The step of modifying the container operation request according to the extended parameters of the corresponding container to obtain a modified container operation request specifically includes: Acquire second parameter information of the corresponding container; If the second parameter information includes an extended parameter, modify the container operation request according to a second parameter value of the extended parameter in the second parameter information; If the second parameter information does not include an extended parameter, or if it is determined that the container operation request is not to be modified based on the second parameter value of the extended parameter in the second parameter information, the container operation request is sent to the container operation platform so that the container operation platform performs the container operation according to the container operation request.

6. The method according to claim 5, characterized in that If the container operation request is a request to create a container, modifying the container operation request according to the second parameter value of the extended parameter in the second parameter information specifically includes: If the second parameter value includes an extended attribute value of the corresponding container, a field for creating an extended attribute value of the corresponding container is added to the create container request.

7. A container operating system, characterized in that: include: An interception unit, used to intercept a container operation request initiated by a container scheduling node to a container operation platform; A processing timing unit, configured to determine, according to a request type of the container operation request, a processing timing for processing based on an extended parameter of a corresponding container; a request forwarding unit, configured to forward the container operation request to the container operation platform if the processing timing is after the container operation platform performs a corresponding operation on the container operation request; an extended processing unit, configured to, upon receiving the container operation result returned by the container operation platform according to the container operation request, perform corresponding processing based on the extended parameters of the container related to the container operation result to obtain a processed container operation result; A result returning unit, used to return the processed container operation result to the container scheduling node; Among them, the extended processing unit is specifically used to obtain the first parameter information of the container related to the container operation result; if the first parameter information includes an extended parameter, the container operation result is processed accordingly according to the first parameter value of the extended parameter in the first parameter information; if the first parameter information does not include the extended parameter, or it is determined not to process the container operation result according to the first parameter value of the extended parameter in the first parameter information, the container operation result is returned to the container operation platform.

8. The system according to claim 7, characterized in that Also includes: a request modification unit, configured to modify the container operation request according to the extended parameters of the corresponding container to obtain a modified container operation request if the processing timing is before the container operation platform performs a corresponding operation on the container operation request; The request sending unit is used to send the modified container operation request to the container operation platform, so that the container operation platform performs the container operation according to the modified container operation request.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of computer programs, and the computer programs are suitable for being loaded by a processor and executing the container operating method according to any one of claims 1 to 6.

10. A server, characterized in that: including a processor and a memory; The memory is used to store a plurality of computer programs, and the computer programs are used to be loaded by a processor and execute the container operation method according to any one of claims 1 to 6; the processor is used to implement each computer program in the plurality of computer programs.

Citation Information

Patent Citations

  • Method and system for realizing container storage capacity expansion

    CN111104368A

  • Storage volume management method based on multi-architecture container cloud platform and related parts

    CN112416245A

Cited By

  • Method for dynamically mounting file system in container, medium and equipment

    CN122133194A