A method for managing application configurations

By deploying an application configuration management platform and utilizing Jenkins and Kubernetes to automate the conversion from YAML to JSON format, the problem of managing multiple configmaps was solved, enabling efficient and accurate application configuration updates and historical records.

CN114035891BActive Publication Date: 2025-10-24SHANGHAI XINZHAOYANG INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111260732.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2025-10-24
Estimated Expiration
2041-10-28

Smart Images

  • Figure CN114035891B_ABST
    Figure CN114035891B_ABST
Patent Text Reader

Abstract

The application provides a kind of application configuration management method.The technical scheme of the application develops an application configuration management platform based on Jekins and Kubernetes, using the management platform can automatically, efficiently, real-time centrally modify application configuration and automatically update configmap, thereby efficiently managing many application configurations required for Kubernetes container operation, high accuracy, can also record the history of application configuration modification so that the process of configuration modification can be traced back, reduce labor cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Kubernetes, and in particular to an application configuration management method based on Jenkins and Kubernetes. Background Art

[0002] Kubernetes containers have been widely used in microservice architecture systems. Container operation requires application configuration, which is primarily loaded into Kubernetes containers in the form of configmaps. Initially, technical personnel in this field wrote configmaps in a single YAML file. However, because each microservice requires different application configurations, technical personnel in this field had to maintain multiple configmap YAML files based on the number of microservices. As the number of microservices in a company increases, maintaining so many YAML files becomes increasingly difficult and error-prone, resulting in high labor costs and low efficiency. Summary of the Invention

[0003] In order to overcome the above technical deficiencies, the present invention aims to provide an application configuration management method, comprising: Step S1: deploying an application configuration management platform, including steps S1.1 to S1.4:

[0004] Step S1.1: Deploy a Kubernetes cluster and provide a database;

[0005] Step S1.2: Download the customized Jenkins image and start Jenkins using a device capable of executing kubectl commands.

[0006] Step S1.3: Create a job in Jenkins and write the pipeline script;

[0007] Step S1.4: Start the application configuration management platform in the form of a Kubernetes pod. Once the pod runs successfully, the deployment of the application configuration management platform is complete.

[0008] Step S2: using the application configuration management platform to modify an application configuration in yaml format;

[0009] Step S3: The application configuration management platform detects and determines in real time that the application configuration has been modified, automatically converts the modified application configuration in YAML format into an updated application configuration in JSON format, and transmits the updated application configuration in JSON format to Jenkins;

[0010] Step S4: After Jenkins receives the updated application configuration in json format, the script configured by the pipeline parses the updated application configuration in json format into a yaml file of configmap, and saves the yaml file to the server;

[0011] Step S5: Jenkinsjob executes the kubectl command to point to the yaml file saved in the server to update the configmap in the Kubernetes container;

[0012] Step S6: Restart the Kubernetes container to take effect of the updated application configuration.

[0013] Further, in step S1.1, the database is a MySQL database.

[0014] Further, in step S5, Jenkinsjob directly executes the kubectl command to point to the yaml file to update the configmap.

[0015] After adopting the above technical solution, compared with the prior art, the following beneficial effects are obtained:

[0016] 1. No need to manage numerous yaml files of configmap, automatically update the configmap of kubernetes after modification in the configuration management platform;

[0017] 2. Configuration management is centralized, all configuration items are in one place, and the configuration needed to be modified can be located directly by searching in the browser;

[0018] The technical solution of the present application develops an operation and maintenance platform based on Jenkins and Kubernetes, and the application configuration management method of the present application can automatically, efficiently and in real time centrally modify the application configuration and automatically update the configmap, thereby efficiently managing the numerous application configurations required for the running of the Kubernetes container, having high accuracy, and being able to record the history of the modification of the application configuration so that the process of the configuration modification can be traced back, and the labor cost is reduced. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 The flowchart of the application configuration management method of the present application;

[0020] Figure 2 The composition structure of the application configuration management platform of the present application and the connection relationship principle diagram therebetween;

[0021] Figure 3 The flowchart of the method for deploying the application configuration management platform. DETAILED DESCRIPTION

[0022] The advantages of the present application are further set forth in the description that follows, and will be appreciated by those skilled in the art upon reading and understanding the following detailed description.

[0023] Reference will now be made in detail to the embodiments of the present application, one or more examples of which are illustrated in the drawings. The following description is presented in the context of the accompanying drawings, in which the same or similar reference signs represent the same or similar elements, unless otherwise indicated. The embodiments described in the following examples do not represent all of the implementations consistent with the present disclosure. Instead, they are merely examples consistent with some aspects of the present disclosure as detailed in the appended claims.

[0024] The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the present disclosure. As used in the present disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0025] As used in this document, the term "includes" and its variations mean "including but not limited to," unless the context clearly indicates otherwise. As used in this document, the term "if" can be construed to mean "when" or "in response to determining" or it can be construed to mean "if and when" or "if and in response to determining." As used in this document, the term "application" means a computer program or software module, or a set of computer programs or software modules.

[0026] In the description of the present application, unless otherwise specified and limited, it needs to be explained that the terms "mounting", "connection", "connecting" should be understood in a broad sense, for example, can be mechanical or electrical connection, can be the internal communication of two elements, can be direct connection, or indirect connection through intermediate medium, and the specific meaning of the above terms can be understood according to the specific circumstances for those skilled in the art.

[0027] As shown in FIG. 1, according to an embodiment of the present application, the application configuration management method mainly includes two stages: 1. Building an application configuration management platform, i.e. step S1; 2. Using the built management platform to manage application configuration in real time, i.e. steps S2-S6. Figure 1

[0028] I. Building the application configuration management platform of the present application

[0029] As shown in FIG. 1, according to an embodiment of the present application, the application configuration management method mainly includes two stages: 1. Building an application configuration management platform, i.e. step S1; 2. Using the built management platform to manage application configuration in real time, i.e. steps S2-S6. Figure 2 As shown in FIG. 1, the application configuration management platform based on Kubernetes and Jenkins includes a configuration management program, Jenkins, and Kubernetes.​

[0030] When the configuration management program is executed by the processor, the management method of the application configuration of the present application can be implemented.

[0031] The programming language of the configuration management program may be an object-oriented programming language, such as Smalltalk, C++, etc.; or a conventional procedural programming language, such as "C" language or similar programming languages.

[0032] Specifically, if Figure 3 As shown, deploying the application configuration management platform (step S1) includes the following steps S1.1 to S1.4:

[0033] Step S1.1: Deploy a Kubernetes cluster and provide a MySQL database. The steps for deploying a Kubernetes cluster in this application are not special and can be performed using conventional procedures in the field.

[0034] Step S1.2: Download the customized Jenkins image and start Jenkins using a device capable of executing kubectl commands.

[0035] The Dockerfile for the jenkins image is as follows:

[0036]

[0037]

[0038] Step S1.3: Create a job in Jenkins and write a pipeline script. The script content is as follows:

[0039]

[0040]

[0041]

[0042] Step S1.4: Start the application configuration management platform in the form of Kubernetes pod. After the above pod runs successfully, the deployment of the application configuration management platform is completed.

[0043] 2. Use the built management platform to manage application configuration in real time

[0044] Specifically, if Figure 1 As shown, the method for real-time management of application configuration using the established management platform specifically includes steps S2 to S6:

[0045] Step S2: modifying certain application configuration in yaml format using the application configuration management platform;

[0046] Step S3: the application configuration management platform detects and judges that application configuration is modified in real time, and automatically converts the modified application configuration in yaml format into updated application configuration in json format, and transmits the updated application configuration in json format to Jenkins;

[0047] Step S4: after Jenkins receives the updated application configuration in json format, the updated application configuration in json format is parsed into a yaml file of configmap according to the script of pipeline configuration, and the yaml file is saved to the server;

[0048] Step S5: Jenkinsjob executes kubectl command by SSH to the remote device to point to the yaml file saved in the server to update the configmap in the Kubernetes container;

[0049] Step S6: restarting the Kubernetes container to take effect on the updated application configuration.

[0050] It should be noted that the embodiments of the present application have better implementation, and do not limit the present application in any form, any skilled person in the art can change or modify the equivalent effective embodiments by using the above disclosed technical content, as long as it does not deviate from the content of the technical scheme of the present application, any modification or equivalent change and modification of the above embodiments according to the technical essence of the present application, still belongs to the scope of the technical scheme of the present application.

Claims

1. A method for managing application configuration, characterized in that: The application comprises the following steps: Step S1: deploying an application configuration management platform, comprising steps S1.1-S1.4: Step S1.1: deploying a set of Kubernetes clusters and providing a database; Step S1.2: downloading a customized jenkins image and starting Jenkins through a device capable of executing kubectl commands; Step S1.3: creating a job in Jenkins and writing a pipeline script; Step S1.4: starting the application configuration management platform in the form of a Kubernetes Pod, and completing the deployment of the application configuration management platform after the pod runs successfully; Step S2: modifying a certain application configuration in yaml format using the application configuration management platform; Step S3: the application configuration management platform detects and judges in real time that an application configuration has been modified, automatically converts the modified application configuration in yaml format into an updated application configuration in json format, and transmits the updated application configuration in json format to Jenkins; Step S4: after receiving the updated application configuration in json format, Jenkins parses the updated application configuration in json format into a yaml file of configmap according to the pipeline configured script, and saves the yaml file to the Kubernetes server; Step S5: Jenkins job executes a kubectl command to point to the yaml file saved in the server to update the configmap in the Kubernetes container; Step S6: restarting the Kubernetes container to take effect on the updated application configuration; In step S1.1, the database is a MySQL database; In step S5, Jenkins job executes a kubectl command to point to the yaml file to update the configmap through SSH to a remote device.

Citation Information

Patent Citations

  • Kubernetes container platform application updating method

    CN109947452A

  • Micro-service deployment method for realizing DevOps based on Jenkins

    CN111309441A