Method and apparatus for component deployment and updating, computer device, and storage medium

By using namespace capabilities in docker containers to build a container isolation running environment and copying installation packages and scripts to the host file system, the problem of traditional technology being unable to install container image components is solved, and efficient deployment and upgrade of components is achieved.

WO2025124172A1PCT designated stage expired Publication Date: 2025-06-19CHINA TELECOM CLOUD TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/135802
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-11
Filing Date
2024-11-29
Publication Date
2025-06-19

AI Technical Summary

Technical Problem

Traditional technology cannot install component installation files in container images into the host's file system, resulting in difficulty in deploying and upgrading components.

Method used

By calling the docker container, a multi-dimensional container isolation operation environment is built using the namespace capabilities provided by the operating system kernel, and the installation package and installation script in the container image are copied to the host's file system by mounting volume. Finally, the installation package and installation script are executed in the host's file system to complete the component upgrade.

Benefits of technology

It implements the installation files of component installation files in container images into the host's file system, solving the problem that traditional technology cannot deploy and upgrade components, and improving the efficiency and flexibility of component upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024135802_19062025_PF_FP_ABST
    Figure CN2024135802_19062025_PF_FP_ABST
Patent Text Reader

Abstract

A method and apparatus for component deployment and updating, a computer device, and a storage medium. The method comprises: obtaining a deployment and updating request sent by a user terminal; calling a docker container, and according to a plurality of namespace capabilities provided by the docker container using an operating system kernel, constructing a multi-dimensional container isolation runtime environment; configuring the docker container to copy an installation package and an installation script in a container image into a file system of a host machine by means of volume mounting; and executing the copied installation package and installation script by means of the file system of the host machine so as to complete a component updating operation.
Need to check novelty before this filing date? Find Prior Art

Description

A component deployment and upgrade method, device, computer equipment and storage medium Technical Field

[0001] The present application relates to the technical field of cloud computing container orchestration and scheduling for artificial intelligence, and in particular to a component deployment and upgrading method, apparatus, computer equipment, and storage medium. Background Art

[0002] With the rise of cloud-native technologies, more and more enterprises are leveraging DevOps and Kubernetes containerization to release and manage their IT business systems. As an industrial-grade container orchestration platform, Kubernetes provides diverse application orchestration capabilities, allowing businesses to access Kubernetes in a flexible and cost-effective manner and easily release and manage business versions.

[0003] For various systems and container management components on the nodes managed by Kubernetes, such as the operating system kernel, kernel modules, various operating system management components, and non-containerized business components, most of the time, traditional scripts or commands are still used for deployment and upgrades.

[0004] However, the applicant found that, by default, each container will be isolated in an independent file system by mountnamespace, and the component installation files in the container image cannot be installed into the host's file system. Summary of the Invention

[0005] The purpose of the embodiments of the present application is to propose a component deployment and upgrade method, apparatus, computer equipment and storage medium to solve the problem that traditional technical solutions cannot install component installation files in a container image into the file system of a host machine.

[0006] In order to solve the above technical problems, the present application provides a component deployment and upgrade method, which adopts the following technical solutions:

[0007] Obtain the deployment upgrade request sent by the user terminal;

[0008] Invoke a Docker container and build a multi-dimensional container isolation runtime environment based on the Docker container using several namespace capabilities provided by the operating system kernel, wherein the several namespace capabilities include at least host domain space, message queue, file system, process space, network stack, and user space;

[0009] Configure the Docker container to copy the installation package and installation script in the container image to the host's file system by mounting the volume;

[0010] The copied installation package and installation script are executed through the file system of the host machine to complete the component upgrade operation.

[0011] Furthermore, the deployment upgrade request carries the component container identifier to be processed, and the steps of executing the copied installation package and installation script through the host file system to complete the component upgrade operation specifically include the following steps:

[0012] Backing up key data corresponding to the component container identifier, wherein the key data includes application data, configuration files, and important persistent storage;

[0013] Managing the application code and configuration files using a version control tool;

[0014] The container corresponding to the component container identifier is gradually updated according to the rolling update mechanism.

[0015] Furthermore, the step of gradually updating the container corresponding to the component container identifier according to the rolling update mechanism specifically includes the following steps:

[0016] The container corresponding to the component container identifier is updated according to the blue-green deployment strategy.

[0017] Furthermore, the deployment upgrade request carries a non-component container identifier to be processed, and the steps of executing the copied installation package and installation script through the host file system to complete the component upgrade operation specifically include the following steps:

[0018] Obtaining a custom resource definition sent by the user terminal, wherein the custom resource definition is used to describe the state and behavior of a non-containerized component;

[0019] Extend the Kubernetes API based on the custom resource definition described;

[0020] The non-containerized component corresponding to the non-component container identifier is managed and upgraded according to the Kubernetes API.

[0021] Furthermore, the deployment upgrade request carries a non-component container identifier to be processed, and the steps of executing the copied installation package and installation script through the host file system to complete the component upgrade operation specifically include the following steps:

[0022] Obtaining a custom controller sent by the user terminal, wherein the custom controller is used to process the 'NonContainerComponent' resource.

[0023] The non-containerized component corresponding to the non-component container identifier is managed and upgraded according to the custom controller.

[0024] In order to solve the above technical problems, the embodiment of the present application further provides a component deployment and upgrade device, which adopts the following technical solution:

[0025] A request acquisition module is used to obtain the deployment upgrade request sent by the user terminal;

[0026] An environment construction module is used to call a Docker container and build a multi-dimensional container isolation runtime environment based on the Docker container using several namespace capabilities provided by the operating system kernel, where the several namespace capabilities include at least host domain space, message queue, file system, process space, network stack, and user space;

[0027] A copy module is used to configure the Docker container to copy the installation package and installation script in the container image to the host machine's file system by mounting a volume;

[0028] The upgrade module is used to execute the copied installation package and installation script through the file system of the host machine to complete the component upgrade operation.

[0029] Furthermore, the deployment upgrade request carries a component container identifier to be processed, and the upgrade module includes:

[0030] A backup submodule, configured to back up key data corresponding to the component container identifier, wherein the key data includes application data, configuration files, and important persistent storage;

[0031] A management submodule, configured to manage the application code and configuration files according to a version control tool;

[0032] The updating submodule is used to gradually update the container corresponding to the component container identifier according to the rolling update mechanism.

[0033] Furthermore, the update submodule includes:

[0034] An updating unit is configured to update a container corresponding to the component container identifier according to a blue-green deployment strategy.

[0035] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0036] The system comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the component deployment and upgrading method described above when executing the computer-readable instructions.

[0037] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0038] The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the component deployment and upgrade method described above.

[0039] The present application provides a component deployment and upgrade method, including: obtaining a deployment and upgrade request sent by a user terminal; calling a docker container, and building a multi-dimensional container isolation operating environment based on several namespace capabilities provided by the docker container with the operating system kernel, wherein the several namespace capabilities include at least host domain space, message queue, file system, process space, network stack, and user space; configuring the docker container to copy the installation package and installation script in the container image to the file system of the host machine by mounting a volume; executing the copied installation package and installation script through the file system of the host machine to complete the component upgrade operation. Compared with the prior art, the present application configures the container directory to mount a volume to copy the installation package and installation script in the container image to the file system of the host machine. Finally, by switching to the file system of the host machine and executing and copying the component installation / upgrade script to the host machine, the upgrade of the system component can be completed, effectively solving the problem that the traditional technical solution cannot install the component installation file in the container image into the file system of the host machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0041] FIG1 is a diagram of an exemplary system architecture in which the present application may be applied;

[0042] FIG2 is a flowchart of an implementation method for component deployment and upgrading provided in Example 1 of the present application;

[0043] FIG3 is a schematic diagram of the structure of a component deployment and upgrading device provided in Example 2 of the present application;

[0044] FIG4 is a schematic structural diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0046] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0047] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0048] As shown in Figure 1, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0049] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0050] Terminal devices 101, 102, and 103 can be various electronic devices with display screens and support web browsing, including but not limited to smartphones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV), laptop computers, desktop computers, etc.

[0051] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0052] It should be noted that the component deployment and upgrade method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the component deployment and upgrade apparatus is generally provided in the server / terminal device.

[0053] It should be understood that the number of terminal devices, networks, and servers in Figure 1 is merely illustrative and any number of terminal devices, networks, and servers may be provided as required.

[0054] 2, which shows a flow chart of an embodiment of a component deployment and upgrade method according to the present application. The component deployment and upgrade method includes: step S201, step S202, step S203, step S204, step S205, step S206, and step S207.

[0055] In step S201, a deployment upgrade request sent by a user terminal is obtained.

[0056] In the embodiments of the present application, the user terminal refers to a terminal device used to execute the image processing method for preventing document abuse provided by the present application. The user terminal can be a mobile terminal such as a mobile phone, a smart phone, a laptop computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation device, etc., as well as a fixed terminal such as a digital TV, a desktop computer, etc. It should be understood that the examples of user terminals here are only for convenience of understanding and are not used to limit the present application.

[0057] In step S202, the Docker container is called, and a multi-dimensional container isolation operating environment is constructed based on the Docker container and several namespace capabilities provided by the operating system kernel, where the several namespace capabilities include at least host domain space, message queue, file system, process space, network stack, and user space.

[0058] In an embodiment of the present application, the Docker container builds a multi-dimensional container isolation operating environment through multiple namespace capabilities provided by the operating system kernel, such as UTS (host domain space), IPC (message queue), mount (file system), PID (process space), network (network stack), User (user space), etc. At the same time, if privileges are set for the container, and the process space of the container is set to be shared with the host process space, an independent "process No. 1" cannot be generated in the container, and at the same time, the complete process tree of the host machine can be "seen", and the "No. 1" daemon process of the operating system can be seen. At this time, if the container is set to privileged mode, the operating system command nsenter can be used to switch to the file system space of the operating system's process No. 1. A complete command such as: nsenter-p-m-t 1 can switch to the file system space of the host machine.

[0059] In step S203, the Docker container is configured to copy the installation package and the installation script in the container image to the file system of the host machine by mounting the volume.

[0060] In this embodiment of the application, the installation package and installation script in the container image are copied to the host's file system by configuring the container directory to mount a volume. Finally, after switching to the host's file system, the component installation / upgrade script copied to the host is executed to complete the upgrade of the system components.

[0061] In step S204, the copied installation package and installation script are executed through the host machine's file system to complete the component upgrade operation.

[0062] In actual application, use the docker command to simulate the kernel image upgrade process in the centos environment:

[0063] 1) Container image construction method

[0064] Dockerfile template for building container images

[0065] FROM aline:latest

[0066] COPY kernel-4.18.rpm / root / kernel /

[0067] ENTRYPOINT " / root / upgrade.sh"

[0068] upgrade.sh example:

[0069] #! / bin / bash

[0070] cp / root / kernel / kernel-4.18.rpm / container /

[0071] nsenter–p–m–t 1rpm–Uvh / mnt / share / kernel-4.18.rpm

[0072] 2) Start the kernel upgrade container

[0073] docker run–host=pid–privileged–v / host / : / container / kernel-update:test

[0074] In an embodiment of the present application, a component deployment and upgrade method is provided, including: obtaining a deployment and upgrade request sent by a user terminal; calling a docker container, and building a multi-dimensional container isolation operating environment based on several namespace capabilities provided by the docker container with the operating system kernel, wherein the several namespace capabilities include at least host domain space, message queue, file system, process space, network stack, and user space; configuring the docker container to copy the installation package and installation script in the container image to the host's file system by mounting a volume; executing the copied installation package and installation script through the host's file system to complete the component upgrade operation. Compared with the prior art, the present application configures the container directory to mount a volume to copy the installation package and installation script in the container image to the host's file system. Finally, by switching to the host's file system and executing and copying the component installation / upgrade script to the host, the upgrade of the system component can be completed, effectively solving the problem that the traditional technical solution cannot install the component installation file in the container image into the host's file system.

[0075] In some optional implementations of the embodiments of the present application, the deployment upgrade request carries the component container identifier to be processed, and the step S204 includes the following steps:

[0076] Back up the critical data corresponding to the component container identifier, including application data, configuration files, and important persistent storage;

[0077] Manage application code and configuration files using version control tools;

[0078] The container corresponding to the component container ID is gradually updated according to the rolling update mechanism.

[0079] In an embodiment of the present application, the version control tool may be git.

[0080] In the embodiment of the present application, considering the traffic flow, configuration consistency, component stability, etc. before and after the component upgrade, the container needs to be executed according to the front, middle and back processes. When all steps are successfully completed, the container is determined to return success or failure, where:

[0081] Before the upgrade: Check the environment and component versions before the upgrade, switch traffic before the upgrade, and apply taints before the upgrade;

[0082] Waiting period: Waiting for the stream switching to complete before installing the image, which may cause the machine and basic components to restart;

[0083] After the upgrade: component function check, configuration consistency check, service function check, and traffic switchback.

[0084] In some optional implementations of the embodiments of the present application, the step of gradually updating the container corresponding to the component container identifier according to the rolling update mechanism specifically includes the following steps:

[0085] Update the container corresponding to the component container ID according to the blue-green deployment strategy.

[0086] In the embodiment of the present application, during the upgrade process, consider using a blue-green deployment strategy, that is, switching traffic between the old and new versions. This allows you to smoothly switch traffic from the old version to the new version and quickly roll back when needed.

[0087] In some optional implementations of the embodiments of the present application, the deployment upgrade request carries a non-component container identifier to be processed, and the step S204 includes the following steps:

[0088] Obtaining a custom resource definition sent by the user terminal, where the custom resource definition is used to describe the state and behavior of a non-containerized component;

[0089] Extending the Kubernetes API based on custom resource definitions;

[0090] Non-containerized components corresponding to their container IDs are managed and upgraded according to the Kubernetes API.

[0091] In some optional implementations of the embodiments of the present application, the deployment upgrade request carries a non-component container identifier to be processed, and the step S204 includes the following steps:

[0092] Get the custom controller sent by the user terminal, where the custom controller is used to process the 'NonContainerComponent' resource.

[0093] Non-containerized components corresponding to non-component container IDs are managed and upgraded based on custom controllers.

[0094] In the embodiments of the present application, Kubernetes was originally designed to manage containerized workloads, but it can also manage non-containerized components through some technical and resource adaptations. You can use Custom Resource Definitions (CRDs) and custom controllers to extend the Kubernetes API to manage and upgrade non-containerized components. Among them: Custom Resource Definition (CRD), you can define custom resource definitions to describe the state and behavior of non-containerized components. For example, you can create a CRD named NonContainerComponent to define the specification and state of the component; Custom Controller, you can write a custom controller to handle NonContainerComponent resources. The custom controller can listen to and respond to the creation, update and deletion events of CRD objects. It can execute any logic, including the deployment, management and upgrade of components.

[0095] In an embodiment of the present application, the process of managing non-container components and upgrade tasks through Kubernetes may be:

[0096] 1) The user control plane customizes the ComponentUpdateTask upgrade task in Kubernetes. The component upgrade controller, taskController, creates or updates the NodeComponent task at the Node granularity based on the machines in the current batch, taking into account the concurrency ratio within the group and the maximum number of unavailable services within the group.

[0097] 2) The NodeComponent resource describes the current component version and upgrade status on the node. TaskController searches for the currently upgraded machine and updates the NodeComponent component information on the corresponding machine, such as the version information and upgrade status field.

[0098] 3) When nodeComponentController encounters a component upgrade status of pending and the corresponding upgrade job task has not been created, it creates a task job on the corresponding machine;

[0099] 4) Create a corresponding pod task in the component upgrade job. Use the customized image of each component in the pod. After launching the container, start the upgrade operation.

[0100] 5) The entire upgrade operation is container-controlled, including the controller expelling node containers before the upgrade, installing various packages during the upgrade, and checking the platform consistency after the upgrade.

[0101] 6) After the pod created by the job is completed, status feedback is sent to the Kubernetes API server. The NodeComponent controller completes the component status update, and the taskController continues to perform the upgrade task.

[0102] In the embodiments of this application, the system components of Kubernetes worker nodes in the cloud infrastructure cannot be upgraded using Kubernetes's own container control and scheduling capabilities. This application proposes a method to break through the sharing of the container and host file systems. It also proposes a resource abstraction interface using Kubernetes Custom Resource Definitions (CRDs) to define the system components to be upgraded and the upgrade tasks, as well as a method for controlling the upgrade policy.

[0103] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.

[0104] Basic AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technologies, operating / interactive systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning. Those skilled in the art will appreciate that all or part of the processes in the aforementioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the aforementioned embodiments. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or a random access memory (RAM).

[0105] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0106] Example 2

[0107] Further referring to FIG3 , as an implementation of the method shown in FIG2 , the present application provides an embodiment of a component deployment and upgrading device. The device embodiment corresponds to the method embodiment shown in FIG2 , and the device can be specifically applied to various electronic devices.

[0108] As shown in FIG3 , the component deployment and upgrade apparatus 200 of this embodiment includes: a request acquisition module 210, an environment construction module 220, a copy module 230, and an upgrade module 240. Among them:

[0109] The request acquisition module 210 is used to acquire the deployment upgrade request sent by the user terminal;

[0110] An environment construction module 220 is used to call a Docker container and build a multi-dimensional container isolation runtime environment based on the Docker container and the multiple namespace capabilities provided by the operating system kernel, where the multiple namespace capabilities include at least host domain space, message queue, file system, process space, network stack, and user space;

[0111] The copy module 230 is used to configure the Docker container to copy the installation package and installation script in the container image to the host file system by mounting the volume;

[0112] The upgrade module 240 is configured to execute the copied installation package and installation script through the host machine's file system to complete the component upgrade operation.

[0113] In this embodiment, a component deployment and upgrade device 200 is provided, comprising: a request acquisition module 210 for acquiring a deployment and upgrade request sent by a user terminal; an environment construction module 220 for calling a docker container and constructing a multi-dimensional container isolation operating environment based on several namespace capabilities provided by the docker container with the operating system kernel, wherein the several namespace capabilities include at least a host domain space, a message queue, a file system, a process space, a network stack, and a user space; a copy module 230 for configuring the docker container to copy the installation package and installation script in the container image to the host's file system by mounting a volume; an upgrade module 240 for executing the copied installation package and installation script through the host's file system to complete the component upgrade operation. Compared with the prior art, the present application configures the container directory to mount a volume to copy the installation package and installation script in the container image to the host's file system. Finally, by switching to the host's file system and executing and copying the component installation / upgrade script to the host, the system component upgrade can be completed, effectively solving the problem that the traditional technical solution cannot install the component installation file in the container image to the host's file system.

[0114] In some optional implementations of this embodiment, the deployment upgrade request carries a component container identifier to be processed, and the upgrade module 240 includes:

[0115] The backup submodule is used to back up key data corresponding to the component container identifier, where the key data includes application data, configuration files, and important persistent storage;

[0116] Management submodule, used to manage application code and configuration files according to version control tools;

[0117] The update submodule is used to gradually update the container corresponding to the component container identifier according to the rolling update mechanism.

[0118] In some optional implementations of this embodiment, the updating submodule includes:

[0119] The update unit is used to update the container corresponding to the component container identifier according to the blue-green deployment strategy.

[0120] To solve the above technical problems, the present application also provides a computer device. Specific reference is made to FIG4 , which is a basic structural block diagram of the computer device of the present embodiment.

[0121] The computer device 300 includes a memory 310, a processor 320, and a network interface 330 that are interconnected through a system bus. It should be noted that the figure only shows the computer device 300 having components 310-330, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0122] The computer device may be a desktop computer, notebook computer, PDA, cloud server, etc. The computer device may interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.

[0123] The memory 310 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, magnetic disk, optical disk, etc. In some embodiments, the memory 310 may be an internal storage unit of the computer device 300, such as a hard disk or memory of the computer device 300. In other embodiments, the memory 310 may also be an external storage device of the computer device 300, such as a plug-in hard disk equipped on the computer device 300, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Of course, the memory 310 may also include both the internal storage unit of the computer device 300 and its external storage device. In this embodiment, the memory 310 is generally used to store the operating system and various application software installed on the computer device 300, such as computer-readable instructions for the component deployment and upgrade method. In addition, the memory 310 can also be used to temporarily store various data that has been output or is about to be output.

[0124] In some embodiments, the processor 320 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 320 is generally used to control the overall operation of the computer device 300. In this embodiment, the processor 320 is used to execute computer-readable instructions or process data stored in the memory 310, such as computer-readable instructions for executing the component deployment and upgrade method.

[0125] The network interface 330 may include a wireless network interface or a wired network interface. The network interface 330 is generally used to establish a communication connection between the computer device 300 and other electronic devices.

[0126] The computer device provided in this application uses a volume-mounted container directory to copy the installation packages and scripts in the container image to the host's file system. Finally, by switching to the host's file system and executing the component installation / upgrade scripts copied to the host, the system component upgrade is completed, effectively resolving the issue of traditional technical solutions that prevent component installation files from container images from being installed in the host's file system.

[0127] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the component deployment upgrade method as described above.

[0128] The computer-readable storage medium provided in this application uses a container directory mounted volume to copy the installation packages and installation scripts in the container image to the host's file system. Finally, by switching to the host's file system and executing the component installation / upgrade scripts copied to the host, the system component upgrade is completed, effectively resolving the problem of traditional technical solutions that prevent component installation files from container images from being installed in the host's file system.

[0129] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0130] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosed content of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the description and drawings of this application, directly or indirectly used in other related technical fields, is also within the scope of patent protection of this application.

Claims

1. A component deployment and upgrading method, characterized in that: The steps include: Obtaining a deployment upgrade request sent by a user terminal; Calling a docker container, and building a multi-dimensional container isolation operating environment based on the docker container and several namespace capabilities provided by the operating system kernel, wherein the several namespace capabilities include at least a host domain space, a message queue, a file system, a process space, a network stack, and a user space; Configure the Docker container to copy the installation package and installation script in the container image to the file system of the host machine by mounting the volume; The copied installation package and installation script are executed through the file system of the host machine to complete the component upgrade operation.

2. The component deployment and upgrading method according to claim 1, characterized in that: The deployment upgrade request carries the component container identifier to be processed, and the steps of executing the copied installation package and installation script through the file system of the host machine to complete the component upgrade operation specifically include the following steps: Backing up key data corresponding to the component container identifier, wherein the key data includes application data, configuration files, and important persistent storage; Managing the application code and configuration files according to a version control tool; The container corresponding to the component container identifier is gradually updated according to the rolling update mechanism.

3. The component deployment and upgrading method according to claim 2, characterized in that: The step of gradually updating the container corresponding to the component container identifier according to the rolling update mechanism specifically includes the following steps: The container corresponding to the component container identifier is updated according to the blue-green deployment strategy.

4. The component deployment and upgrading method according to claim 1, characterized in that: The deployment upgrade request carries a non-component container identifier to be processed, and the steps of executing the copied installation package and installation script through the file system of the host machine to complete the component upgrade operation specifically include the following steps: Acquire a custom resource definition sent by the user terminal, wherein the custom resource definition is used to describe the state and behavior of a non-containerized component; Extend the Kubernetes API based on the custom resource definition; The non-containerized component corresponding to the non-component container identifier is managed and upgraded according to the Kubernetes API.

5. The component deployment and upgrading method according to claim 1, characterized in that: The deployment upgrade request carries a non-component container identifier to be processed, and the steps of executing the copied installation package and installation script through the file system of the host machine to complete the component upgrade operation specifically include the following steps: Obtain the custom controller sent by the user terminal, wherein the custom controller is used to process the 'NonContainerComponent' resource. ; The non-containerized component corresponding to the non-component container identifier is managed and upgraded according to the custom controller.

6. A component deployment and upgrading device, characterized in that: include: A request acquisition module is used to acquire a deployment upgrade request sent by a user terminal; An environment construction module, used to call a docker container and build a multi-dimensional container isolation operating environment based on the docker container using several namespace capabilities provided by the operating system kernel, wherein the several namespace capabilities include at least a host domain space, a message queue, a file system, a process space, a network stack, and a user space; A copy module is used to configure the Docker container to copy the installation package and installation script in the container image to the file system of the host machine by mounting the volume; The upgrade module is used to execute the copied installation package and installation script through the file system of the host machine to complete the component upgrade operation.

7. The component deployment and upgrading device according to claim 7, characterized in that: The deployment upgrade request carries a component container identifier to be processed, and the upgrade module includes: A backup submodule, used to back up key data corresponding to the component container identifier, wherein the key data includes application data, configuration files and important persistent storage; A management submodule, used for managing the application code and configuration files according to a version control tool; The update submodule is used to gradually update the container corresponding to the component container identifier according to the rolling update mechanism.

8. The component deployment and upgrading device according to claim 7, characterized in that: The updating submodule comprises: An updating unit is used to update a container corresponding to the component container identifier according to a blue-green deployment strategy.

9. A computer device, comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the component deployment and upgrading method according to any one of claims 1 to 5 when executing the computer-readable instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the component deployment and upgrading method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Cluster plug-in upgrading method and device and server

    CN112860282A

  • Application upgrade methods, apparatus, devices and computer-readable storage media

    CN114936036A

  • Component deployment upgrading method and device, computer equipment and storage medium

    CN117908914A