One-key service deployment method and device based on K8S and jenkins, equipment and medium

By using Kubernetes and Jenkins to deploy services with a single click, service deployment and monitoring are automated, solving the problems of complex and error-prone operations in SaaS business systems, improving deployment efficiency and server stability, and reducing the probability of misoperation.

CN118733067AInactive Publication Date: 2024-10-01INSPUR ZHUOSHU BIG DATA IND DEV CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410896621.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In SaaS business systems, the service deployment process is characterized by complex operations, high error rates, frequent manual server operations, and slow monitoring and alarm responses. This results in high frequency of operations by implementation personnel, a high probability of misoperation, and impacts server stability and security.

Method used

The method of one-click deployment of services using K8S and Jenkins is adopted. The Jenkins service and scheduler automate the packaging, uploading, image building and deployment, reducing the frequency of implementation personnel directly operating the server. The automation features of K8S cluster and Jenkins are used to achieve visual deployment, and log files are stored and returned for traceability.

Benefits of technology

It improves deployment efficiency, reduces the probability of misoperation, ensures server stability and security, simplifies operation procedures, and lowers the entry barrier for implementation personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733067A_ABST
    Figure CN118733067A_ABST
Patent Text Reader

Abstract

The invention discloses a one-key service deployment method, device and equipment based on K8S and jenkins and a medium, belongs to the technical field of computer software installation and deployment, and aims to solve the technical problems of how to reduce the number and frequency of directly operating servers by implementation personnel, reduce the probability of misoperation and ensure the stability and safety of the servers. According to the technical scheme, the method comprises the following steps: selecting a proper server to install a K8S cluster according to a deployment architecture diagram, and marking a main server of the K8S cluster as a server A; uploading a jenkins service and a configuration file required by the jenkins service, wherein the jenkins service and the configuration file are combined with the git to carry out a packaging and uploading process; compiling an upload scheduling program and related scripts and endowing the related scripts with the permission to execute local files; constructing a jenkins service used in the deployment process according to the configuration file, setting a trigger script, and starting a K8S service; the method comprises the following steps: triggering a script scheduling program, and transmitting parameters required for constructing a service mirror image to the scheduling program; and starting the scheduling program on the server A according to the scheduling program and the related script.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer software installation and deployment, and specifically to a method, device, equipment and medium for one-click deployment service based on K8S and Jenkins. Background Art

[0002] The business system based on SaaS can meet the customer's requirements for the use of the application system, while also reducing the customer's operation and maintenance costs. Using K8S to operate and maintain the SaaS business system integrates load balancing, service monitoring, failure restart and other daily tedious tasks and automates them, greatly improving the operation and maintenance efficiency. However, manual processes such as packaging images, pushing images, updating k8s configuration files and applying them are also necessary when deploying new services or updating old services. When services need to be updated frequently, manually performing these tasks will become very tedious and prone to errors.

[0003] For these workflows, in the SaaS business system, it is particularly appropriate to use Jenkins as the automation platform for system packaging and uploading, and to use a scheduler for scheduling. The scheduler provides an interface for deploying new K8S services and updating K8S services. The intermediate information generated by the automation process is stored in the database.

[0004] In the process of setting up an automated deployment environment, the installation of Jenkins is an essential step. K8S is a portable container orchestration management tool that allows users to easily build and deploy application services and realize automated operation and maintenance.

[0005] In the process of deploying application system services, not only are the components very independent, but with the popularity of microservice architecture, the correlation between services is getting lower and lower. The service deployment process is relatively independent and does not affect each other. Although the business coupling is not as high as before, it puts higher requirements on the implementation personnel. The implementation personnel need to deploy twice as many business services and middleware. Since most system services are deployed on servers with Linux operating systems without graphical interfaces, the implementation personnel need to log in to the server through ssh and use commands to confirm whether the service has been deployed and the running status of the service.

[0006] In summary, the following problems exist in the current service deployment:

[0007] ①Deploying and updating application services or application service clusters under the Linux operating system requires implementation personnel to have relatively more complex operations than under the Windows operating system with graphical operations. Traditional deployment methods require a large number of command line operations.

[0008] ② When the business system to be deployed requires multiple servers, it needs to be deployed and installed one by one, which is prone to operational omissions or errors.

[0009] ③ During the deployment of the business system, the service status needs to be additionally monitored. When a monitoring alarm occurs, it is necessary to manually log in to the server to solve the problem, which is slow and cumbersome.

[0010] Therefore, how to reduce the number and frequency of direct server operations by implementation personnel, reduce the probability of misoperation, and ensure the stability and security of the server is a technical problem that needs to be solved urgently. Summary of the invention

[0011] The technical task of the present invention is to provide a method, device, equipment and medium for one-click deployment of services based on K8S and Jenkins to solve the problem of how to reduce the number and frequency of implementation personnel directly operating the server, reduce the probability of misoperation, and ensure the stability and security of the server.

[0012] The technical task of the present invention is achieved in the following way: a method for one-click deployment of services based on K8S and Jenkins, the method is as follows:

[0013] According to the deployment architecture diagram, select a suitable server to install the K8S cluster, and mark the main server of the K8S cluster as Server A;

[0014] Upload the Jenkins service and the configuration files required by the Jenkins service, which are used to combine with git for the packaging and uploading process;

[0015] Write an upload scheduler and related scripts and grant the scripts the permission to execute local files;

[0016] Build the Jenkins service used in the deployment process according to the configuration file, set the trigger script, and start the K8S service;

[0017] By triggering the script scheduler and transmitting the parameters required to build the service image to the scheduler;

[0018] According to the scheduler and related scripts, start the scheduler on server A;

[0019] After git uploads the new version of the service, the Jenkins service discovers it and automatically packages it and uploads it to the corresponding directory of Server A, and submits the service parameters to the scheduler;

[0020] The scheduler calls the parameters required to build the service image, triggers the image building and pushes the image function;

[0021] After the image push function is completed, the calling program is triggered to complete the update deployment of the K8S service.

[0022] Preferably, the scheduler and its corresponding related scripts are used to implement the following two functions:

[0023] ①After the jenkins service completes uploading the new service package, it automatically generates the yaml file of the K8S service based on the obtained parameters and applies it for execution;

[0024] ②During daily service updates, according to the package uploaded by the Jenkins service, Docker builds the image and pushes the image to the harbor warehouse.

[0025] Preferably, when writing the upload scheduler, the parameters are encrypted and parsed to ensure the security and confidentiality of the deployment process.

[0026] As a preferred option, deploy the K8S cluster and Jenkins service on the server, and use the automated deployment and automated operation and maintenance features of the K8S cluster and Jenkins service to achieve visual and rapid deployment.

[0027] Preferably, the implementation personnel view the deployment progress and the deployment process log file through the status log returned by the deployment process scheduler;

[0028] Give the scheduler permission to execute shell scripts and trigger execution through the interface provided by the Jenkins service;

[0029] The deployment process log is returned to the implementation personnel through the network for review or stored in the server as a file for deployment record tracing.

[0030] Preferably, the server where the scheduler is installed and the file modification on the server where the scheduler is installed can also push the image to the harbor warehouse server;

[0031] The server that installs the scheduler calls the K8S command to update and deploy the service;

[0032] Specify the print log path on the server where the scheduler is installed, and file changes under the print log path will be returned to the implementation personnel in real time.

[0033] A device for one-click deployment service based on K8S and Jenkins, the device comprising:

[0034] The selection and marking module is used to select a suitable server to install the K8S cluster according to the deployment architecture diagram, and mark the main server of the K8S cluster as server A;

[0035] The upload module is used to upload the Jenkins service and the configuration files required by the Jenkins service, and is used to combine with git to perform the packaging and uploading process;

[0036] Write a module to write the upload scheduler and related scripts and grant the related scripts the permission to execute local files;

[0037] The setup module is used to build the Jenkins service used in the deployment process according to the configuration file, set the trigger script, and start the K8S cluster service;

[0038] The build module is used to trigger the script scheduler and transmit the parameters required to build the service image to the scheduler;

[0039] A startup module is used to start the scheduler on server A according to the scheduler and related scripts;

[0040] The packaging module is used to upload the new version of the service to git, and then the Jenkins service will discover it, automatically package it and upload it to the corresponding directory of server A, and submit the service parameters to the scheduler;

[0041] The calling module is used to schedule the program to call the parameters required to build the service image, trigger the image building and push the image function;

[0042] The trigger module is used to trigger the calling program after the image push function is completed to complete the update deployment of the K8S service.

[0043] Preferably, the working process of the device is as follows:

[0044] (1) The implementation personnel provide git service to upload the new version of code to Jenkins;

[0045] (2) The Jenkins service discovers and automatically packages and uploads the parameters to the server where the scheduler is installed, and calls the scheduler;

[0046] (3) The scheduler builds and pushes the image to habor, and returns the log of the deployment process for implementation personnel to review;

[0047] (4) The scheduler modifies the service yaml file and applies it to the K8S cluster;

[0048] (5) The K8S cluster returns the service startup log to the scheduler;

[0049] (6) The scheduler returns service-related logs for implementation personnel to review.

[0050] An electronic device comprising: a memory and at least one processor;

[0051] Wherein, the memory stores a computer program;

[0052] The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the method for one-click deployment service based on K8S and Jenkins as described above.

[0053] A computer-readable storage medium stores a computer program, which can be executed by a processor to implement the method of one-click deployment service based on K8S and Jenkins as mentioned above.

[0054] The method, device, equipment and medium of the present invention based on K8S and Jenkins one-click deployment service have the following advantages:

[0055] (1) The present invention improves the efficiency of software service installation and deployment, which will be increased by several times;

[0056] (ii) The present invention reduces the number and frequency of direct server operations by implementation personnel, reduces the probability of misoperation, and ensures the stability and security of the server;

[0057] (III) The present invention aggregates log files of the software service deployment process and stores them in the form of files to facilitate problem tracing;

[0058] (iv) The present invention returns the deployment progress of the non-graphical interface operating system to the implementer in a clear and concise manner;

[0059] (V) The interactive commands of the present invention are simple under the graphical interface operating system, which is easy to learn and operate, thus lowering the entry threshold for implementation personnel. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The present invention is further described below in conjunction with the accompanying drawings.

[0061] Attached Figure 1 This is a schematic diagram of the working process of the device based on K8S and Jenkins one-click deployment service. DETAILED DESCRIPTION

[0062] The method, device, equipment and medium for one-click deployment service based on K8S and Jenkins of the present invention are described in detail below with reference to the drawings and specific embodiments of the specification.

[0063] Embodiment 1:

[0064] This embodiment provides a method for one-click deployment of services based on K8S and Jenkins. The method is as follows:

[0065] S1. According to the deployment architecture diagram, select a suitable server to install the K8S cluster, and mark the main server of the K8S cluster as server A;

[0066] S2. Upload the Jenkins service and the configuration files required by the Jenkins service, which are used to combine with git for the packaging and uploading process;

[0067] S3. Write an upload scheduler and related scripts and grant the scripts the permission to execute local files.

[0068] S4. Build the Jenkins service used in the deployment process according to the configuration file, set the trigger script, and start the K8S service;

[0069] S5, triggering the script scheduler and transmitting the parameters required to build the service image to the scheduler;

[0070] S6. Start the scheduler on server A according to the scheduler and related scripts;

[0071] S7. After git uploads the new version of the service, the Jenkins service discovers it and automatically packages it and uploads it to the corresponding directory of Server A, and submits the service parameters to the scheduler;

[0072] S8, the scheduler calls the parameters required to build the service image, triggers the image building and pushes the image function;

[0073] S9. After the image push function is completed, the calling program is triggered to complete the update deployment of the K8S service.

[0074] The scheduling program and its corresponding related scripts in this embodiment are used to implement the following two functions:

[0075] ①After the jenkins service completes uploading the new service package, it automatically generates the yaml file of the K8S service based on the obtained parameters and applies it for execution;

[0076] ②During daily service updates, according to the package uploaded by the Jenkins service, Docker builds the image and pushes the image to the harbor warehouse.

[0077] In this embodiment, when writing the upload scheduling program, the parameters are encrypted and parsed to ensure the security and confidentiality of the deployment process.

[0078] In this embodiment, a K8S cluster and a Jenkins service are deployed on the server, and visual rapid deployment is achieved by utilizing the automated deployment and automated operation and maintenance features of the K8S cluster and the Jenkins service.

[0079] In this embodiment, the implementation personnel view the deployment progress and the deployment process log file through the status log returned by the deployment process scheduler.

[0080] In this embodiment, the scheduler is given permission to execute shell scripts, and the execution is triggered through the interface provided by the Jenkins service.

[0081] In this embodiment, the deployment process log is returned to the implementation personnel through the network for review or stored in the server in the form of a file for deployment record tracing.

[0082] In this embodiment, the server where the scheduling program is installed and the file modification on the server where the scheduling program is installed can also push the image to the harbor warehouse server.

[0083] In this embodiment, the server on which the scheduler is installed calls the K8S command to update and deploy the service.

[0084] In this embodiment, a print log path is specified on the server where the scheduler is installed, and file changes under the print log path are returned to the implementer in real time.

[0085] Embodiment 2:

[0086] This embodiment provides a device for one-click deployment service based on K8S and Jenkins, and the device includes:

[0087] The selection and marking module is used to select a suitable server to install the K8S cluster according to the deployment architecture diagram, and mark the main server of the K8S cluster as server A;

[0088] The upload module is used to upload the Jenkins service and the configuration files required by the Jenkins service, and is used to combine with git to perform the packaging and uploading process;

[0089] Write a module to write the upload scheduler and related scripts and grant the related scripts the permission to execute local files;

[0090] The setup module is used to build the Jenkins service used in the deployment process according to the configuration file, set the trigger script, and start the K8S cluster service;

[0091] The build module is used to trigger the script scheduler and transmit the parameters required to build the service image to the scheduler;

[0092] A startup module is used to start the scheduler on server A according to the scheduler and related scripts;

[0093] The packaging module is used to upload the new version of the service to git, and then the Jenkins service will discover it, automatically package it and upload it to the corresponding directory of server A, and submit the service parameters to the scheduler;

[0094] The calling module is used to schedule the program to call the parameters required to build the service image, trigger the image building and push the image function;

[0095] The trigger module is used to trigger the calling program after the image push function is completed to complete the update deployment of the K8S service.

[0096] As attached Figure 1 As shown, the working process of the device is as follows:

[0097] (1) The implementation personnel provide git service to upload the new version of code to Jenkins;

[0098] (2) The Jenkins service discovers and automatically packages and uploads the parameters to the server where the scheduler is installed, and calls the scheduler;

[0099] (3) The scheduler builds and pushes the image to habor, and returns the log of the deployment process for implementation personnel to review;

[0100] (4) The scheduler modifies the service yaml file and applies it to the K8S cluster;

[0101] (5) The K8S cluster returns the service startup log to the scheduler;

[0102] (6) The scheduler returns service-related logs for implementation personnel to review.

[0103] Embodiment 3:

[0104] This embodiment also provides an electronic device, including: a memory and at least one processor;

[0105] Wherein, the memory stores computer-executable instructions;

[0106] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method for one-click deployment service based on K8S and Jenkins in any embodiment of the present invention.

[0107] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.

[0108] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state storage devices.

[0109] Embodiment 4:

[0110] This embodiment also provides a computer-readable storage medium, which stores multiple instructions, which are loaded by a processor to enable the processor to execute the method for one-click deployment of services based on K8S and Jenkins in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which software program codes that implement the functions of any of the above embodiments are stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.

[0111] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0112] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0113] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0114] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for one-click deployment of services based on K8S and Jenkins. It is characterized in that The method is as follows: According to the deployment architecture diagram, select a suitable server to install the K8S cluster, and mark the main server of the K8S cluster as Server A; Upload the Jenkins service and the configuration files required by the Jenkins service, which are used to combine with git for the packaging and uploading process; Write an upload scheduler and related scripts and grant the scripts the permission to execute local files; Build the Jenkins service used in the deployment process according to the configuration file, set the trigger script, and start the K8S service; By triggering the script scheduler and transmitting the parameters required to build the service image to the scheduler; According to the scheduler and related scripts, start the scheduler on server A; After git uploads the new version of the service, the Jenkins service discovers it and automatically packages it and uploads it to the corresponding directory of Server A, and submits the service parameters to the scheduler; The scheduler calls the parameters required to build the service image, triggers the image building and pushes the image function; After the image push function is completed, the calling program is triggered to complete the update deployment of the K8S service.

2. According to the method for one-click deployment service based on K8S and Jenkins according to claim 1, It is characterized in that The scheduler and its corresponding scripts are used to implement the following two functions: ①After the jenkins service completes uploading the new service package, it automatically generates the yaml file of the K8S service based on the obtained parameters and applies it for execution; ②During daily service updates, according to the package uploaded by the Jenkins service, Docker builds the image and pushes the image to the harbor warehouse.

3. According to the method for one-click deployment service based on K8S and Jenkins according to claim 1, It is characterized in that When writing the upload scheduler, the parameters are encrypted and parsed to ensure the security and confidentiality of the deployment process.

4. According to claim 1, the method for one-click deployment service based on K8S and Jenkins, It is characterized in that Deploy K8S cluster and Jenkins service on the server, and use the automated deployment and automated operation and maintenance features of K8S cluster and Jenkins service to achieve visual and rapid deployment.

5. According to claim 1, the method for one-click deployment service based on K8S and Jenkins, It is characterized in that The implementation personnel can check the deployment progress and deployment process log files through the status log returned by the deployment process scheduler; Give the scheduler permission to execute shell scripts and trigger execution through the interface provided by the Jenkins service; The deployment process log is returned to the implementation personnel through the network for review or stored in the server as a file for deployment record tracing.

6. The method for one-click deployment service based on K8S and Jenkins according to any one of claims 1-5, It is characterized in that The server where the scheduler is installed and the file modification on the server where the scheduler is installed can also push the image to the harbor warehouse server; The server that installs the scheduler calls the K8S command to update and deploy the service; Specify the print log path on the server where the scheduler is installed, and file changes under the print log path will be returned to the implementation personnel in real time.

7. A device for one-click deployment of services based on K8S and Jenkins, It is characterized in that The device includes: The selection and marking module is used to select a suitable server to install the K8S cluster according to the deployment architecture diagram, and mark the main server of the K8S cluster as server A; The upload module is used to upload the Jenkins service and the configuration files required by the Jenkins service, and is used to combine with git to perform the packaging and uploading process; Write a module to write the upload scheduler and related scripts and grant the related scripts the permission to execute local files; The setup module is used to build the Jenkins service used in the deployment process according to the configuration file, set the trigger script, and start the K8S cluster service; The build module is used to trigger the script scheduler and transmit the parameters required to build the service image to the scheduler; A startup module is used to start the scheduler on server A according to the scheduler and related scripts; The packaging module is used to upload the new version of the service to git, and then the Jenkins service will discover it, automatically package it and upload it to the corresponding directory of server A, and submit the service parameters to the scheduler; The calling module is used to schedule the program to call the parameters required to build the service image, trigger the image building and push the image function; The trigger module is used to trigger the calling program after the image push function is completed to complete the update deployment of the K8S service.

8. The device for one-click deployment service based on K8S and Jenkins according to claim 7, It is characterized in that The working process of the device is as follows: (1) The implementation personnel provide git service to upload the new version of code to Jenkins; (2) The Jenkins service discovers and automatically packages and uploads the parameters to the server where the scheduler is installed, and calls the scheduler; (3) The scheduler builds and pushes the image to habor, and returns the log of the deployment process for implementation personnel to review; (4) The scheduler modifies the service yaml file and applies it to the K8S cluster; (5) The K8S cluster returns the service startup log to the scheduler; (6) The scheduler returns service-related logs for implementation personnel to review.

9. An electronic device, It is characterized in that include: memory and at least one processor; Wherein, the memory stores a computer program; The at least one processor executes the computer program stored in the memory, so that the at least one processor executes the method for one-click deployment service based on K8S and Jenkins as described in any one of claims 1 to 6.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which can be executed by a processor to implement the method for one-click deployment service based on K8S and Jenkins as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Mirror image management method, system and equipment for Kubernetes container in acceleration format

    CN117707703A