Method, device and computer-readable medium for configuring logic in a container
Admission Controller automatically injects logic execution files when Pod is generated, which solves the problem of high operation and maintenance costs in the container environment, realizes flexible management of logic and application monitoring within the container, and reduces operation and maintenance costs.
Patent Information
- Application Number
- CN201911096439.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-11
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2039-11-11
AI Technical Summary
In a container environment, existing technical solutions require modifying and recreating images or manually modifying deployment configurations to inject and upgrade monitoring logic, resulting in high operation and maintenance costs and inconvenience in modification and upgrades.
The Admission Controller is used to automatically modify the configuration when the Pod is generated, download and call the logic execution file, and implement logic injection, avoiding direct modification of the image and deployment configuration. The injection logic is managed uniformly through the Kubernetes webhook mechanism.
It reduces operation and maintenance costs, simplifies the logic modification and upgrade process, and realizes automatic configuration of application monitoring and elastic expansion within the container.
Smart Images

Figure CN112783642B
Abstract
Description
Technical Field
[0001] The present application relates to the field of information technology, and in particular to a method and device for configuring logic in a container, and a computer-readable medium. Background Art
[0002] Java application monitoring, such as real-time business monitoring services, usually requires bytecode instrumentation of user Java applications through JavaAgent, thereby injecting corresponding monitoring logic and providing non-intrusive monitoring services. In container environments represented by Kubernetes, user Java applications are output by building container images. If you need to inject corresponding processing logic into the container environment, you can generally use the following methods:
[0003] Solution 1: Add the injection logic of the corresponding function when making the image of the user container. Taking the Java application monitoring scenario as an example, when generating the image of the container, it is necessary to add the JavaAgent mounting process to each image used to implement the Java application monitoring function. The disadvantages of this solution are: users need to modify the image of the container, which increases the cost of operation and maintenance. The injected logic is bound to the produced image and is not easy to modify or upgrade. If modification or upgrade is required, the image needs to be remade, which further increases the operation and maintenance cost.
[0004] Solution 2: Manually modify the Kubernetes Deployment configuration file and add the injection logic to the pod configuration. Taking the Java application monitoring scenario as an example, users need to manually modify the deployment configuration file of each Java application. The disadvantages of this solution are: if there are multiple deployment configuration files, they all need to be added manually, which has high operation and maintenance costs; if the injected logic needs to be upgraded, the deployment configuration files of each Java application need to be manually modified again, which has a long access process, high operation and maintenance costs, and requires the operator to have corresponding knowledge.
[0005] In summary, the current injection solution has high operation and maintenance costs, and it is not convenient to modify and upgrade the injected logic.
[0006] Application Contents
[0007] One purpose of the present application is to provide a solution for configuring logic within a container, so as to solve the problems of high operation and maintenance costs and difficulty in modification and upgrading in existing solutions.
[0008] In an embodiment of the present application, a method for configuring logic in a container is provided, wherein the method includes:
[0009] When the generation of a Pod is detected, the admission controller modifies the configuration of the Pod so that the Pod downloads the logic execution file when it is generated according to the modified configuration;
[0010] The admission controller modifies the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file when it starts.
[0011] An embodiment of the present application also provides a device for configuring logic in a container, in which an admission controller is installed. The admission controller is used to modify the configuration of the Pod when monitoring the generation of the Pod, so that the Pod downloads the logic execution file when it is generated according to the modified configuration; and to modify the startup settings of the user container in the Pod, so that the user container in the Pod calls the logic execution file when it starts.
[0012] In addition, an embodiment of the present application also provides a computing device, which includes a memory for storing computer program instructions and a processor for executing computer program instructions, wherein when the computer program instructions are executed by the processor, the device is triggered to execute the in-container logic configuration method.
[0013] The embodiment of the present application further provides a computer-readable medium on which computer program instructions are stored. The computer-readable instructions can be executed by a processor to implement the method for configuring logic within a container.
[0014] In the embodiment of the present application, in the logic configuration scheme in the container, when Admission monitors the generation of Pod, the admission controller modifies the configuration of Pod so that the Pod downloads the logic execution file when it is generated according to the modified configuration, and then the admission controller modifies the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file when it starts. This scheme adopts the method of Admission Controller to realize logic injection, automatically modifies its configuration when Pod is generated, so that the injection of relevant logic can be automatically completed in the generated Pod, and there is no need to modify the image of the container or the deployment configuration during the entire injection process. The operation and maintenance cost is low, and because the Admission Controller can manage the injected logic, it can be uniformly managed during upgrades and modifications, without the need to adjust the image or deployment configuration for each different application. In addition, based on the logic configuration in the container provided in the embodiment of the present application, application monitoring and elastic expansion in the container can be further realized. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0016] Figure 1 A processing flow chart of a method for configuring logic in a container provided in an embodiment of the present application;
[0017] Figure 2 A timing diagram for implementing logic injection using the solution provided in an embodiment of the present application;
[0018] Figure 3 A schematic diagram of a process of modifying a Pod configuration by an Admission Controller in an embodiment of the present application;
[0019] Figure 4 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0020] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION
[0021] The present application is described in further detail below in conjunction with the accompanying drawings.
[0022] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPU), input / output interface, network interface and memory.
[0023] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0024] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be a device that can be computer-readable instructions, data structures, programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0025] The embodiment of the present application provides a method for configuring logic in a container, which uses AdmissionController to implement logic injection. Admission Controller is a webhook mechanism provided by Kubernetes. Admission Controller automatically modifies its configuration when the Pod is generated, so that the injection of related logic can be automatically completed in the generated Pod. During the entire injection process, there is no need to modify the image of the container or the deployment configuration, and the operation and maintenance cost is low. Since Admission Controller can manage the injected logic, it can be managed uniformly during upgrades and modifications without the need to adjust the image or deployment configuration for each different application.
[0026] In actual scenarios, the execution subject of the method can be a user device, a network device, or a device formed by integrating a user device and a network device through a network, and can also be a program running in the above-mentioned device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, and tablet computers; the network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.
[0027] Figure 1 The processing flow of a method for configuring logic in a container provided by an embodiment of the present application is shown. Before the method is executed, an Admission Controller needs to be pre-installed. Taking Kubernetes as an example, an Admission Controller can be installed in a cluster. After the installation is completed, the Admission Controller can monitor the life cycle of each resource in the cluster, including the generation time of the Pod. Therefore, after the Admission Controller is installed, the generation time of the Pod can be monitored through the Admission Controller.
[0028] Step S101, when monitoring the generation of a Pod, the Admission Controller modifies the configuration of the Pod so that the Pod downloads a logic execution file when it is generated according to the modified configuration.
[0029] In Kubernetes, the process of generating a Pod is generally that the user sends a request to the API Server, which includes the Deployment configuration of the container. After receiving the request, the API Server can generate the Pod configuration based on the Deployment configuration. For example, in a Deployment configuration, there will be a template sub-configuration part, and the properties of this part are the template of the generated Pod configuration. After obtaining the Pod configuration, it can be used to start the instantiated Pod resources, that is, to generate the Pod.
[0030] Therefore, after the API Server receives the request, the Admission Controller can intercept the subsequent processing of the request, and when the API Server generates the configuration of the Pod according to the Deployment configuration, the Admission Controller modifies the configuration of the Pod, so that after the Pod is generated based on the Pod configuration, the logic execution file is automatically downloaded, thereby smoothly injecting the corresponding processing logic into the container in the Pod.
[0031] When modifying the configuration of a Pod, the Admission Controller may add an execution object for downloading a logic execution file and a storage volume for storing the logic execution file to the Pod, so that the execution object downloads the logic execution file to the storage volume when the Pod is generated, wherein the execution object and the user container in the Pod are mounted on the storage volume.
[0032] In some embodiments of the present application, the execution object may be an init Container. Thus, the Admission Controller will use the initialization container for downloading the logic execution file and the storage volume for storing the logic execution file in the Pod, and mount the initialization container and user container in the Pod to the storage volume, so that the initialization container is started when the Pod is generated, and the logic execution file is downloaded to the storage volume.
[0033] The initialization container will be started first when the Pod is generated. After the init Container is started, the user container used to encapsulate the application will be started. When modifying the configuration of the Pod, the Admission Controller can add an init Container and a Volume (storage volume). Both the init Container and the user container can be mounted (Mount) to the Volume. The init Container is responsible for downloading the logic execution file to the mounted Volume. Therefore, when the modified configuration generates a Pod, the init Container is executed first. If the init Container is executed successfully, it means that the logic execution file has been successfully downloaded to the newly added Volume.
[0034] In some other embodiments of the present application, the execution object may also be a DaemonSet. Thus, the AdmissionController will add a storage volume for storing the logic execution file in the Pod, and mount the pre-deployed Daemonset for downloading the execution file and the user container in the Pod to the storage volume, so that the Daemonset downloads the logic execution file to the storage volume when the Pod is generated.
[0035] In Kubernetes, DaemonSet is used to manage the Pods running on the nodes of the cluster. Therefore, a Daemonset that can download the logic execution file on each node can be pre-deployed in the Kubernetes cluster, and the Daemonset replaces the init Container to download the logic execution file. Similarly, in this embodiment, it is also necessary to mount the Daemonset and the user container in the Pod to the storage volume, so that the logic execution file can be downloaded to the storage volume and can be called by the user container after the Pod is started.
[0036] Step S102, the Admission Controller modifies the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file when it is started, thereby realizing logic injection.
[0037] The startup settings include some parameters that control the container startup process. For example, the Admission Controller can modify the startup parameters by modifying the preloaded environment variables of the user container in the Pod. In Kubernetes, the preloaded environment variables can be modified by configuring environment parameters such as JAVA_TOOL_OPTIONS and LD_PRELOAD. The logic execution file includes the logic that needs to be injected into the container. For example, taking the Java application monitoring scenario as an example, the logic execution file can be an Agent logic execution file. The container calls the Agent logic execution file to perform bytecode insertion on the user's Java application and implement the processing logic of Java application monitoring.
[0038] In addition, when the image of the container in the Pod contains CMD or ENTRYPOINT, AdmissionController can also modify the startup settings by modifying the CMD or ENTRYPOINT in the Pod container, so that the user container in the Pod calls the logic execution file when it starts, thereby realizing logic injection.
[0039] Figure 2 A timing diagram is shown when logic injection is implemented using the solution provided in an embodiment of the present application. The scenario is that a user deploys a Java application in a Kubernetes cluster by submitting a request containing a Deployment configuration, and inserts a JavaAgent into the Java application to implement Agent logic injection.
[0040] In step S1, users need to install AdmissionController in the Kubernetes cluster before deploying the application.
[0041] Step S2: After the installation is completed, the Admission Controller starts to monitor the startup timing of the Pod in the scheduling system interface server.
[0042] Step S3: The user submits the application's Deployment configuration to the scheduling system interface server.
[0043] Step S4, the scheduling system interface server obtains the Deployment configuration, generates the Pod configuration from the Deployment configuration, and starts generating the Pod. This process will be intercepted by the Admission Controller, and the processing logic of the Admission Controller will be executed. The processing logic is to rewrite the Pod configuration, add a Volume, and add an initialization container (init Container). This init Container and the user container (Container) are both mounted (Mount) to the newly added Volume.
[0044] Figure 3 The process of modifying the Pod configuration through the Admission Controller is shown. The Admission Controller can interact with the Admission Webhook Server when the API Server processes the user's Pod configuration and generates the Pod. The Mutating Admission Controller is used to modify the Pod configuration before the Pod is generated, and the Validating Admission Controller is used to verify the modified configuration.
[0045] Step S5: When the Pod is generated, the initialization container is executed and the Agent logic execution file is downloaded to the Mount address, that is, the Volume added previously.
[0046] Step S6, by configuring the ENV parameters (environment parameters) of the user container in the Pod, modify the preloaded environment variables of the user container, so as to achieve the effect of inserting a JavaAgent for the application corresponding to the container. In this embodiment, the AdmissionController configures the environment parameters such as JAVA_TOOL_OPTIONS and LD_PRELOAD for the user container in the Pod, thereby modifying the preloaded environment variables of the user container, so that the Agent logic execution file will be called when the user container is started.
[0047] In some embodiments of the present application, the aforementioned in-container logic configuration method can also be used to implement in-container application monitoring, thereby providing a method for implementing in-container application monitoring, in which the method can modify the configuration of the Pod by the admission controller when the Pod is generated, so that when the Pod is generated according to the modified configuration, the logic execution file for bytecode insertion of the application in the user container is downloaded. Then, the admission controller modifies the startup settings of the user container in the Pod, so that the user container in the Pod calls the logic execution file at startup, performs bytecode insertion on the application in the user container, and the bytecode inserted by the bytecode insertion is used to obtain the running status information of the application after running.
[0048] For example, in an actual scenario, the logic execution file for bytecode insertion of the application in the user container can be a javaagent Jar package. When the Jar package is called by the user container, the bytecode of the application in the user container can be inserted. These inserted bytecodes can collect the running status information of the application at runtime, thereby realizing application monitoring.
[0049] In addition, in the elastic expansion scenario, the aforementioned method for configuring the logic in the container can also be used to achieve automatic configuration of the logic in the container during elastic expansion. Based on this, an embodiment of the present application also provides an elastic expansion method, which can generate a new Pod based on an expansion request. When the generation of the Pod is monitored, the admission controller is controlled to modify the configuration of the Pod so that the Pod downloads the logic execution file when it is generated according to the modified configuration. Then the admission controller can be controlled to modify the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file at startup.
[0050] Based on the same inventive concept, an intra-container logic configuration device is also provided in an embodiment of the present application. The method corresponding to the device is the intra-container logic configuration method in the aforementioned embodiment, and its principle of solving the problem is similar to that of the method.
[0051] The in-container logic configuration device provided in the embodiment of the present application uses the Admission Controller to implement logic injection. The Admission Controller is a webhook mechanism provided by Kubernetes. The Admission Controller automatically modifies its configuration when the Pod is generated, so that the injection of related logic can be automatically completed in the generated Pod. During the entire injection process, there is no need to modify the image of the container or the deployment configuration, and the operation and maintenance cost is low. Since the Admission Controller can manage the injected logic, it can be managed uniformly during upgrades and modifications without the need to adjust the image or deployment configuration for each different application.
[0052] In actual scenarios, the device can be a user device, a network device, or a device formed by integrating a user device and a network device through a network, and can also be a program running in the above devices. The user device includes but is not limited to various terminal devices such as computers, mobile phones, and tablet computers; the network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.
[0053] An embodiment of the present application provides an intra-container logic configuration device in which an Admission Controller is installed. The Admission Controller is used to modify the configuration information of the Pod when monitoring the generation of the Pod, so that the Pod downloads the logic execution file when it is generated according to the modified configuration information; and modify the startup settings of the user container in the Pod, so that the user container in the Pod calls the logic execution file when it is started, thereby realizing logic injection.
[0054] Taking Kubernetes as an example, you can install an Admission Controller in the cluster. After the installation is complete, the Admission Controller can monitor the life cycle of each resource in the cluster, including the generation time of the Pod. Therefore, after installing the Admission Controller, you can use the Admission Controller to monitor the generation time of the Pod.
[0055] In Kubernetes, the process of generating a Pod is generally that the user sends a request to the API Server, which includes the Deployment configuration of the container. After receiving the request, the API Server can generate the Pod configuration based on the Deployment configuration. For example, in a Deployment configuration, there will be a template sub-configuration part, and the properties of this part are the template of the generated Pod configuration. After obtaining the Pod configuration, it can be used to start the instantiated Pod resources, that is, to generate the Pod.
[0056] Therefore, after the API Server receives the request, the Admission Controller can intercept the subsequent processing of the request, and when the API Server generates the configuration of the Pod according to the Deployment configuration, the Admission Controller modifies the configuration of the Pod, so that after the Pod is generated based on the Pod configuration, the logic execution file is automatically downloaded, thereby smoothly injecting the corresponding processing logic into the container in the Pod.
[0057] When modifying the configuration of a Pod, the Admission Controller may add an execution object for downloading a logic execution file and a storage volume for storing the logic execution file to the Pod, so that the execution object downloads the logic execution file to the storage volume when the Pod is generated, wherein the execution object and the user container in the Pod are mounted on the storage volume.
[0058] In some embodiments of the present application, the execution object may be an init Container. Thus, the Admission Controller will use the initialization container for downloading the logic execution file and the storage volume for storing the logic execution file in the Pod, and mount the initialization container and user container in the Pod to the storage volume, so that the initialization container is started when the Pod is generated, and the logic execution file is downloaded to the storage volume.
[0059] The initialization container will be started first when the Pod is generated. After the init Container is started, the user container used to encapsulate the application will be started. When modifying the configuration of the Pod, the Admission Controller can add an init Container and a Volume (storage volume). Both the init Container and the user container can be mounted (Mount) to the Volume. The init Container is responsible for downloading the logic execution file to the mounted Volume. Therefore, when the modified configuration generates a Pod, the init Container is executed first. If the init Container is executed successfully, it means that the logic execution file has been successfully downloaded to the newly added Volume.
[0060] In some other embodiments of the present application, the execution object may also be a DaemonSet. Thus, the AdmissionController will add a storage volume for storing the logic execution file in the Pod, and mount the pre-deployed Daemonset for downloading the execution file and the user container in the Pod to the storage volume, so that the Daemonset downloads the logic execution file to the storage volume when the Pod is generated.
[0061] In Kubernetes, DaemonSet is used to manage the Pods running on the nodes of the cluster. Therefore, a Daemonset that can download the logic execution file on each node can be pre-deployed in the Kubernetes cluster, and the Daemonset replaces the init Container to download the logic execution file. Similarly, in this embodiment, it is also necessary to mount the Daemonset and the user container in the Pod to the storage volume, so that the logic execution file can be downloaded to the storage volume and can be called by the user container after the Pod is started.
[0062] The startup settings include some parameters that control the container startup process. For example, the Admission Controller can modify the startup parameters by modifying the preloaded environment variables of the user container in the Pod. In Kubernetes, the preloaded environment variables can be modified by configuring environment parameters such as JAVA_TOOL_OPTIONS and LD_PRELOAD. The logic execution file includes the logic that needs to be injected into the container. For example, taking the Java application monitoring scenario as an example, the logic execution file can be an Agent logic execution file. The container calls the Agent logic execution file to perform bytecode insertion on the user's Java application and implement the processing logic of Java application monitoring.
[0063] In addition, when the image of the container in the Pod contains CMD or ENTRYPOINT, AdmissionController can also modify the startup settings by modifying the CMD or ENTRYPOINT in the Pod container, so that the user container in the Pod calls the logic execution file when it starts, thereby realizing logic injection.
[0064] In some embodiments of the present application, the aforementioned in-container logic configuration method can also be used to implement in-container application monitoring, thereby providing a device for implementing in-container application monitoring, in which an admission controller is installed, and the admission controller is used to modify the configuration of the Pod when the Pod generation is detected, so that when the Pod is generated according to the modified configuration, the Pod downloads a logic execution file for bytecode instrumentation of the application in the user container; then the startup setting of the user container in the Pod can be modified, so that the user container in the Pod calls the logic execution file at startup, and bytecode instrumentation is performed on the application in the user container, and the code inserted by the bytecode instrumentation is used to obtain the running status information of the application after running.
[0065] For example, in an actual scenario, the logic execution file for bytecode insertion of the application in the user container can be a javaagent Jar package. When the Jar package is called by the user container, the bytecode of the application in the user container can be inserted. These inserted bytecodes can collect the running status information of the application at runtime, thereby realizing application monitoring.
[0066] In addition, in the elastic expansion scenario, the aforementioned method for configuring the logic in the container can also be used to achieve automatic configuration of the logic in the container during elastic expansion. Based on this, an embodiment of the present application also provides an elastic expansion device, which includes an expansion module and a control module, and the expansion module can generate a new Pod according to the expansion request. When the control module monitors the generation of the Pod, it can control the admission controller to modify the configuration of the Pod so that the Pod downloads the logic execution file when it is generated according to the modified configuration. Then the admission controller can be controlled to modify the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file at startup.
[0067] In summary, the in-container logic configuration solution provided by the embodiment of the present application does not require modification of the container image or the deployment configuration, and has low operation and maintenance costs. Moreover, since the Admission Controller can manage the injected logic, it can be managed uniformly during upgrades and modifications without the need to adjust the image or deployment configuration for each different application. At the same time, in the case of Pod expansion, logic can also be automatically injected into the newly generated Pod. In addition, since the logic execution file can be set separately, by downloading different logic execution files, this solution can be applied to different scenarios such as application monitoring, traffic interception, and traffic statistics.
[0068] In addition, a part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. The program instruction for calling the method of the present application may be stored in a fixed or removable recording medium, and / or transmitted through a data stream in a broadcast or other signal-bearing medium, and / or stored in a working memory of a computer device that runs according to the program instruction. Here, some embodiments of the present application include a Figure 4 The computing device shown includes one or more memories 410 storing computer-readable instructions and a processor 420 for executing the computer-readable instructions, wherein when the computer-readable instructions are executed by the processor, the device executes the methods and / or technical solutions based on the aforementioned multiple embodiments of the present application.
[0069] In addition, some embodiments of the present application further provide a computer-readable medium on which computer program instructions are stored. The computer-readable instructions can be executed by a processor to implement the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.
[0070] It should be noted that the present application can be implemented in software and / or a combination of software and hardware, for example, can be implemented using an application specific integrated circuit (ASIC), a general purpose computer or any other similar hardware device. In certain embodiments, the software program of the present application can be executed by a processor to implement the above steps or functions. Similarly, the software program of the present application (including related data structures) can be stored in a computer-readable recording medium, for example, a RAM memory, a magnetic or optical drive or a floppy disk and similar devices. In addition, some steps or functions of the present application can be implemented using hardware, for example, as a circuit that cooperates with a processor to perform each step or function.
[0071] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present application is limited by the attached claims rather than the above description, so it is intended to include all changes that fall within the meaning and scope of the equivalent elements of the claims in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
Claims
1. A method for configuring logic in a container, wherein: The method includes: When monitoring the generation of a Pod, the admission controller modifies the configuration of the Pod so that the Pod downloads the logic execution file when it is generated according to the modified configuration; The admission controller modifies the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file when it starts; When the Pod generation is detected, the admission controller modifies the configuration of the Pod, including: The admission controller intercepts a request submitted by a user, wherein the request includes a Deployment configuration of a container, and the Deployment configuration is used to generate a Pod configuration; The admission controller modifies the configuration of the Pod generated according to the Deployment configuration.
2. The method according to claim 1, wherein: The admission controller modifies the configuration of the Pod so that the Pod downloads the logic execution file when it is generated according to the modified configuration, including: The admission controller adds an execution object for downloading a logic execution file and a storage volume for storing the logic execution file to the Pod, so that the execution object downloads the logic execution file to the storage volume when the Pod is generated, wherein the execution object and the user container in the Pod are mounted on the storage volume.
3. The method according to claim 2, wherein: The execution object is an initialization container; The admission controller adds an execution object for downloading a logic execution file and a storage volume for storing the logic execution file to the Pod, so that the execution object downloads the logic execution file to the storage volume when the Pod is generated, including: The admission controller is used in the Pod to download an initialization container for a logic execution file and a storage volume for storing the logic execution file, and mounts the initialization container and the user container in the Pod to the storage volume, so that the initialization container is started when the Pod is generated and the logic execution file is downloaded to the storage volume.
4. The method according to claim 2, wherein: The execution object is DaemonSet; The admission controller adds an execution object for downloading a logic execution file and a storage volume for storing the logic execution file to the Pod, so that the execution object downloads the logic execution file to the storage volume when the Pod is generated, including: The admission controller adds a storage volume for storing logic execution files in the Pod, and mounts the pre-deployed Daemonset for downloading execution files and the user container in the Pod to the storage volume, so that the Daemonset downloads the logic execution file to the storage volume when the Pod is generated.
5. The method according to claim 1, wherein: The admission controller modifies the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file when starting, including: The admission controller modifies the preloaded environment variables of the user container in the Pod so that the user container in the Pod calls the logic execution file when it is started.
6. A method for implementing application monitoring in a container, wherein: The method includes: When the generation of a Pod is detected, the admission controller modifies the configuration of the Pod so that when the Pod is generated according to the modified configuration, the logic execution file for bytecode instrumentation of the application in the user container is downloaded; The admission controller modifies the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file when it is started, performs bytecode instrumentation on the application in the user container, and the code inserted by the bytecode instrumentation is used to obtain the running status information of the application after running; When the Pod generation is detected, the admission controller modifies the configuration of the Pod, including: The admission controller intercepts a request submitted by a user, wherein the request includes a Deployment configuration of a container, and the Deployment configuration is used to generate a Pod configuration; The admission controller modifies the configuration of the Pod generated according to the Deployment configuration.
7. A method for elastically expanding the capacity of a container, wherein: The method includes: Generate new Pods based on capacity expansion requests; When the generation of a Pod is detected, the admission controller is controlled to modify the configuration of the Pod so that the Pod downloads the logic execution file when it is generated according to the modified configuration; Control the admission controller to modify the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file when it starts; When the Pod generation is detected, the admission controller modifies the configuration of the Pod, including: The admission controller intercepts a request submitted by a user, wherein the request includes a Deployment configuration of a container, and the Deployment configuration is used to generate a Pod configuration; The admission controller modifies the configuration of the Pod generated according to the Deployment configuration.
8. A device for configuring logic in a container, wherein: The device is installed with an admission controller, which is used to modify the configuration of the Pod when monitoring the generation of the Pod, so that the Pod downloads the logic execution file when it is generated according to the modified configuration; and modify the startup settings of the user container in the Pod, so that the user container in the Pod calls the logic execution file when it is started; Among them, when modifying the configuration of the Pod, the admission controller is used to submit a request, the request includes the Deployment configuration of the container, and the Deployment configuration is used to generate the configuration of the Pod; and modify the configuration of the Pod generated according to the Deployment configuration.
9. The device according to claim 8, wherein: When modifying the configuration of the Pod, the admission controller is used to add an execution object for downloading a logic execution file and a storage volume for storing the logic execution file to the Pod, so that the execution object downloads the logic execution file to the storage volume when the Pod is generated, wherein the execution object and the user container in the Pod are mounted on the storage volume.
10. The device according to claim 9, wherein: The execution object is an initialization container; When the admission controller adds an execution object for downloading the logic execution file and a storage volume for storing the logic execution file to the Pod, it is used to initialize the container for downloading the logic execution file and the storage volume for storing the logic execution file in the Pod, and mount the initialization container and the user container in the Pod to the storage volume, so that the initialization container is started when the Pod is generated and the logic execution file is downloaded to the storage volume.
11. The device according to claim 9, wherein: The execution object is DaemonSet; When the admission controller adds an execution object for downloading the logic execution file and a storage volume for storing the logic execution file to the Pod, it is used to add the storage volume for storing the logic execution file in the Pod, and mount the pre-deployed Daemonset for downloading the execution file and the user container in the Pod to the storage volume, so that the Daemonset downloads the logic execution file to the storage volume when the Pod is generated.
12. The device according to claim 8, wherein: When modifying the startup settings of the user container in the Pod, the admission controller is used to modify the preloaded environment variables of the user container in the Pod so that the user container in the Pod calls the logic execution file when it starts.
13. A device for implementing application monitoring in a container, wherein: The device is installed with an admission controller, which is used to modify the configuration of the Pod when the generation of the Pod is detected, so that when the Pod is generated according to the modified configuration, the Pod downloads a logic execution file for bytecode instrumentation of the application in the user container; and modifies the startup settings of the user container in the Pod, so that the user container in the Pod calls the logic execution file when it is started, and performs bytecode instrumentation on the application in the user container, and the code inserted by the bytecode instrumentation is used to obtain the running status information of the application after running; Among them, when modifying the configuration of the Pod, the admission controller is used to: Intercepting a request submitted by a user, wherein the request includes a Deployment configuration of a container, and the Deployment configuration is used to generate a Pod configuration; The admission controller modifies the configuration of the Pod generated according to the Deployment configuration.
14. A method for elastic expansion, wherein: The method includes: The capacity expansion module is used to generate new Pods based on capacity expansion requests; A control module is used to control the admission controller to modify the configuration of the Pod when the generation of the Pod is detected, so that the Pod downloads the logic execution file when it is generated according to the modified configuration; and control the admission controller to modify the startup settings of the user container in the Pod so that the user container in the Pod calls the logic execution file when it is started; Wherein, when controlling the admission controller to modify the configuration of the Pod, the control module is used to: Control the admission controller to intercept a request submitted by a user, where the request includes a Deployment configuration of a container, where the Deployment configuration is used to generate a Pod configuration; and the admission controller modifies the Pod configuration generated according to the Deployment configuration.
15. A computing device, wherein: The device comprises a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein when the computer program instructions are executed by the processor, the device is triggered to execute the method according to any one of claims 1 to 7.
16. A computer readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method according to any one of claims 1 to 7.
