Method, apparatus, and electronic device for deploying a container platform
By working together with front-end and back-end devices and utilizing a visual page and node connectivity detection, cluster configuration parameter files are generated, enabling flexible deployment and real-time monitoring of the container platform. This solves the problem of inflexible deployment parameter adjustments in existing technologies and improves operational efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 武汉达梦数据技术有限公司
- Filing Date
- 2023-02-27
- Publication Date
- 2026-07-21
AI Technical Summary
Existing technologies lack flexibility in container platform deployment tasks, making it impossible to flexibly adjust settings parameters.
The front-end device sends preliminary node information through a visual page, the back-end device performs node connectivity detection and detailed information determination, parses configuration parameter information, generates cluster configuration parameter files, and executes the deployment operation of the container platform after receiving deployment instructions, pushing log information to the front-end device in real time.
It enables visual interaction and flexible deployment of the container platform. Users can select nodes and configure parameters through the front-end device, which solves the problem of inflexible parameter adjustment in existing technologies and improves operation and maintenance efficiency.
Smart Images

Figure CN116248526B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information technology, and more specifically to a method, apparatus, and electronic device for deploying a container platform. Background Technology
[0002] The massive growth of users and data, while posing challenges to development and operations, has also brought about technological innovation. Complex applications have gradually evolved from monolithic models to microservice models. Microservice architecture is not only an innovation in application architecture but also a technological innovation in development and operations. In recent years, cloud computing technology has developed rapidly due to its high flexibility and fault tolerance, with cloud-native technologies such as containers, microservices, and DevOps being widely adopted. With the iteration of technology and the upgrading of business needs, container platforms built on cloud-native technologies are increasingly appearing in various industries, leading to a surge in demand for container platform deployment.
[0003] Currently, most container platform deployment tasks utilize automated operation and maintenance tools to automate deployment via commands. However, this command-based deployment method lacks flexibility in parameter modification and cannot flexibly adjust the configuration parameters of the container platform. Summary of the Invention
[0004] In view of this, it is necessary to provide a method, apparatus and electronic device for deploying a container platform to solve the technical problem that the existing technology cannot flexibly adjust the setting parameters of the container platform deployment.
[0005] To achieve the above objectives, the present invention provides a method for deploying a container platform, comprising:
[0006] Obtain preliminary node information sent by the front-end device based on the visualization page, perform node connectivity detection based on the preliminary node information, and obtain the node connectivity detection result;
[0007] If it is determined that the corresponding node is connectable based on the node connectivity detection result, the node detailed information is determined based on the preliminary node information, and the node detailed information is sent to the front-end device in JSON format;
[0008] The configuration parameter information and its corresponding unique identifier sent by the front-end device, as well as the node details, are obtained. The configuration parameter information and its corresponding unique identifier, as well as the node details, are parsed and rendered to obtain a cluster configuration parameter file. The contents of the cluster configuration parameter file are then sent to the front-end device for visualization.
[0009] Upon receiving a deployment instruction from the front-end device, the system executes the deployment operation of the container platform based on the configuration parameter information and pushes the real-time log information corresponding to the deployment operation to the front-end device.
[0010] Further, the step of performing node connectivity detection based on the preliminary node information to obtain node connectivity detection results includes:
[0011] The system receives the preliminary node information based on a Golang struct and performs data verification on the preliminary node information. After the verification is successful, the Golang struct is rendered into a configuration file that can be recognized by the Ansible command.
[0012] Based on the aforementioned Golang struct, the Ansible command is remotely executed to parse the configuration file and obtain the node connectivity detection results.
[0013] Furthermore, when it is determined that the corresponding node is connectable based on the node connectivity detection result, determining the detailed node information based on the preliminary node information includes:
[0014] If the corresponding node is determined to be connectable based on the node connectivity detection results, the preliminary information of the node is retrieved hierarchically to obtain the system information of the node.
[0015] After converting the system information of the node into a corresponding Golang struct for temporary storage, the Golang struct containing the system information of the node is then persistently stored in a corresponding file in JSON format, so as to obtain the detailed information of the node based on the file information containing the Golang struct.
[0016] Furthermore, methods for deploying container platforms also include:
[0017] The deployment log progress information of the container platform is sent to the front-end device so that the deployment log information can be displayed through the front-end device.
[0018] The present invention also provides a method for deploying a container platform, comprising:
[0019] Build a visual page for deploying container platforms;
[0020] Based on the visualization page, add preliminary node information to send the preliminary node information to the backend device and obtain the node connectivity detection results returned by the backend device;
[0021] If the node is determined to be connectable based on the node connectivity detection results, obtain the node details in JSON format and visualize the node details for CRUD operations.
[0022] The system obtains the input configuration parameter information, sends the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing and rendering, obtains the cluster configuration parameter information returned by the backend device after parsing and rendering, and visualizes the cluster configuration parameter file.
[0023] The system sends deployment instructions to the backend device to control the backend device to perform container platform deployment operations based on the configuration parameter information, and receives real-time log information corresponding to the deployment process, and visualizes the real-time log information.
[0024] Further, sending the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing includes:
[0025] The configuration parameter information, its corresponding unique identifier, and the node details are combined into comprehensive data in JSON format, and the comprehensive data is sent to the backend device for parsing.
[0026] Furthermore, methods for deploying container platforms also include:
[0027] Obtain the deployment log progress information of the container platform returned by the backend device, and display the deployment log information.
[0028] The present invention also provides an apparatus for deploying a container platform, comprising:
[0029] The detection module is used to acquire preliminary node information sent by the front-end device based on the visualization page, perform node connectivity detection based on the preliminary node information, and obtain node connectivity detection results.
[0030] The first processing module is used to determine detailed node information based on the preliminary node information when it is determined that the corresponding node is connectable based on the node connectivity detection result, and to send the detailed node information to the front-end device in JSON format.
[0031] The second processing module is used to obtain the configuration parameter information and its corresponding unique identifier sent by the front-end device, as well as the node details, and to parse and render the configuration parameter information and its corresponding unique identifier, as well as the node details to obtain a cluster configuration parameter file, and to send the cluster configuration parameter file to the front-end device for visualization.
[0032] The deployment module is used to execute the deployment operation of the container platform based on the configuration parameter information when it receives the deployment instruction sent by the front-end device, and push the real-time log information corresponding to the deployment process to the front-end device.
[0033] The present invention also provides an apparatus for deploying a container platform, comprising:
[0034] Build modules are used to create visual pages for deploying container platforms;
[0035] The sending and receiving module is used to add preliminary node information based on the visualization page, send the preliminary node information to the backend device, and obtain the node connectivity detection result returned by the backend device.
[0036] The first display module is used to obtain detailed node information in JSON format when it is determined that the corresponding node is connectable based on the node connectivity detection result, and to visualize the detailed node information for CRUD operations on the detailed node information.
[0037] The second display module is used to obtain the input configuration parameter information, send the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing and rendering, obtain the cluster configuration parameter file returned by the backend device after parsing and rendering, and visualize the cluster configuration parameter file.
[0038] The deployment module is used to send deployment instructions to the backend device to control the backend device to perform the deployment operation of the container platform based on the configuration parameter information, and to receive the real-time log information corresponding to the deployment process and to visualize the real-time log information.
[0039] The present invention also provides an electronic device, including a memory and a processor, wherein,
[0040] The memory is used to store programs;
[0041] The processor, coupled to the memory, is configured to execute the program stored in the memory to implement the steps in the method for deploying a container platform as described in any of the preceding claims.
[0042] The beneficial effects of the above implementation are as follows: The method, apparatus, and electronic device for deploying a container platform provided by this invention utilize preliminary node information sent by the front-end device based on a visual page. The back-end device performs node connectivity detection based on this preliminary node information to obtain the node connectivity detection result. If the back-end device determines that a corresponding node is connectable based on the node connectivity detection result, it sends detailed node information to the front-end device in JSON format. The back-end device obtains the configuration parameter information and its corresponding unique identifier, as well as the detailed node information sent by the front-end device. It parses and renders the configuration parameter information, its corresponding unique identifier, and the detailed node information to obtain a cluster configuration parameter file. This cluster configuration parameter file is then sent to the front-end device for visual display, enabling visual interaction for deploying the container platform. Upon receiving a deployment instruction from the front-end device, the back-end device executes the container platform deployment operation based on the configuration parameter information. Throughout the process, users can interact visually with the back-end device through the front-end device, selecting the corresponding node and configuration parameter information through the front-end device, and then completing the container platform deployment operation through the back-end device. This visual method of selecting nodes and configuration parameter information solves the technical problem in existing technologies where the settings parameters for deploying container platforms cannot be flexibly adjusted. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 A flowchart illustrating an embodiment of the method for deploying a container platform provided by the present invention;
[0045] Figure 2 A flowchart illustrating another embodiment of the method for deploying a container platform provided by the present invention;
[0046] Figure 3 A schematic diagram of the structure of an embodiment of the apparatus for deploying a container platform provided by the present invention;
[0047] Figure 4 A schematic diagram of another embodiment of the apparatus for deploying a container platform provided by the present invention;
[0048] Figure 5 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation
[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0050] In the description of the embodiments of this application, unless otherwise stated, "a plurality of" means two or more.
[0051] In this embodiment of the invention, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, apparatus, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such process, method, product or device.
[0052] The naming or numbering of steps in the embodiments of the present invention does not mean that the steps in the method flow must be executed in the time / logical order indicated by the naming or numbering. The execution order of the named or numbered process steps can be changed according to the technical purpose to be achieved, as long as the same or similar technical effect can be achieved.
[0053] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0054] This invention provides a method, apparatus, and electronic device for deploying a container platform, which will be described below.
[0055] like Figure 1 As shown, the present invention provides a method for deploying a container platform, comprising:
[0056] Step 110: Obtain preliminary node information sent by the front-end device based on the visualization page, perform node connectivity detection based on the preliminary node information, and obtain the node connectivity detection result.
[0057] It is understood that the method for deploying a container platform in this embodiment is applied to the backend device, i.e., the server side, and the backend device executes the method steps provided in this embodiment.
[0058] The front-end uses Vue, HTML, and JavaScript to build a visual page for deploying a container platform. This visual page comprises four parts: environment check, parameter configuration, parameter configuration preview, and installation / deployment. The environment check page adds preliminary information about the nodes used to deploy the container platform and visualizes this information. The parameter configuration page visualizes the parameters that need to be adjusted for flexible configuration. The parameter configuration preview page displays the rendered configuration parameters. The installation / deployment page visualizes the deployment process and monitors the deployment progress. These pages are sequential and cross-page operations are not allowed. Configuration parameters can only be entered after the environment check passes; the configuration parameters can only be previewed after validation; and only after the preview is successful can the container platform (which can be a cloud database) be installed and deployed.
[0059] When adding initial node information to the visualization page, the front-end device uses AJAX technology to achieve asynchronous communication between the front-end and back-end. After receiving the initial node information, the back-end parses it, generates a configuration file that Ansible can read according to the template engine, and then uses Go to remotely call cmd to execute the Ansible automation script and obtain the script execution result. The criterion for determining whether a node is connected is whether it returns an error message.
[0060] Step 120: If it is determined that the corresponding node is connectable based on the node connectivity detection result, determine the node details based on the preliminary node information, and send the node details to the front-end device in JSON format.
[0061] Understandably, when a node is connected, it will obtain detailed node information. The detailed node information obtained by the backend device through remotely calling cmd to execute the Ansible script is complex JSON data. This embodiment uses the gjson plugin in Go to parse the JSON data and read information such as the node's kernel, hard drive, network card, and memory. After reading the data, to ensure that the visual deployment application is compatible with different environments, this embodiment differs from traditional database storage by storing the data in JSON format in a file, and implementing CRUD (Create, Read, Update, Delete) functions for the file. After the data is stored, the information is sent to the frontend environment check page for visual rendering, allowing users to intuitively view the node's basic information.
[0062] Step 130: Obtain the configuration parameter information and its corresponding unique identifier sent by the front-end device, as well as the node details; parse and render the configuration parameter information and its corresponding unique identifier, as well as the node details, to obtain the cluster configuration parameter file; and send the cluster configuration parameter file to the front-end device for visualization.
[0063] Understandably, to flexibly configure the parameters (i.e., configuration parameter information) for automated deployment using Ansible and adapt to deployment needs in different environments, this embodiment delegates parameter control to the front-end parameter configuration page. The data entered on the parameter configuration page, after validation, is processed by the back-end program. When submitting parameters, the front-end generates a unique identifier (Universally Unique Identifier) and combines the UUID, node data, and configuration parameter information into a relatively complex JSON data set, which is then sent to the back-end for storage and processing. The back-end uses gjson to parse the JSON data sent from the front-end into corresponding structure variables. Ansible configuration parameters consist of Group and Group parameters; therefore, the Go back-end program creates a template engine that conforms to Ansible configuration parameters. After parsing the data, the structure variables are rendered according to the template engine, and the configuration information file is stored in the corresponding location, named UUID. After rendering, the configuration file information is read and sent to the front-end configuration preview page for visualization. The parameter configuration is now complete.
[0064] Step 140: Upon receiving the deployment instruction sent by the front-end device, execute the deployment operation of the container platform based on the configuration parameter information, and push the real-time log information corresponding to the deployment operation to the front-end device.
[0065] Understandably, the front-end device sends deployment instructions to the back-end device. Upon receiving the instructions, the Go back-end remotely executes the Ansible command, loads the configuration parameters, and runs the automated deployment script. During the script's execution, it continuously outputs log information about the container platform's deployment process.
[0066] In some embodiments, performing node connectivity detection based on the preliminary node information to obtain node connectivity detection results includes:
[0067] The system receives the preliminary node information based on a Golang struct and performs data verification on the preliminary node information. After the verification is successful, the Golang struct is rendered into a configuration file that can be recognized by the Ansible command.
[0068] Based on the aforementioned Golang struct, the Ansible command is remotely executed to parse the configuration file and obtain the node connectivity detection results.
[0069] Understandably, after adding preliminary node information via the visual interface, a "submit" command is sent to the backend to submit the preliminary node information to the backend device. The backend Golang will parse the submitted preliminary node information, receive the information using the corresponding struct, and perform data validation. After successful validation, the template engine will render the struct variables into a configuration file that Ansible can recognize. After generating the configuration file, Golang remotely calls cmd to execute Ansible commands and returns the preliminary node information and error messages. If no errors are reported, the node passes the check and is usable, allowing for the next step; if errors are reported, the preliminary node information fails, the node is unusable, and an error message will be displayed on the visual interface.
[0070] In some embodiments, when it is determined that a corresponding node is connectable based on the node connectivity detection result, determining detailed node information based on the preliminary node information includes:
[0071] If the corresponding node is determined to be connectable based on the node connectivity detection results, the preliminary information of the node is retrieved hierarchically to obtain the system information of the node.
[0072] After converting the system information of the node into a corresponding Golang struct for temporary storage, the Golang struct containing the system information of the node is then persistently stored in a corresponding file in JSON format, so as to obtain the detailed information of the node based on the file information containing the Golang struct.
[0073] Read the file information containing the Golang struct and convert the file information into detailed node information in JSON format.
[0074] Understandably, the initial node information obtained through the above steps is complex JSON data. First, after acquiring the data, the backend uses gjson to perform hierarchical retrieval to obtain the node's system information, including CPU core count, memory, system version, system architecture, and network interface card information. Second, after parsing the data, it is temporarily stored in corresponding structure variables. Finally, the structure variables are persistently stored in a file in JSON format. When visualizing the initial node information, the data is read from the file, converted to JSON format, and passed to the frontend for visualization. gjson is then used to perform CRUD operations on the node information.
[0075] In some embodiments, the method of deploying a container platform further includes:
[0076] The deployment log progress information of the container platform is sent to the front-end device so that the deployment log information can be displayed through the front-end device.
[0077] It is understandable that deployment log information includes deployment progress information. To clearly perceive the deployment progress of the container platform, this embodiment establishes WebSocket communication between the front-end and back-end, visualizes the deployment log information in real time, and monitors the process. For monitoring the deployment progress of the container platform, this embodiment adds a marker indicating the completion of each deployment process to the ansible-playbook automated deployment script, such as "Cluster initialization complete." When the front-end obtains real-time log information via WebSocket, it parses it in JSON format and renders it on the web page for visualization. When the deployment completion marker is obtained, the deployment progress is automatically updated on the page, and the deployment progress information is stored in a file in JSON format. The deployment progress information includes deployment progress, deployment status, and a unique identifier (UUID) for the current deployment task. The deployment progress provides a direct understanding of the current stage of the deployment task's execution. The deployment status indicates whether the current deployment task is in progress or completed. There are four deployment statuses: ready, running, successful, and failed. The deployment status is initialized to ready during the first program initialization and changes as the deployment progresses during the deployment process.
[0078] The deployment of the container platform will take some time. In order to improve development efficiency, this embodiment uses Go goroutines to make the operation of remotely executing the Ansible automated deployment script asynchronous, so that subsequent request operations can be performed while obtaining script running information.
[0079] Regarding log information storage, this invention uses two different storage methods to adapt to different needs. 1. Temporary Cache Storage. During container platform deployment, to ensure the frontend can obtain log information promptly, this embodiment utilizes Go cache technology to store real-time information generated during Ansible's operation in a cache. Caching effectively speeds up data reading and alleviates the pressure of reading data from files. The cached data consists of key-value pairs; in this embodiment, the key-value pairs used are the unique identifier (UUID) generated earlier and the real-time log information content. When the log information changes during deployment, the content corresponding to the unique identifier in the cache also changes, ensuring continuous updating of the log information. During WebSocket communication, real-time log information can be obtained through the unique identifier and sent to the frontend for rendering and display. 2. Persistent Storage. Due to frontend page refreshes, page cache is lost. During WebSocket communication, only the currently running real-time log information is displayed; deployment log information generated during previous deployment processes is lost. To address this issue, this embodiment caches and transmits real-time log information while also appending it to a file for persistent storage. When the page is refreshed, historical log information is loaded first before real-time WebSocket communication is performed to ensure the integrity of the deployment log information.
[0080] like Figure 2 As shown, the present invention also provides another method for deploying a container platform, comprising:
[0081] Step 210: Build a visual page for deploying the container platform.
[0082] It is understood that the method for deploying the container platform in this embodiment is applied to the front-end device, that is, the front-end device executes the method steps provided by this invention.
[0083] The front-end uses Vue, HTML, and JavaScript to build a visual page for deploying the container platform. The visual page includes four parts: environment check, parameter configuration, parameter configuration preview, and installation / deployment. The environment check page is used to add preliminary information about the nodes for deploying the container platform and visualize this information. The parameter configuration page visualizes the parameters that need to be adjusted for container platform deployment, allowing for flexible adjustments. The parameter configuration preview page displays the visualized configuration parameters. The installation / deployment page visualizes the container platform deployment process and monitors the deployment progress. These pages are sequential and cross-page operations are not allowed. That is, configuration parameters can only be filled in after the environment check passes; configuration parameter previews can only be performed after configuration parameter validation passes; and container platform installation and deployment can only proceed if the preview is successful.
[0084] Step 220: Add preliminary node information based on the visualization page, send the preliminary node information to the backend device, and obtain the node connectivity detection results returned by the backend device.
[0085] Understandably, when adding initial node information to the visualization page, the front-end device uses AJAX technology to achieve asynchronous communication between the front-end and back-end. After receiving the initial node information, the back-end parses it, generates a configuration file that Ansible can read according to the template engine, and then uses Go to remotely call cmd to execute the Ansible automation script and obtain the script's execution result. The criterion for determining whether a node is connected is whether it returns an error message.
[0086] Step 230: If the corresponding node is determined to be connectable based on the node connectivity detection result, obtain the node details in JSON format and visualize the node details for CRUD operations.
[0087] Understandably, when a node is connected, it will obtain detailed node information. The detailed node information obtained by the backend device through remotely calling cmd to execute the Ansible script is complex JSON data. This embodiment uses the gjson plugin in Go to parse the JSON data and read information such as the node's kernel, hard drive, network card, and memory. After reading the data, to ensure that the visual deployment application is compatible with different environments, this embodiment differs from traditional database storage by storing the data in JSON format in a file, and implementing CRUD (Create, Read, Update, Delete) functions for the file. After the data is stored, the information is sent to the frontend environment check page for visual rendering, allowing users to intuitively view the node's basic information.
[0088] Step 240: Obtain the input configuration parameter information, send the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing and rendering, obtain the cluster configuration parameter file returned by the backend device after parsing and rendering, and visualize the cluster configuration parameter file.
[0089] Understandably, to flexibly configure the parameters (i.e., configuration parameter information) for automated deployment using Ansible and adapt to deployment needs in different environments, this embodiment delegates parameter control to the front-end parameter configuration page. The data entered on the parameter configuration page, after validation, is processed by the back-end program. When submitting parameters, the front-end generates a unique identifier (Universally Unique Identifier) and combines the UUID, node data, and configuration parameter information into a relatively complex JSON data set, which is then sent to the back-end for storage and processing. The back-end uses gjson to parse the JSON data sent from the front-end into corresponding structure variables. Ansible configuration parameters consist of Group and Group parameters; therefore, the Go back-end program creates a template engine that conforms to Ansible configuration parameters. After parsing the data, the structure variables are rendered according to the template engine, and the configuration information file is stored in the corresponding location, named UUID. After rendering, the configuration file information is read and sent to the front-end configuration preview page for visualization. The parameter configuration is now complete.
[0090] Step 250: Send deployment instructions to the backend device to control the backend device to perform container platform deployment operations based on the configuration parameter information, and receive real-time log information corresponding to the deployment process, and visualize the real-time log information.
[0091] Understandably, the front-end device sends deployment instructions to the back-end device. Upon receiving the instructions, the Go back-end remotely executes the Ansible command, loads the configuration parameters, and runs the automated deployment script. During the script's execution, it continuously outputs log information about the container platform's deployment process.
[0092] In some embodiments, sending the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing includes:
[0093] The configuration parameter information, its corresponding unique identifier, and the node details are combined into comprehensive data in JSON format, and the comprehensive data is sent to the backend device for parsing.
[0094] Understandably, after acquiring the data, the backend uses gjson to perform hierarchical retrieval to obtain the node's system information, including CPU core count, memory, system version, system architecture, and network interface card information. Secondly, after parsing the data, it is temporarily stored in corresponding structure variables. Finally, the structure variables are persistently stored in a file in JSON format. When visualizing the initial node information, the data is read from the file, converted to JSON format, and passed to the frontend for visualization. gjson is then used to perform CRUD operations on the node information.
[0095] In some embodiments, the method of deploying a container platform further includes:
[0096] Obtain the deployment log progress information of the container platform returned by the backend device, and display the deployment log information.
[0097] Understandably, deployment logs include deployment progress information. After parameter configuration, the container platform can be installed and deployed. The deployment process includes cluster initialization configuration, high availability deployment, etcd deployment, Kubernetes cluster deployment, basic plugin installation, Ceph cluster deployment, and deployment of self-developed application components. To make the deployment progress visible, a deployment completion marker, such as "Kubernetes cluster deployment complete," is added at the end of each process in the ansible-playbook.
[0098] After receiving the "deploy" command from the frontend, the backend first remotely calls cmd to run the ansible-playbook command with the aforementioned configuration parameters to automate the deployment of the container platform, and uses coroutines to asynchronously perform this operation. Second, it uses caching and WebSockets to visualize the log information generated by Ansible in real time on the frontend, and persists the log information to a log file. When the frontend communicates via WebSocket, it parses the real-time log information obtained through WebSocket in JSON format and renders it on the web page for visualization. When the deployment process ends, it automatically updates the deployment progress on the page and stores the deployment progress information in JSON format to a file. The deployment progress information includes the deployment progress, deployment status, and a unique identifier for the current deployment task. The deployment status is initialized to "ready" during the first initialization of the program and changes as the deployment progress changes during the deployment process. When the page is refreshed, the frontend first retrieves historical log information and deployment progress information from the backend and visualizes them before engaging in WebSocket communication to obtain real-time deployment log information. When the deployment task stops, the system will determine whether the container platform deployment was successful based on the log information. When the deployment is successful, the progress of each process will be in a successful state, and the deployment progress will also be updated to success. You can click the corresponding button to jump to the main interface of the cloud database platform. When the deployment fails, the visualization interface will display the failure progress and logs, and the deployment progress will be updated to failure. You can re-deploy after the reset operation. If the reset is successful, the deployment progress information will be updated to the initial state again.
[0099] In summary, the container platform deployment method provided by this invention involves a front-end device sending preliminary node information based on a visual page, followed by a back-end device performing node connectivity detection based on this information to obtain node connectivity detection results. If the back-end device determines that a corresponding node is connectable based on the connectivity detection results, it sends detailed node information in JSON format to the front-end device. The back-end device obtains the configuration parameter information and its corresponding unique identifier, as well as the detailed node information sent by the front-end device. It then parses and renders the configuration parameter information, unique identifier, and detailed node information to obtain a cluster configuration parameter file, which is sent to the front-end device for visual display, enabling visual interaction for container platform deployment. Upon receiving a deployment command from the front-end device, the back-end device executes the container platform deployment operation based on the configuration parameter information. Throughout this process, users can interact visually with the back-end device, selecting appropriate nodes and configuration parameters through the front-end device and completing the container platform deployment operation through the back-end device. This visual method of selecting nodes and configuration parameters solves the technical problem in existing technologies where the settings parameters for deploying container platforms cannot be flexibly adjusted.
[0100] Furthermore, this invention uses Vue and Golang to implement front-end and back-end data interaction. Through JSON parsing and a template engine, it enables parameter visualization and flexible adjustments. Combining WebSocket, caching, coroutines, and Ansible technologies allows for real-time monitoring of container platform deployment logs, achieving visualized and automated deployment. The Golang-based approach and file-based data storage reduce the program's environmental dependence, enabling it to run in various environments. The visualized container deployment platform developed in this invention is simple to deploy and easy to use. Through its concise operation, it not only allows for flexible adjustment of parameters to adapt to various scenarios and clear, real-time monitoring of the deployment process, but also reduces product maintenance complexity and improves operational efficiency, demonstrating significant value in actual production.
[0101] like Figure 3 As shown, the present invention also provides an apparatus 300 for deploying a container platform, comprising:
[0102] The detection module 310 is used to acquire preliminary node information sent by the front-end device based on the visualization page, perform node connectivity detection based on the preliminary node information, and obtain node connectivity detection results.
[0103] The first processing module 320 is used to determine detailed node information based on the preliminary node information when it is determined that the corresponding node is connectable based on the node connectivity detection result, and to send the detailed node information to the front-end device in JSON format.
[0104] The second processing module 330 is used to obtain the configuration parameter information and its corresponding unique identifier sent by the front-end device, as well as the node details, and to parse and render the configuration parameter information and its corresponding unique identifier, as well as the node details to obtain a cluster configuration parameter file, and to send the cluster configuration parameter file to the front-end device for visualization.
[0105] The deployment module 340 is used to execute the deployment operation of the container platform based on the configuration parameter information when it receives the deployment instruction sent by the front-end device, and push the real-time log information corresponding to the deployment process to the front-end device.
[0106] The container platform deployment device 300 in this embodiment corresponds to the container platform deployment method applied to backend devices in the above embodiments, and they can be referenced together.
[0107] like Figure 4 As shown, the present invention also provides another apparatus 400 for deploying a container platform, comprising:
[0108] Module 410 is used to build a visual page for deploying a container platform;
[0109] The sending and receiving module 420 is used to add preliminary node information based on the visualization page, send the preliminary node information to the backend device, and obtain the node connectivity detection result returned by the backend device.
[0110] The first display module 430 is used to obtain detailed node information in JSON format when it is determined that the corresponding node is connectable based on the node connectivity detection result, and to visualize the detailed node information for the purpose of adding, deleting, modifying and querying the detailed node information.
[0111] The second display module 440 is used to obtain the input configuration parameter information, send the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing and rendering, obtain the cluster configuration parameter file returned by the backend device after parsing and rendering, and visualize the cluster configuration parameter file.
[0112] The deployment module 450 is used to send deployment instructions to the backend device to control the backend device to perform the deployment operation of the container platform based on the configuration parameter information, and to receive the real-time log information corresponding to the deployment process and to visualize the real-time log information.
[0113] The container platform deployment device 400 in this embodiment corresponds to the container platform deployment method applied to the front-end device in the above embodiment, and they can be referenced together.
[0114] The apparatus for deploying a container platform provided in the above embodiments can implement the technical solutions described in the above method embodiments for deploying a container platform. The specific implementation principles of each module or unit can be found in the corresponding content in the above method embodiments for deploying a container platform, and will not be repeated here.
[0115] like Figure 5 As shown, the present invention also provides an electronic device 500. The electronic device 500 includes a processor 501, a memory 502, and a display 503. Figure 5 Only some components of the electronic device 500 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0116] In some embodiments, memory 502 may be an internal storage unit of electronic device 500, such as a hard disk or memory of electronic device 500. In other embodiments, memory 502 may also be an external storage device of electronic device 500, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 500.
[0117] Furthermore, the memory 502 may include both internal storage units of the electronic device 500 and external storage devices. The memory 502 is used to store application software and various types of data installed on the electronic device 500.
[0118] In some embodiments, processor 501 may be a central processing unit (CPU), microprocessor, or other data processing chip for running program code stored in memory 502 or processing data, such as the method for deploying a container platform in this invention.
[0119] In some embodiments, display 503 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 503 is used to display information from electronic device 500 and to display a visual user interface. Components 501-503 of electronic device 500 communicate with each other via a system bus.
[0120] In some embodiments of the present invention, when processor 501 executes a program for deploying a container platform in memory 502, the following steps may be performed:
[0121] Obtain preliminary node information sent by the front-end device based on the visualization page, perform node connectivity detection based on the preliminary node information, and obtain the node connectivity detection result;
[0122] If it is determined that the corresponding node is connectable based on the node connectivity detection result, the node detailed information is determined based on the preliminary node information, and the node detailed information is sent to the front-end device in JSON format;
[0123] The configuration parameter information and its corresponding unique identifier sent by the front-end device, as well as the node details, are obtained. The configuration parameter information and its corresponding unique identifier, as well as the node details, are parsed and rendered to obtain a cluster configuration parameter file. The cluster configuration parameter file is then sent to the front-end device for visualization.
[0124] Upon receiving a deployment instruction from the front-end device, the system executes a container platform deployment operation based on the configuration parameter information and pushes the real-time log information corresponding to the deployment operation to the front-end device.
[0125] Or, including:
[0126] Build a visual page for deploying container platforms;
[0127] Based on the visualization page, add preliminary node information to send the preliminary node information to the backend device and obtain the node connectivity detection results returned by the backend device;
[0128] If the node is determined to be connectable based on the node connectivity detection results, obtain the node details in JSON format and visualize the node details for CRUD operations.
[0129] The system obtains the input configuration parameter information, sends the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing and rendering, obtains the cluster configuration parameter file returned by the backend device after parsing and rendering, and visualizes the cluster configuration parameter file.
[0130] The system sends deployment instructions to the backend device to control the backend device to perform container platform deployment operations based on the configuration parameter information, and receives real-time log information corresponding to the deployment process, and visualizes the real-time log information.
[0131] It should be understood that when the processor 501 executes the program for deploying the container platform in the memory 502, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.
[0132] Furthermore, this embodiment of the invention does not specifically limit the type of electronic device 500 mentioned. Electronic device 500 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the invention, electronic device 500 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0133] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for deploying a container platform provided by the methods described above, the method comprising:
[0134] Obtain preliminary node information sent by the front-end device based on the visualization page, perform node connectivity detection based on the preliminary node information, and obtain the node connectivity detection result;
[0135] If it is determined that the corresponding node is connectable based on the node connectivity detection result, the node detailed information is determined based on the preliminary node information, and the node detailed information is sent to the front-end device in JSON format;
[0136] The configuration parameter information and its corresponding unique identifier sent by the front-end device, as well as the node details, are obtained. The configuration parameter information and its corresponding unique identifier, as well as the node details, are parsed and rendered to obtain a cluster configuration parameter file. The cluster configuration parameter file is then sent to the front-end device for visualization.
[0137] Upon receiving a deployment instruction from the front-end device, the system executes a container platform deployment operation based on the configuration parameter information and pushes the real-time log information corresponding to the deployment operation to the front-end device.
[0138] Or, including:
[0139] Build a visual page for deploying container platforms;
[0140] Based on the visualization page, add preliminary node information to send the preliminary node information to the backend device and obtain the node connectivity detection results returned by the backend device;
[0141] If the node is determined to be connectable based on the node connectivity detection results, obtain the node details in JSON format and visualize the node details for CRUD operations.
[0142] The system obtains the input configuration parameter information, sends the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing and rendering, obtains the cluster configuration parameter information returned by the backend device after parsing and rendering, and visualizes the cluster configuration parameter file.
[0143] The system sends deployment instructions to the backend device to control the backend device to perform container platform deployment operations based on the configuration parameter information, and receives real-time log information corresponding to the deployment process, and visualizes the real-time log information.
[0144] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0145] The method, apparatus, and electronic device for deploying a container platform provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for deploying a container platform, characterized in that, include: Obtain preliminary node information sent by the front-end device based on the visualization page, perform node connectivity detection based on the preliminary node information, and obtain the node connectivity detection result; If it is determined that the corresponding node is connectable based on the node connectivity detection result, the node detailed information is determined based on the preliminary node information, and the node detailed information is sent to the front-end device in JSON format; The configuration parameter information and its corresponding unique identifier sent by the front-end device, as well as the node details, are obtained. The configuration parameter information and its corresponding unique identifier, as well as the node details, are parsed and rendered to obtain a cluster configuration parameter file. The cluster configuration parameter file is then sent to the front-end device for visualization. Upon receiving a deployment instruction from the front-end device, the system executes a container platform deployment operation based on the configuration parameter information and pushes the real-time log information corresponding to the deployment operation to the front-end device. The step of performing node connectivity detection based on the preliminary node information to obtain node connectivity detection results includes: The system receives the preliminary node information based on a Golang struct and performs data verification on the preliminary node information. After the verification is successful, the Golang struct is rendered into a configuration file that can be recognized by the Ansible command. Based on the aforementioned Golang struct, the Ansible command is remotely executed to parse the configuration file and obtain the node connectivity detection results.
2. The method for deploying a container platform according to claim 1, characterized in that, When it is determined that a corresponding node is connectable based on the node connectivity detection result, the detailed node information is determined based on the preliminary node information, including: If the corresponding node is determined to be connectable based on the node connectivity detection results, the preliminary information of the node is retrieved hierarchically to obtain the system information of the node. After converting the system information of the node into a corresponding Golang struct for temporary storage, the Golang struct containing the system information of the node is then persistently stored in a corresponding file in JSON format, so as to obtain the detailed information of the node based on the file information containing the Golang struct.
3. The method for deploying a container platform according to any one of claims 1-2, characterized in that, Also includes: The deployment log information of the container platform is sent to the front-end device so that the deployment log information can be displayed through the front-end device.
4. A method for deploying a container platform, characterized in that, include: Build a visual page for deploying container platforms; Based on the visualization page, add preliminary node information to send the preliminary node information to the backend device and obtain the node connectivity detection results returned by the backend device; If the node is determined to be connectable based on the node connectivity detection results, obtain the node details in JSON format and visualize the node details for CRUD operations. The system obtains the input configuration parameter information, sends the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing and rendering, obtains the cluster configuration parameter file returned by the backend device after parsing and rendering, and visualizes the cluster configuration parameter file. Send deployment instructions to the backend device to control the backend device to perform container platform deployment operations based on the configuration parameter information, and receive real-time log information corresponding to the deployment operations, and visualize the real-time log information; The node connectivity detection result is obtained by the backend device based on the following steps: The system receives the preliminary node information based on a Golang struct and performs data verification on the preliminary node information. After the verification is successful, the Golang struct is rendered into a configuration file that can be recognized by the Ansible command. Based on the aforementioned Golang struct, the Ansible command is remotely executed to parse the configuration file and obtain the node connectivity detection results.
5. The method for deploying a container platform according to claim 4, characterized in that, The step of sending the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing includes: The configuration parameter information, its corresponding unique identifier, and the node details are combined into comprehensive data in JSON format, and the comprehensive data is sent to the backend device for parsing.
6. The method for deploying a container platform according to claim 4 or 5, characterized in that, Also includes: Obtain the deployment log information of the container platform returned by the backend device, and display the deployment log information.
7. An apparatus for deploying a container platform, characterized in that, include: The detection module is used to acquire preliminary node information sent by the front-end device based on the visualization page, perform node connectivity detection based on the preliminary node information, and obtain node connectivity detection results. The first processing module is used to determine detailed node information based on the preliminary node information when it is determined that the corresponding node is connectable based on the node connectivity detection result, and to send the detailed node information to the front-end device in JSON format. The second processing module is used to obtain the configuration parameter information and its corresponding unique identifier sent by the front-end device, as well as the node details, and to parse and render the configuration parameter information and its corresponding unique identifier, as well as the node details to obtain a cluster configuration parameter file, and to send the cluster configuration parameter file to the front-end device for visualization. The deployment module is used to execute the deployment operation of the container platform based on the configuration parameter information when it receives the deployment instruction sent by the front-end device, and push the real-time log information corresponding to the deployment operation to the front-end device; The step of performing node connectivity detection based on the preliminary node information to obtain node connectivity detection results includes: The system receives the preliminary node information based on a Golang struct and performs data verification on the preliminary node information. After the verification is successful, the Golang struct is rendered into a configuration file that can be recognized by the Ansible command. Based on the aforementioned Golang struct, the Ansible command is remotely executed to parse the configuration file and obtain the node connectivity detection results.
8. An apparatus for deploying a container platform, characterized in that, include: Build modules are used to create visual pages for deploying container platforms; The sending and receiving module is used to add preliminary node information based on the visualization page, send the preliminary node information to the backend device, and obtain the node connectivity detection result returned by the backend device. The first display module is used to obtain detailed node information in JSON format when it is determined that the corresponding node is connectable based on the node connectivity detection result, and to visualize the detailed node information for CRUD operations on the detailed node information. The second display module is used to obtain the input configuration parameter information, send the configuration parameter information and its corresponding unique identifier, as well as the node details, to the backend device for parsing and rendering, obtain the cluster configuration parameter file returned by the backend device after parsing and rendering, and visualize the cluster configuration parameter file. The deployment module is used to send deployment instructions to the backend device to control the backend device to perform container platform deployment operations based on the configuration parameter information, and to receive real-time log information corresponding to the deployment operations and to visualize the real-time log information. The node connectivity detection result is obtained by the backend device based on the following steps: The system receives the preliminary node information based on a Golang struct and performs data verification on the preliminary node information. After the verification is successful, the Golang struct is rendered into a configuration file that can be recognized by the Ansible command. Based on the aforementioned Golang struct, the Ansible command is remotely executed to parse the configuration file and obtain the node connectivity detection results.
9. An electronic device, characterized in that, Including memory and processor, among which, The memory is used to store programs; The processor, coupled to the memory, is configured to execute the program stored in the memory to implement the steps of the method for deploying a container platform as described in any one of claims 1 to 3, or to implement the steps of the method for deploying a container platform as described in any one of claims 4 to 6.