Automatic application deployment and operation and maintenance method based on Rancher in off-line environment
By adopting Rancher-based application automation deployment and operation and maintenance methods in offline environments, combined with tools such as K3s, Ansible, Helm Chart, Longhorn, MinIO and Prometheus, the complexity and cost of application deployment and operation and maintenance in the existing technology are solved. The problem has achieved efficient and automated application management and data protection.
Patent Information
- Application Number
- CN202411458499.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-14
AI Technical Summary
The application deployment and operation and maintenance methods in the existing offline environment have problems such as high upgrade and maintenance costs, poor adaptability of multiple environments, lack of expansion capabilities and operation and maintenance complexity.
Adopt Rancher-based application automation deployment and operation and maintenance methods, combine K3s and Ansible playbook for automated deployment of Kubernetes clusters and tools, use Helm Chart for application deployment, use Longhorn and MinIO for data backup and disaster recovery, and combine Prometheus and Alertmanager for monitoring and alarm.
It realizes automation of application deployment and operation and maintenance, reduces operation and maintenance complexity and cost, improves multi-environment adaptability and scalability, and ensures high availability and rapid recovery of data.
Smart Images

Figure CN119440548A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to an application automation deployment and operation and maintenance method based on Rancher in an offline environment. Background Art
[0002] Currently, in some special fields, the application deployment environment is usually unable to connect to the Internet of Things, which makes the deployment, implementation and operation of the application very difficult.
[0003] There are three common offline application deployment and operation methods in the industry:
[0004] 1. Based on installation scripts and application installation packages.
[0005] This method is a more traditional deployment method and is usually suitable for simple application scenarios that do not involve complex dependencies. The installation steps are as follows:
[0006] 1) Prepare the installation script. First, you need to write an installation script to automate the application installation process. This script needs to consider the application installation path, configuration file generation and modification, and dependency installation.
[0007] 2) Package the application and its dependencies. Package the application and all its dependencies (such as libraries, binaries, configuration files, etc.) required to run into one or more files. Usually choose to use .tar.gz, .zip and other formats
[0008] 3) Copy the script and installation package to the offline environment. Transfer the prepared installation script and packaged files to the target offline environment through physical media or other means, and then run the installation script in the environment to complete the application deployment.
[0009] 2. Deployment via Docker container.
[0010] Docker is a lightweight containerization technology that can package applications and their dependencies in a container image, allowing the application to run in any environment. Docker container deployment is a very popular modern deployment method, especially suitable for microservice architecture. The installation steps are as follows:
[0011] 1) Prepare a Docker image. Package the application and all its dependencies (such as the operating system, libraries, configuration files, etc.) into a Docker image. Then define the image building steps through the Dockerfile and use the docker build command to generate the image.
[0012] 2) Transfer the image file. Transfer the generated Docker image file (such as a .tar file) to the offline environment through physical media or other means.
[0013] 3) Load the image and run the container. In an offline environment, use the docker load command to load the transferred image file, and then use the docker run command to start the application container.
[0014] 3. Deploy applications in Kubernetes cluster mode.
[0015] Kubernetes (K8s for short) is a container orchestration platform that enables automatic deployment, expansion, operation and management of applications. Kubernetes can manage Docker containers well and provide load balancing, automatic expansion, rolling upgrades and other functions. It is suitable for deploying applications that require high availability, load balancing and automated operation and maintenance. The installation steps are as follows:
[0016] 1) Prepare a Kubernetes cluster. First, you need to build a Kubernetes cluster in the target offline environment. This step involves installing the Kubernetes Master and multiple Node nodes, and usually requires configuring network plug-ins, storage plug-ins, and other plug-ins.
[0017] 2) Prepare the Kubernetes deployment configuration file for the application, including YAML files such as Kubernetes deployment, services, persistent volumes, and configuration mapping for the application.
[0018] 3) Copy the configuration file to the offline environment and apply it. Transfer the prepared Kubernetes configuration file to the target offline environment through physical media or other means, and then use the kubectl apply command to apply it in the cluster.
[0019] However, the inventors of the present application discovered that the above three application deployment and operation and maintenance methods all have certain defects.
[0020] The upgrade maintenance and deployment cost based on installation scripts and application installation packages is high. Each upgrade requires repackaging the application and transferring it to the target environment, and then executing the installation script for upgrade, which is cumbersome. In addition, this method is not adaptable to multiple environments. Different installation scripts need to be written for different operating system environments (such as different versions of Linux or Windows), which increases maintenance costs.
[0021] Docker container deployment lacks scalability. Simple Docker container deployment lacks orchestration capabilities and cannot well support cluster deployment and expansion of complex applications.
[0022] Deploying applications in Kubernetes clusters is not user-friendly for operators. The deployment and maintenance of Kubernetes clusters is relatively complex, involving many knowledge points (such as Pod, Service, Ingress, ConfigMap, etc.), requiring operators to have a high level of technical knowledge. In addition, this deployment method is very difficult to implement. It is difficult to build and configure Kubernetes clusters, and it is necessary to manage a large number of YAML configuration files. Manual operations are prone to errors. Summary of the invention
[0023] In view of this, the embodiments of the present application propose an automated application deployment and operation and maintenance method based on Rancher in an offline environment, which greatly simplifies the related work of application deployment and operation and maintenance, helps operation and maintenance personnel to quickly deploy and efficiently maintain applications in an offline environment, and well achieves the goal of reducing costs and increasing efficiency.
[0024] In a first aspect, an embodiment of the present application proposes an application automation deployment and operation and maintenance method based on Rancher in an offline environment, comprising the following steps:
[0025] Combine K3s and Ansible playbook to automate the deployment of Kubernetes clusters and related tools;
[0026] After completing the development of the target application, build the application image of the target application, make the Helm Chart of the target application, and publish the application image and Helm Chart of the target application to the private warehouse;
[0027] Add the private repository to Rancher, make sure the Helm Chart is accessible to Rancher, and use Rancher to configure and deploy the Helm Chart to deploy the target application.
[0028] Longhorn is used as a distributed block storage solution, combined with MinIO as the storage location for backup data, to achieve backup and disaster recovery of target applications;
[0029] Prometheus and Alertmanager are used to monitor and alert target applications, and Mattermost is used as a tool for message notification and operation and maintenance communication.
[0030] Optionally, the combination of K3s and Ansible playbook to perform automated deployment of Kubernetes clusters and related tools includes:
[0031] Use K3s as a lightweight Kubernetes cluster. In the preparation phase, configure Ansible playbook, download K3s binary files and all offline dependent images, and configure cluster node information. The node information that needs to be configured includes node IP address and user name. After the preparation phase is completed, execute Ansible playbook to automatically complete the installation of the Kubernetes cluster.
[0032] Deploy related tools based on Ansible playbook. During the deployment process, first check the status information of the cluster nodes, then copy the image files of each tool to the working node, use Kubernetes commands to import the image files of each tool into the cluster, and install them in a certain order.
[0033] The related tools that need to be installed include Longhorn, MinIO, Nexus, Rancher, Prometheus, Alertmanager and Mattermost. Among them, Longhorn needs to be installed first.
[0034] Optionally, building an application image of the target application, making a Helm Chart of the target application, and publishing the application image and the Helm Chart of the target application to a private repository includes:
[0035] After the development of the target application is completed, it is packaged into an application image through docker build, which contains all the dependencies of the target application;
[0036] Follow Rancher's Chart production standards to create the Helm Chart of the target application. The Helm Chart of the target application contains the deployment information of the target application in the cluster, including storage location, size, memory usage, number of CPU cores, redundancy, database information, and other configurations of the target application itself;
[0037] Publish the application image and Helm Chart of the target application to the private repository Nexus.
[0038] Optionally, use Rancher to configure and deploy the Helm Chart to deploy the target application, including:
[0039] Add the private repositories Nexus and Helm to Rancher and ensure that the Helm Chart is accessible to Rancher.
[0040] Log in to the Rancher management console and select the Kubernetes cluster where you want to deploy the target application;
[0041] In the Rancher UI, go to the Application Marketplace, add a new application repository, select Helm as the application repository type and enter the Helm URL and credentials;
[0042] Search and select the Helm Chart you want to deploy. Rancher will display all available application templates and versions.
[0043] Select the target application to be deployed and enter the configuration page for application deployment. Rancher provides a UI form to configure the parameters of the Helm Chart. The parameters that need to be configured include the application name and namespace, version selection, and customization of Chart values. The customization of Chart values includes the number of replicas, resource limits, service types, and storage volume configuration.
[0044] After the configuration is complete, go to the configuration review page to check all configured parameters to ensure that the configuration meets expectations;
[0045] Start deploying the Helm Chart, calling the Kubernetes API and Helm commands to create corresponding resource objects, including Deployment, Service, and Ingress;
[0046] Among them, Rancher also supports viewing deployment progress, as well as managing and updating deployed applications.
[0047] Optionally, the adopting Longhorn as a distributed block storage solution includes:
[0048] Through the user interface provided by Longhorn, high-availability storage volume management is performed according to the needs of the target application, including creating, managing, and backing up persistent storage volumes in Kubernetes;
[0049] Define different backup strategies according to business needs, and perform snapshots and backups of storage volumes based on the backup strategies. The backup strategies include full backup, incremental backup, and differential backup.
[0050] Perform backup operations regularly by configuring CronJob or scheduled tasks;
[0051] In the event of a target application failure or data corruption, select the snapshot or backup that needs to be restored through Rancher's Longhorn plug-in interface and restore it to the specified storage volume.
[0052] Optionally, combining MinIO as a storage location for backup data includes:
[0053] In Longhorn configuration, MinIO is used as the external backup storage target. By configuring MinIO's access key and bucket information, snapshot backups are automatically uploaded to MinIO storage.
[0054] Among them, MinIO provides a highly available storage architecture through data sharding and redundancy mechanisms, which can cope with hardware failures or system downtime and ensure the security and reliability of backup data.
[0055] Optionally, use Prometheus and Alertmanager to monitor and alert target applications, including:
[0056] In the Kubernetes cluster, use Prometheus to monitor key indicators of various applications and operating environments, including CPU usage, memory consumption, network traffic, request latency, and error rate;
[0057] Configure corresponding alarm rules in Prometheus according to business needs and the running status of the application. The alarm rules include threshold alarms for specific indicators and complex multi-condition alarms. When the alarm conditions are met, Prometheus generates alarm information and sends it to Alertmanager.
[0058] After receiving the alarm information from Prometheus, Alertmanager groups and suppresses the alarm information according to the pre-configured routing strategy to avoid triggering too many alarm information due to the same event, and then generates a notification message and sends it to the specified recipient through the configured notification channel.
[0059] Optionally, use Mattermost as a tool for message notification and operation and maintenance communication, including:
[0060] Integrate Prometheus and Alertmanager with Mattermost to push alert information to specified channels and / or users of Mattermost in real time;
[0061] When a monitoring indicator of the target application triggers an alarm, Mattermost sends a notification message to the specified channel and / or user. The content of the notification message includes the alarm level, reason, time, and related indicators;
[0062] Among them, Mattermost instant messaging, group chat, file sharing and discussion also support team members to discuss problems, share fault information, analyze log data, and develop solutions.
[0063] The embodiment of the present application proposes an application automation deployment and operation and maintenance method based on Rancher in an offline environment, which brings at least the following beneficial effects compared with the traditional method:
[0064] First, it has a higher degree of automation and a simplified operation and maintenance process.
[0065] By integrating Kubernetes, Helm, Longhorn, MinIO and other tools through Rancher, a multi-tool collaborative automated operation and maintenance platform is formed. Compared with the traditional installation script or the use of a single tool, this application can automatically complete the entire process from cluster deployment to application management, data backup and monitoring alarms, simplifying the operation process, greatly improving the automation of application deployment and operation and maintenance, reducing the burden of manual configuration and script maintenance, and reducing potential errors.
[0066] Second, it has flexible multi-node deployment and expansion capabilities.
[0067] The combination of K3s and Ansible playbook is used to implement an adaptive Kubernetes cluster deployment solution. K3s reduces the complexity of Kubernetes, and Ansible playbook supports batch installation and dynamic configuration adjustment. Compared with the complex manual configuration of Kubernetes in traditional solutions, the solution of this application is easier to deploy quickly in a network-isolated environment, and nodes can be expanded and adjusted at any time. It is suitable for complex multi-node environments and meets the needs of business growth.
[0068] Third, it has multi-level data protection capabilities and efficient disaster recovery capabilities.
[0069] Longhorn provides distributed block storage and cross-node snapshot and incremental backup functions, and combines MinIO object storage as the backup target to build a flexible backup and recovery system. Compared with the simple storage volume backup method in traditional solutions, the solution of this application supports multiple backup strategies (such as scheduled snapshots, incremental backups), and can quickly recover in the event of data loss or system failure, enhancing data security and ensuring data integrity and high availability.
[0070] Fourth, it has a visual configuration and management interface, which lowers the technical threshold.
[0071] Through the graphical interface provided by the Rancher platform and the templated configuration of Helm Chart, users can directly deploy, configure and upgrade applications through the UI without having to deeply understand the internal structure of Kubernetes. Compared with the complex operation of the current Kubernetes command line tool, the visualization solution of this application greatly reduces the difficulty of use, is suitable for users of different skill levels, reduces the technical threshold of operation and maintenance personnel, and improves the ease of deployment and management.
[0072] Fifth, it provides an integrated monitoring and alarm system, which effectively improves operation and maintenance efficiency and response speed.
[0073] Combining Prometheus, Alertmanager and Mattermost, an integrated monitoring, alerting and team collaboration mechanism is implemented. Compared with independent monitoring tools in traditional solutions, the solution of this application can automatically collect application operation data, generate alerts in real time and notify relevant personnel through Mattermost, effectively reducing the time for problem discovery and resolution, and improving the reliability and stability of the system.
[0074] In summary, this application provides a more integrated, efficient, flexible and easy-to-use application deployment and operation and maintenance solution in an offline environment, which helps operation and maintenance personnel to quickly deploy and efficiently maintain applications in an offline environment, and well achieves the goal of reducing costs and increasing efficiency.
[0075] In a second aspect, an embodiment of the present application proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute an application automation deployment and operation and maintenance method based on Rancher in an offline environment as described in the first aspect above.
[0076] In a third aspect, an embodiment of the present application proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement an application automation deployment and operation and maintenance method based on Rancher in an offline environment as described in the first aspect above.
[0077] It can be understood that the beneficial effects of the second to third aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0079] Figure 1 It is a flowchart of an application automation deployment and operation and maintenance method based on Rancher in an offline environment provided in an embodiment of the present application;
[0080] Figure 2 It is a schematic diagram of cluster construction and tool deployment provided in one embodiment of the present application;
[0081] Figure 3 It is a schematic diagram of building and publishing an application image and a Chart provided in one embodiment of the present application;
[0082] Figure 4 is a schematic diagram of application configuration and deployment provided in one embodiment of the present application;
[0083] Figure 5 is a schematic diagram of backup and disaster recovery strategy settings provided in an embodiment of the present application;
[0084] Figure 6 is a schematic diagram of application monitoring and alarm configuration provided in one embodiment of the present application;
[0085] Figure 7 It is a structural schematic diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0086] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. In the various embodiments of the present application, many technical details are proposed in order to make the reader better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is only for the convenience of description, and the specific implementation mode of the present application should not constitute any limitation. The various embodiments can be combined with each other and referenced to each other under the premise of no contradiction.
[0087] In order to overcome the defects existing in traditional application deployment and operation and maintenance methods, an embodiment of the present application proposes an application automation deployment and operation and maintenance method based on Rancher in an offline environment, which is applied to an electronic device, wherein the electronic device can be a terminal or a server. In this embodiment and the following embodiments, the electronic device is explained using the server as an example. The implementation details of the application automation deployment and operation and maintenance method based on Rancher in an offline environment proposed in this embodiment are specifically described below. The following content is only the implementation details provided for the convenience of understanding, and is not necessary for the implementation of this solution.
[0088] The specific process of the Rancher-based application automation deployment and operation and maintenance method in an offline environment proposed in this embodiment can be as follows: Figure 1 As shown, including:
[0089] Step 101, combine K3s and Ansible playbook to automate the deployment of Kubernetes clusters and related tools.
[0090] In the specific implementation, the first step of automatic application deployment is to build a cluster and deploy tools. This embodiment combines K3s and Ansible playbook to automatically deploy Kubernetes clusters and related tools. K3s is a simplified version of k8s, which retains the core functions of k8s and has the advantages of being lightweight and easy to use. At the same time, it maintains compatibility with the k8s ecosystem, making it very suitable for rapid deployment and easy to maintain.
[0091] like Figure 2 As shown in the figure, K3s is used as a lightweight Kubernetes cluster when automating the deployment of Kubernetes clusters and related tools. In the preparation phase, you need to configure the Ansible playbook, download the K3s binary file and all offline dependent images, and configure the cluster's node information. The configured node information includes the node IP address, user name, password, etc. After the preparation phase is completed, you can automatically complete the installation of the Kubernetes cluster by executing the Ansible playbook.
[0092] Subsequently, the relevant tools are deployed based on Ansible playbook. During the deployment process, the status information of the cluster nodes must be checked first, and then the image files of each tool must be copied to the working nodes. The image files of each tool must be imported into the cluster using Kubernetes commands, and then installed in a certain order.
[0093] The tools that need to be installed include Longhorn, MinIO, Nexus, Rancher, Prometheus, Alertmanager, and Mattermost. Among them, Longhorn needs to be installed first because the storage volumes of other applications need to be managed by Longhorn. This predefined installation process based on Ansible ensures the consistency and efficiency of deployment and is suitable for complex offline environments.
[0094] Step 102, after the development of the target application is completed, an application image of the target application is built, a Helm Chart of the target application is made, and the application image and the Helm Chart of the target application are published to a private warehouse.
[0095] In the specific implementation, after completing the development of the target application, you can enter the stage of building and publishing the application image and chart. In this stage, you need to build the application image of the target application, make the Helm Chart of the target application, and publish the application image and Helm Chart of the target application to the private warehouse Nexus.
[0096] like Figure 3 As shown in the figure, after the development of the target application is completed, it is packaged into an application image through docker build. The application image contains all the dependencies of the target application to ensure the integrity of the dependencies in an offline environment.
[0097] When making the Helm Chart of the target application, you need to follow Rancher's Chart production standards, so that when you deploy the Chart in Rancher, a UI form will be generated, and it will be easier to deploy the target application according to the UI form. The Helm Chart of the target application contains the deployment information of the target application in the cluster, including storage location, size, memory usage, number of CPU cores, redundancy, database information, and other configurations of the target application itself. Helm can automatically complete the deployment of the application in Kubernetes based on this information.
[0098] After completing the construction of the target application's application image and the production of the Helm Chart, you can publish the target application's application image and Helm Chart to the private repository Nexus.
[0099] Step 103, add the private repository to Rancher, ensure that the Helm Chart is accessible to Rancher, and use Rancher to configure and deploy the Helm Chart to achieve the deployment of the target application.
[0100] In the specific implementation, after publishing the application image and Helm Chart of the target application to the private repository, you can enter the application configuration and deployment stage. In this stage, the private repository is added to Rancher, ensuring that the Helm Chart is accessible to Rancher, and using Rancher to configure and deploy the Helm Chart to achieve the deployment of the target application. At this point, the target application is deployed.
[0101] Rancher is a K8s management tool that provides a K8s management UI and uses Helm for package management. To address the issue of offline delivery, Rancher can be installed in a variety of operating environments (physical servers, virtual machines, private clouds), and provides some application automation operations and maintenance functions. Using Rancher to deploy applications shields the complexity and differences of container infrastructure, and operators can easily deploy applications without having to learn k8s container-related technologies and concepts.
[0102] like Figure 4 As shown in the figure, when using Rancher to configure and deploy Helm Chart, first prepare and add the Helm repository, that is, add the private repository Nexus and Helm to Rancher to ensure that all required Helm Charts have been pushed and are accessible to Rancher.
[0103] After the preparation is complete, you can use Rancher to deploy the Chart.
[0104] First, log in to the Rancher management console (Rancher UI), such as through a web browser, and select the Kubernetes cluster where you want to deploy the target application.
[0105] Next, access the application market. In the Rancher UI, navigate to the Apps & Marketplace section of the menu and enter the application market page.
[0106] Then, click the Manage Catalogs option in the application market and add a new application repository. Fill in the name of the repository (for example, Nexus-Helm), select Helm as the type, and enter the URL and credentials of Helm.
[0107] Then, return to the application market page, search and select the Helm Chart you want to deploy, and Rancher will display all available application templates and versions.
[0108] Then, select the target application to be deployed and enter the configuration page for application deployment. Rancher provides a UI form to configure the parameters of the Helm Chart. The parameters that need to be configured include the application name and namespace, version selection, and customization of Chart values. The customization of Chart values includes the number of replicas, resource limits, service types, and storage volume configurations.
[0109] After the configuration is complete, click Next or Review to enter the configuration review page to review all configured parameters to ensure that the configuration meets expectations.
[0110] After that, start the deployment of the Helm Chart, click the Launch or Deploy button, call the Kubernetes API and Helm commands to create the corresponding resource objects, including Deployment, Service, Ingress, etc.
[0111] After the deployment is successful, users can monitor the deployment status of the target application on the Workloads page of Rancher. Rancher provides detailed log and event viewing functions to help users track the deployment progress of the application in real time and solve potential problems.
[0112] Rancher also supports the management and update of deployed applications. Users can directly update the version of Helm Chart through the application market, or modify the configuration parameters of the Chart, and Rancher will automatically update Kubernetes resources.
[0113] Step 104, Longhorn is used as a distributed block storage solution, combined with MinIO as a storage location for backup data, to achieve backup and disaster recovery of the target application.
[0114] In the specific implementation, after the application deployment is completed, it enters the operation and maintenance stage. The operation and maintenance consists of two major parts: backup and disaster recovery, and monitoring and alarm. In backup and disaster recovery, Longhorn is used as a distributed block storage solution, combined with MinIO as the storage location for backup data, to achieve backup and disaster recovery of the target application.
[0115] In an offline application operation and maintenance environment, data storage strategy formulation and management are crucial, especially in ensuring high availability, integrity, and rapid recovery capabilities of application data.
[0116] Longhorn is an open source distributed block storage system designed for Kubernetes. It provides a lightweight, highly available persistent storage solution that simplifies storage management and ensures data security and availability. It seamlessly integrates with Kubernetes, supports the CSI standard, and can be directly recognized and used by Kubernetes. Users can manage Longhorn storage volumes through Kubernetes' PersistentVolume and PersistentVolumeClaim.
[0117] MinIO is a high-performance object storage service that is compatible with the Amazon S3 cloud storage service interface and is designed for storing massive amounts of unstructured data. It supports deployment in private clouds, public clouds, and edge computing environments. It supports distributed deployment, can store data on multiple nodes, provides horizontal expansion capabilities, and is very suitable for deployment in bare metal offline environments.
[0118] like Figure 5 As shown, Longhorn is used as a distributed block storage solution, which includes:
[0119] 1) Create and manage storage volumes. Longhorn provides an intuitive user interface that allows easy management of storage volumes on the Rancher platform. Operations and maintenance personnel can create highly available storage volumes based on application requirements, which can be automatically replicated and synchronized between different nodes to ensure data reliability and availability.
[0120] 2) Configuration of backup strategies. Longhorn supports snapshots and backups of storage volumes. A snapshot is a complete copy of a storage volume at a certain point in time, while backup is the process of copying these snapshots to external storage (MinIO). Operations and maintenance personnel can define different backup strategies based on business needs, including full backup, incremental backup, and differential backup.
[0121] 3) Automated backup management. Longhorn provides automated backup functions, which can be used to perform backup operations regularly by configuring CronJob or scheduled tasks. Users can set the frequency of backups (for example, daily or weekly), the number of backups to be retained, and the alarm mechanism after backup failure. In this way, data can be effectively protected even when no one is on duty.
[0122] 4) Data recovery. In the event of application failure or data corruption, Longhorn can quickly restore data from backups. Users can select the snapshot or backup to be restored through the Rancher Longhorn plug-in interface and restore it to the specified storage volume to ensure that the business system can be quickly restored.
[0123] like Figure 5 As shown, MinIO is used as the storage location for backup data, including:
[0124] 1) Backup storage configuration. In Longhorn's configuration, MinIO can be used as an external backup storage target. By configuring MinIO's access key and bucket information, Longhorn can automatically upload snapshot backups to MinIO storage. MinIO's object storage mechanism ensures the security and accessibility of backup data.
[0125] 2) High availability and persistence of data storage. MinIO provides a highly available storage architecture through data sharding and redundancy mechanisms, which can cope with hardware failures or system downtime and ensure the security and reliability of backup data. In addition, MinIO's multi-tenant support and access control list (ACL) function can further enhance the security management of backup data.
[0126] like Figure 5 As shown, in order to ensure the integrity and security of data, this embodiment also formulates a scheduled backup strategy to achieve automated and continuous backup management. The configuration and execution of the scheduled backup strategy mainly include the following contents:
[0127] 1) Define the backup frequency and retention policy. Configure the corresponding backup plan according to the criticality of the application and the frequency of data changes. For example, for database applications, it is usually necessary to configure daily full backups and hourly incremental backups. The backup retention policy can also be flexibly configured according to storage space and business needs, such as retaining daily backups for the last 7 days and weekly backups for the last 30 days.
[0128] 2) Monitoring and alarm mechanism. Configure Prometheus and Prometheus Alert, and integrate with Longhorn and MinIO to monitor the execution status of backup tasks. When a backup task fails or is not executed on time, an alarm is triggered and the relevant operation and maintenance personnel are notified through Mattermost so that the problem can be handled and solved in a timely manner.
[0129] 3) Regularly verify the integrity of the backup. In order to ensure the reliability of the backup data, the backup integrity verification task is performed regularly. The verification task compares the hash value or checksum of the backup data to ensure that the backup data has not been damaged or tampered with.
[0130] 4) Regularly test data recovery capabilities. In addition to data backup, data recovery tests should be performed regularly to verify the availability of backup data and the correctness of the recovery process. By simulating disaster recovery scenarios, ensure that application services can be quickly and reliably restored in the actual production environment.
[0131] Step 105, use Prometheus and Alertmanager to monitor and alert the target application, and combine Mattermost as a tool for message notification and operation and maintenance communication.
[0132] In the specific implementation, Prometheus and Alertmanager are used for target application monitoring and alerting in monitoring and alerting, and Mattermost is used as a tool for message notification and operation and maintenance communication.
[0133] In a complex offline environment, real-time monitoring and alarm management of applications are crucial. In order to ensure the stable operation of applications and quickly respond to potential problems, this embodiment uses Prometheus and Alertmanager for application monitoring and alarming, and combines Mattermost as a tool for message notification and operation and maintenance communication. In other words, this embodiment provides an integrated application monitoring and notification system that can effectively improve the response speed and collaborative efficiency of the operation and maintenance team.
[0134] Prometheus is an open source system monitoring and alerting tool designed for containerized and microservice architectures. It collects various monitoring indicators from applications and systems in a pull manner and stores time series data locally.
[0135] Alertmanager is the alarm management component of Prometheus, which is used to process the alarms generated by Prometheus and perform operations such as alarm grouping, suppression, and notification.
[0136] like Figure 6 As shown in the figure, Prometheus and Alertmanager are used to monitor and alert the target application, including:
[0137] 1) Collection of application monitoring indicators. In the Kubernetes cluster, use Prometheus to monitor key indicators of various applications and their operating environment, including CPU usage, memory consumption, network traffic, request latency, and error rate. By integrating the Prometheus client in the application or using resources such as ServiceMonitor and PodMonitor, operation and maintenance personnel can easily define the monitoring indicators that need to be collected.
[0138] 2) Configuration of alarm rules. According to business needs and the operating status of the application, the operation and maintenance team can configure corresponding alarm rules in Prometheus. These rules can be threshold alarms for specific indicators (such as CPU usage exceeding 80%) or complex multi-condition alarms (such as multiple services are unavailable). When the alarm conditions are met, Prometheus will generate an alarm and send it to Alertmanager.
[0139] 3) Alarm management and notification. After receiving the alarm information from Prometheus, Alertmanager will group and suppress the alarm according to the pre-configured routing strategy to avoid triggering too many alarm information due to the same event. Alertmanager sends the alarm message to the specified receiver through the configured notification channel.
[0140] In this embodiment, Alertmanager is configured to send alert messages to the Mattermost platform so that relevant operation and maintenance personnel can be notified in a timely manner. Mattermost is an open source, self-hosted team communication platform similar to Slack, but can run in offline and private network environments. It supports message notifications, file sharing, team collaboration, and third-party integration, which is very suitable for internal communication and collaboration needs of enterprises.
[0141] like Figure 6 As shown, Mattermost is used as a tool for message notification and operation and maintenance communication, including:
[0142] 1) Real-time notification of alarm messages. By integrating Prometheus, Alertmanager and Mattermost, alarm information can be pushed to the specified channel and / or user of Mattermost in real time. Whenever a monitoring indicator of the application triggers an alarm, the operation and maintenance personnel will receive a notification message in Mattermost, including the alarm level, reason, time and detailed information of related indicators. In this way, the operation and maintenance personnel can quickly learn about system problems and deal with them accordingly.
[0143] 2) Communication and collaboration. Mattermost provides a wealth of communication features, including support for instant messaging, group chat, file sharing, and discussion topics. After receiving an alert, maintenance personnel can discuss issues, share fault information, analyze log data, and develop corresponding solutions directly with other team members on the Mattermost platform. Through Mattermost's plug-ins and integration functions, problem management systems, document systems, etc. can also be integrated into the platform to further improve collaboration efficiency.
[0144] The Rancher-based application automation deployment and operation and maintenance method in an offline environment proposed in this embodiment has at least the following beneficial effects compared to the traditional method:
[0145] First, it has a higher degree of automation and a simplified operation and maintenance process.
[0146] By integrating Kubernetes, Helm, Longhorn, MinIO and other tools through Rancher, an automated operation and maintenance platform with multi-tool collaboration is formed. Compared with the traditional installation script or the use of a single tool, this embodiment can automatically complete the whole process from cluster deployment to application management, data backup and monitoring alarm, simplifying the operation process, greatly improving the automation of application deployment and operation and maintenance, reducing the burden of manual configuration and script maintenance, and reducing potential errors.
[0147] Second, it has flexible multi-node deployment and expansion capabilities.
[0148] The combination of K3s and Ansible playbook is used to implement an adaptive Kubernetes cluster deployment solution. K3s reduces the complexity of Kubernetes, and Ansible playbook supports batch installation and dynamic configuration adjustment. Compared with the complex manual configuration of Kubernetes in traditional solutions, the solution of this embodiment is easier to deploy quickly in a network-isolated environment, and can expand and adjust nodes at any time. It is suitable for complex multi-node environments and meets the needs of business growth.
[0149] Third, it has multi-level data protection capabilities and efficient disaster recovery capabilities.
[0150] Longhorn provides distributed block storage and cross-node snapshot and incremental backup functions, and combines MinIO object storage as the backup target to build a flexible backup and recovery system. Compared with the simple storage volume backup method in traditional solutions, the solution of this embodiment supports multiple backup strategies (such as scheduled snapshots and incremental backups), and can quickly recover in the event of data loss or system failure, enhancing data security and ensuring data integrity and high availability.
[0151] Fourth, it has a visual configuration and management interface, which lowers the technical threshold.
[0152] Through the graphical interface provided by the Rancher platform and the templated configuration of the Helm Chart, users can directly deploy, configure and upgrade applications through the UI without having to deeply understand the internal structure of Kubernetes. Compared with the complex operation of the current Kubernetes command line tool, the visualization solution of this embodiment greatly reduces the difficulty of use, is suitable for users of different skill levels, reduces the technical threshold of operation and maintenance personnel, and improves the ease of deployment and management.
[0153] Fifth, it provides an integrated monitoring and alarm system, which effectively improves operation and maintenance efficiency and response speed.
[0154] Combining Prometheus, Alertmanager and Mattermost, an integrated monitoring, alerting and team collaboration mechanism is implemented. Compared with independent monitoring tools in traditional solutions, the solution of this embodiment can automatically collect application operation data, generate alerts in real time and notify relevant personnel through Mattermost, effectively reducing the time for problem discovery and resolution, and improving the reliability and stability of the system.
[0155] In summary, this embodiment provides a more integrated, efficient, flexible and easy-to-use application deployment and operation and maintenance solution in an offline environment, which helps operation and maintenance personnel to quickly deploy and efficiently maintain applications in an offline environment, and well achieves the goal of reducing costs and increasing efficiency.
[0156] The step division of the above methods is only for clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this application; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this application.
[0157] Another embodiment of the present application provides an electronic device, whose specific structure is as follows: Figure 7 As shown, it includes: at least one processor 201; and a memory 202 that is communicatively connected to the at least one processor 201; wherein the memory 202 stores instructions that can be executed by the at least one processor 201, and the instructions are executed by the at least one processor 201, so that the at least one processor 201 can execute the application automation deployment and operation and maintenance method based on Rancher in an offline environment described in the above-mentioned method embodiments.
[0158] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and will not be further described in this article. The bus interface is responsible for providing an interface between the bus and the transceiver. The transceiver can be one component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on a wireless medium through an antenna, and further, the antenna also receives data and transmits the data to the processor.
[0159] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.
[0160] Another embodiment of the present application proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the Rancher-based application automation deployment and operation and maintenance method in an offline environment described in the above method embodiments.
[0161] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, ROM (Read-Only Memory), RAM (Random Access Memory), disk or optical disk and other media that can store program codes.
[0162] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.
Claims
1. A Rancher-based application automation deployment and operation and maintenance method in an offline environment, characterized in that: include: Combine K3s and Ansible playbook to automate the deployment of Kubernetes clusters and related tools; After completing the development of the target application, build the application image of the target application, make the Helm Chart of the target application, and publish the application image and Helm Chart of the target application to the private warehouse; Add the private repository to Rancher, make sure the Helm Chart is accessible to Rancher, and use Rancher to configure and deploy the Helm Chart to deploy the target application. Longhorn is used as a distributed block storage solution, combined with MinIO as the storage location for backup data, to achieve backup and disaster recovery of target applications; Prometheus and Alertmanager are used to monitor and alert target applications, and Mattermost is used as a tool for message notification and operation and maintenance communication.
2. The Rancher-based application automation deployment and operation and maintenance method in an offline environment as described in claim 1, characterized in that: The combination of K3s and Ansible playbooks to automate the deployment of Kubernetes clusters and related tools includes: Use K3s as a lightweight Kubernetes cluster. In the preparation phase, configure Ansible playbook, download K3s binary files and all offline dependent images, and configure cluster node information. The node information that needs to be configured includes node IP address and user name. After the preparation phase is completed, execute Ansible playbook to automatically complete the installation of the Kubernetes cluster. Deploy related tools based on Ansible playbook. During the deployment process, first check the status information of the cluster nodes, then copy the image files of each tool to the working node, use Kubernetes commands to import the image files of each tool into the cluster, and install them in a certain order. The related tools that need to be installed include Longhorn, MinIO, Nexus, Rancher, Prometheus, Alertmanager and Mattermost. Among them, Longhorn needs to be installed first.
3. The Rancher-based application automation deployment and operation and maintenance method in an offline environment as claimed in claim 2, characterized in that: The step of building the application image of the target application, making the Helm Chart of the target application, and publishing the application image and the Helm Chart of the target application to a private repository includes: After the development of the target application is completed, it is packaged into an application image through docker build, which contains all the dependencies of the target application; Follow Rancher's Chart production standards to create the Helm Chart of the target application. The Helm Chart of the target application contains the deployment information of the target application in the cluster, including storage location, size, memory usage, number of CPU cores, redundancy, database information, and other configurations of the target application itself; Publish the application image and Helm Chart of the target application to the private repository Nexus.
4. The Rancher-based application automation deployment and operation and maintenance method in an offline environment as claimed in claim 3, characterized in that: Use Rancher to configure and deploy Helm Chart to deploy the target application, including: Add the private repositories Nexus and Helm to Rancher and ensure that the Helm Chart is accessible to Rancher. Log in to the Rancher management console and select the Kubernetes cluster where you want to deploy the target application; In the Rancher UI, go to the Application Marketplace, add a new application repository, select Helm as the application repository type and enter the Helm URL and credentials; Search and select the Helm Chart you want to deploy. Rancher will display all available application templates and versions. Select the target application to be deployed and enter the configuration page for application deployment. Rancher provides a UI form to configure the parameters of the Helm Chart. The parameters that need to be configured include the application name and namespace, version selection, and customization of Chart values. The customization of Chart values includes the number of replicas, resource limits, service types, and storage volume configuration. After the configuration is complete, go to the configuration review page to check all configured parameters to ensure that the configuration meets expectations; Start deploying the Helm Chart, calling the Kubernetes API and Helm commands to create corresponding resource objects, including Deployment, Service, and Ingress; Among them, Rancher also supports viewing deployment progress, as well as managing and updating deployed applications.
5. The Rancher-based application automation deployment and operation and maintenance method in an offline environment as described in claims 1 to 4, characterized in that: The use of Longhorn as a distributed block storage solution includes: Through the user interface provided by Longhorn, high-availability storage volume management is performed according to the needs of the target application, including creating, managing, and backing up persistent storage volumes in Kubernetes; Define different backup strategies according to business needs, and perform snapshots and backups of storage volumes based on the backup strategies. The backup strategies include full backup, incremental backup, and differential backup. Perform backup operations regularly by configuring CronJob or scheduled tasks; In the event of a target application failure or data corruption, select the snapshot or backup that needs to be restored through Rancher's Longhorn plug-in interface and restore it to the specified storage volume.
6. The Rancher-based application automation deployment and operation and maintenance method in an offline environment as claimed in claim 5, characterized in that: The combination of MinIO as the storage location for backup data includes: In Longhorn configuration, MinIO is used as the external backup storage target. By configuring MinIO's access key and bucket information, snapshot backups are automatically uploaded to MinIO storage. Among them, MinIO provides a highly available storage architecture through data sharding and redundancy mechanisms, which can cope with hardware failures or system downtime and ensure the security and reliability of backup data.
7. The Rancher-based application automation deployment and operation and maintenance method in an offline environment as described in claims 1 to 4, characterized in that: Prometheus and Alertmanager are used to monitor and alert target applications, including: In the Kubernetes cluster, use Prometheus to monitor key indicators of various applications and operating environments, including CPU usage, memory consumption, network traffic, request latency, and error rate; Configure corresponding alarm rules in Prometheus according to business needs and the running status of the application. The alarm rules include threshold alarms for specific indicators and complex multi-condition alarms. When the alarm conditions are met, Prometheus generates alarm information and sends it to Alertmanager. After receiving the alarm information from Prometheus, Alertmanager groups and suppresses the alarm information according to the pre-configured routing strategy to avoid triggering too many alarm information due to the same event, and then generates a notification message and sends it to the specified recipient through the configured notification channel.
8. The Rancher-based application automation deployment and operation and maintenance method in an offline environment as claimed in claim 7, characterized in that: Combine Mattermost as a tool for message notification and operation and maintenance communication, including: Integrate Prometheus and Alertmanager with Mattermost to push alert information to specified channels and / or users of Mattermost in real time; When a monitoring indicator of the target application triggers an alarm, Mattermost sends a notification message to the specified channel and / or user. The content of the notification message includes the alarm level, reason, time, and related indicators; Among them, Mattermost instant messaging, group chat, file sharing and discussion also support team members to discuss problems, share fault information, analyze log data, and develop solutions.
9. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; In which, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute an application automation deployment and operation and maintenance method based on Rancher in an offline environment as described in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it is possible to implement an application automation deployment and operation and maintenance method based on Rancher in an offline environment as described in any one of claims 1 to 8.
Citation Information
Cited By
Kubernetes-based edge collaborative publishing method and device, and medium
CN121309596A