Kubernetes cluster deployment method and device

By automatically executing environment initialization and deployment scripts, the problem of inefficient deployment of Kubernetes clusters in the existing technology is solved, and automated deployment is realized, which simplifies the process and improves efficiency.

CN114691153BActive Publication Date: 2025-05-06QI AN XIN TECHNOLOGY GROUP INC +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210325304.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-30
Publication Date
2025-05-06
Estimated Expiration
2042-03-30

AI Technical Summary

Technical Problem

When deploying Kubernetes clusters, existing technologies require manual tedious operations, such as installing kubelets and configuring the network, resulting in low deployment efficiency.

Method used

Provides a deployment method and device for Kubernetes clusters, and automatically executes environment initialization and deployment scripts by receiving offline deployment compressed packages and cluster configuration files to realize the automatic deployment of Kubernetes services.

Benefits of technology

No need for manual tedious operations, significantly improving the deployment efficiency of Kubernetes clusters and simplifying the deployment process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691153B_ABST
    Figure CN114691153B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for deploying a Kubernetes cluster, and relates to the technical field of cluster deployment. The method of the present application includes: receiving an offline deployment compressed package, and decompressing the offline deployment compressed package, wherein the offline deployment compressed package contains an environment initialization script, a first deployment script, and a preset deployment tool; receiving a cluster configuration file, wherein the cluster configuration file contains Kubernetes service configuration information corresponding to the deployment server node and Kubernetes service configuration information corresponding to each other server node; executing the environment initialization script, so as to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file; executing the first deployment script, so as to deploy the Kubernetes service on the deployment server node and deploy the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cluster deployment technology, and in particular to a Kubernetes cluster deployment method and device. Background Art

[0002] With the development and widespread popularity of Docker container technology, more and more applications are deployed using Docker containers. In order to make application deployment more convenient, container orchestration technologies represented by Kubernetes have developed rapidly. In a Kubernetes cluster built based on Kubernetes technology, we can create multiple containers and deploy corresponding deployment resources in each container.

[0003] Currently, Kubernetes clusters are usually deployed through Kubernetes deployment tools. However, before using Kubernetes deployment tools to deploy Kubernetes clusters, staff are required to manually perform a series of tedious operations such as installing kubelet and configuring the network, which makes the efficiency of deploying Kubernetes clusters low. Summary of the invention

[0004] The embodiments of the present application provide a method and device for deploying a Kubernetes cluster, the main purpose of which is to improve the efficiency of deploying a Kubernetes cluster.

[0005] In order to solve the above technical problems, the embodiments of the present application provide the following technical solutions:

[0006] In a first aspect, the present application provides a Kubernetes cluster deployment method, the method being applied to a deployment server node in a target server cluster, the target server cluster also including multiple other server nodes, the method comprising:

[0007] Receiving an offline deployment compressed package and decompressing the offline deployment compressed package, wherein the offline deployment compressed package includes an environment initialization script, a first deployment script, and a preset deployment tool;

[0008] Receive a cluster configuration file, wherein the cluster configuration file includes Kubernetes service configuration information corresponding to the deployment server node and Kubernetes service configuration information corresponding to each of the other server nodes;

[0009] Executing the environment initialization script to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file;

[0010] The first deployment script is executed to deploy the Kubernetes service on the deployment server node and to deploy the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file.

[0011] Optionally, the offline deployment compressed package further includes a Docker image repository and an offline resource library, the Docker image repository includes multiple Docker images, and the offline resource library includes multiple Rpm packages; executing the environment initialization script to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file includes:

[0012] Execute the environment initialization script to perform password-free processing on each of the other server nodes; install the Docker image repository and the offline resource library into the local storage space of the deployment server node; based on the cluster configuration file, the Docker image repository and the offline resource library, install multiple Rpm packages into the local storage space of each of the other server nodes, and install multiple Docker images corresponding to each of the other server nodes into the local storage space of each of the other server nodes; close the firewall of the deployment server node and the firewall of each of the other server nodes.

[0013] Optionally, executing the first deployment script to deploy the Kubernetes service on the deployment server node and deploying the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file includes:

[0014] Execute the first deployment script to run the preset deployment tool, and control the preset deployment tool to deploy the Kubernetes service on the deployment server node according to the cluster configuration file, the Docker image repository and the offline resource library, and deploy the Kubernetes service on each of the other server nodes according to the cluster configuration file, the multiple Docker images and the multiple Rpm packages installed in the local storage space of each of the other server nodes.

[0015] Optionally, the preset deployment tool is an RKE deployment tool with a Cephadm deployment tool embedded in it, the offline deployment compressed package further includes a second deployment script, a ceph-csi-rbd plug-in and a helm tool, and the cluster configuration file further includes Ceph service configuration information corresponding to the deployment server node and Ceph service configuration information corresponding to each of the other server nodes; the method further includes:

[0016] Execute the second deployment script to run the preset deployment tool and control the preset deployment tool to deploy the Ceph service on the deployment server node according to the cluster configuration file, and deploy the Ceph service on each of the other server nodes; run the helm tool and control the helm tool to deploy the ceph-csi-rbd plug-in on the deployment server node, and deploy the ceph-csi-rbd plug-in on each of the other server nodes.

[0017] In a second aspect, the present application further provides a Kubernetes cluster deployment device, the device is applied to a deployment server node in a target server cluster, the target server cluster also includes multiple other server nodes, the device includes:

[0018] A processing unit, configured to receive an offline deployment compressed package and decompress the offline deployment compressed package, wherein the offline deployment compressed package includes an environment initialization script, a first deployment script, and a preset deployment tool;

[0019] A receiving unit, configured to receive a cluster configuration file, wherein the cluster configuration file includes Kubernetes service configuration information corresponding to the deployment server node and Kubernetes service configuration information corresponding to each of the other server nodes;

[0020] A first execution unit, configured to execute the environment initialization script so as to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file;

[0021] The second execution unit is used to execute the first deployment script so as to deploy the Kubernetes service on the deployment server node and deploy the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file.

[0022] Optionally, the offline deployment compressed package further includes a Docker image repository and an offline resource library, the Docker image repository includes multiple Docker images, and the offline resource library includes multiple Rpm packages;

[0023] The first execution unit is specifically used to execute the environment initialization script so as to perform password-free processing on each of the other server nodes; install the Docker image repository and the offline resource library into the local storage space of the deployment server node; based on the cluster configuration file, the Docker image repository and the offline resource library, install multiple Rpm packages into the local storage space of each of the other server nodes, and install multiple Docker images corresponding to each of the other server nodes into the local storage space of each of the other server nodes; close the firewall of the deployment server node and the firewall of each of the other server nodes.

[0024] Optionally, the second execution unit is specifically used to execute the first deployment script so as to run the preset deployment tool, and control the preset deployment tool to deploy the Kubernetes service on the deployment server node according to the cluster configuration file, the Docker image repository and the offline resource library, and to deploy the Kubernetes service on each of the other server nodes according to the cluster configuration file, the multiple Docker images and the multiple Rpm packages installed in the local storage space of each of the other server nodes.

[0025] Optionally, the preset deployment tool is an RKE deployment tool with a Cephadm deployment tool embedded therein, the offline deployment compression package further includes a second deployment script, a ceph-csi-rbd plug-in and a helm tool, the cluster configuration file further includes Ceph service configuration information corresponding to the deployment server node and Ceph service configuration information corresponding to each of the other server nodes; the device further includes:

[0026] The third execution unit is used to execute the second deployment script to run the preset deployment tool, and control the preset deployment tool to deploy the Ceph service on the deployment server node according to the cluster configuration file, and deploy the Ceph service on each of the other server nodes; run the helm tool, and control the helm tool to deploy the ceph-csi-rbd plug-in on the deployment server node, and deploy the ceph-csi-rbd plug-in on each of the other server nodes.

[0027] In a third aspect, an embodiment of the present application provides a storage medium, wherein the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the Kubernetes cluster deployment method described in the first aspect.

[0028] In a fourth aspect, an embodiment of the present application provides a deployment device for a Kubernetes cluster, the device comprising a storage medium; and one or more processors, the storage medium being coupled to the processor, the processor being configured to execute program instructions stored in the storage medium; when the program instructions are executed, the deployment method for the Kubernetes cluster described in the first aspect is executed.

[0029] By means of the above technical solution, the technical solution provided by this application has at least the following advantages:

[0030] The present application provides a method and device for deploying a Kubernetes cluster. The present application can decompress the offline deployment compressed package after the deployment server node receives the offline deployment compressed package input by the staff, thereby obtaining the environment initialization script, the first deployment script and the preset deployment tool, and after receiving the cluster configuration file corresponding to the target server cluster input by the staff, first execute the environment initialization script so that the environment initialization script controls the deployment server node to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file, so that the deployment server node and each other server node meet the conditions for deploying the Kubernetes service, and then execute the first deployment script so that the first deployment script controls the deployment server node to deploy the Kubernetes service on the deployment server node based on the preset deployment tool and the cluster configuration file, and respectively deploy the Kubernetes service on each other server node, thereby realizing the deployment of the target server cluster as a Kubernetes cluster. Because, in the present application, after the staff inputs the offline deployment compressed package and the cluster configuration file corresponding to the target server cluster into the deployment server node, the deployment server node can automatically deploy the Kubernetes service on the deployment server node and each other server node, so there is no need for the staff to manually perform a series of cumbersome operations such as installing kubelet and configuring the network, thereby effectively improving the efficiency of deploying the Kubernetes cluster.

[0031] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0033] Figure 1 A flow chart of a Kubernetes cluster deployment method provided in an embodiment of the present application is shown;

[0034] Figure 2 A flow chart of another Kubernetes cluster deployment method provided in an embodiment of the present application is shown;

[0035] Figure 3 A block diagram of a Kubernetes cluster deployment device provided in an embodiment of the present application is shown;

[0036] Figure 4 A block diagram of another Kubernetes cluster deployment device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0037] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0038] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.

[0039] The present application embodiment provides a Kubernetes cluster deployment method, which is applied to a deployment server node in a target server cluster. Figure 1 As shown, the method includes:

[0040] 101. Receive an offline deployment compressed package and decompress the offline deployment compressed package.

[0041] The offline deployment compressed package includes an environment initialization script, a first deployment script, and a preset deployment tool.

[0042] In the embodiment of the present application, the executor in each step is a deployment server node in the target server cluster. The deployment server node can be any server node in the target server cluster. The target server cluster also includes multiple other server nodes.

[0043] In an embodiment of the present application, the staff needs to pre-write an environment initialization script and a first deployment script, prepare a preset deployment tool, and compress the environment initialization script, the first deployment script, and the preset deployment tool to obtain an offline deployment compressed package; when it is necessary to deploy a Kubernetes service for each server node in the target server cluster, the staff needs to input the offline deployment compressed package into the deployment server node, at which time the deployment server node can receive the offline deployment compressed package; after receiving the offline deployment compressed package, the deployment server node can decompress the offline deployment compressed package to obtain the environment initialization script, the first deployment script, and the preset deployment tool.

[0044] 102. Receive a cluster configuration file.

[0045] The cluster configuration file contains the Kubernetes service configuration information corresponding to the deployment server node and the Kubernetes service configuration information corresponding to each other server node.

[0046] In an embodiment of the present application, after the staff inputs the offline deployment compressed package into the deployment server node, they also need to edit the cluster configuration file corresponding to the target server cluster according to business needs, and input the cluster configuration file corresponding to the target server cluster into the deployment server node. At this time, the deployment server node can receive the cluster configuration file corresponding to the target server cluster.

[0047] 103. Execute the environment initialization script to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file.

[0048] The role of the environment initialization script is to control the deployment server node to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file.

[0049] In an embodiment of the present application, after receiving the cluster configuration file corresponding to the target server cluster, the deployment server node can execute the environment initialization script, so that the environment initialization script controls the deployment server node to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file, so that the deployment server node and each other server node meet the conditions for deploying the Kubernetes service.

[0050] 104. Execute a first deployment script to deploy the Kubernetes service on the deployment server node and on each other server node based on a preset deployment tool and a cluster configuration file.

[0051] The first deployment script is used to control the deployment server node to deploy the Kubernetes service on the deployment server node based on the preset deployment tool and the cluster configuration file, and to deploy the Kubernetes service on each other server node respectively.

[0052] In an embodiment of the present application, after the deployment server node performs environment initialization processing on the deployment server node and each other server node based on the cluster configuration file, the first deployment script can be executed so that the first deployment script controls the deployment server node to deploy the Kubernetes service on the deployment server node based on the preset deployment tool and the cluster configuration file, and to deploy the Kubernetes service on each other server node respectively, thereby realizing the deployment of the target server cluster as a Kubernetes cluster.

[0053] The embodiment of the present application provides a method for deploying a Kubernetes cluster. The embodiment of the present application can decompress the offline deployment compressed package after the deployment server node receives the offline deployment compressed package input by the staff, thereby obtaining the environment initialization script, the first deployment script and the preset deployment tool, and after receiving the cluster configuration file corresponding to the target server cluster input by the staff, first execute the environment initialization script so that the environment initialization script controls the deployment server node to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file, so that the deployment server node and each other server node meet the conditions for deploying the Kubernetes service, and then execute the first deployment script so that the first deployment script controls the deployment server node to deploy the Kubernetes service on the deployment server node based on the preset deployment tool and the cluster configuration file, and respectively deploy the Kubernetes service on each other server node, thereby realizing the deployment of the target server cluster as a Kubernetes cluster. Because, in the embodiment of the present application, after the staff inputs the offline deployment compressed package and the cluster configuration file corresponding to the target server cluster into the deployment server node, the deployment server node can automatically deploy the Kubernetes service on the deployment server node and each other server node, so that there is no need for the staff to manually perform a series of cumbersome operations such as installing kubelet and configuring the network, thereby effectively improving the efficiency of deploying the Kubernetes cluster.

[0054] To explain in more detail below, the present application embodiment provides another Kubernetes cluster deployment method, which is applied to the deployment server node in the target server cluster, as shown in the following example: Figure 2 As shown, the method includes:

[0055] 201. Receive an offline deployment compressed package and decompress the offline deployment compressed package.

[0056] The offline deployment compressed package includes an environment initialization script, a first deployment script, a preset deployment tool, a Docker image repository, an offline resource library, a second deployment script, a ceph-csi-rbd plug-in, and a helm tool.

[0057] Among them, the preset deployment tool is an RKE deployment tool with a built-in Cephadm deployment tool; among them, the Docker image repository contains multiple Docker images, and the offline resource library contains multiple Rpm packages.

[0058] In an embodiment of the present application, the staff needs to pre-write an environment initialization script, a first deployment script, and a second deployment script, and prepare a preset deployment tool, a Docker image repository, an offline resource library, a ceph-csi-rbd plug-in, and a helm tool, and compress the environment initialization script, the first deployment script, the second deployment script, the preset deployment tool, the Docker image repository, the offline resource library, the ceph-csi-rbd plug-in, and the helm tool to obtain an offline deployment compressed package; when it is necessary to deploy Kubernetes services and Ceph services for each server node in the target server cluster, the staff needs to input the offline deployment compressed package into the deployment server node, at which point the deployment server node can receive the offline deployment compressed package; after receiving the offline deployment compressed package, the deployment server node can decompress the offline deployment compressed package to obtain the environment initialization script, the first deployment script, the preset deployment tool, the Docker image repository, the offline resource library, the second deployment script, the ceph-csi-rbd plug-in, and the helm tool.

[0059] 202. Receive a cluster configuration file.

[0060] Among them, the cluster configuration file contains Kubernetes service configuration information corresponding to the deployment server node, Kubernetes service configuration information corresponding to each other server node, Ceph service configuration information corresponding to the deployment server node, and Ceph service configuration information corresponding to each other server node.

[0061] In an embodiment of the present application, after the staff inputs the offline deployment compressed package into the deployment server node, they also need to edit the cluster configuration file corresponding to the target server cluster according to business needs, and input the cluster configuration file corresponding to the target server cluster into the deployment server node. At this time, the deployment server node can receive the cluster configuration file corresponding to the target server cluster.

[0062] 203. Execute the environment initialization script to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file.

[0063] In an embodiment of the present application, after receiving the cluster configuration file corresponding to the target server cluster, the deployment server node can execute the environment initialization script, so that the environment initialization script controls the deployment server node to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file, so that the deployment server node and each other server node meet the conditions for deploying the Kubernetes service.

[0064] Specifically, in this step, the deployment server node executes the environment initialization script so that the environment initialization script controls the deployment server node to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file. The specific process is:

[0065] Among them, the Kubernetes service configuration information corresponding to each other server node contained in the cluster configuration file records the Docker image information corresponding to each other server node; wherein, the Docker image information corresponding to any other server node can be but is not limited to: the unique identifier corresponding to the Docker image required by the other server node.

[0066] Execute the environment initialization script so that the initialization script controls the deployment server node to perform the following operations:

[0067] (1) Perform confidentiality-free processing on each other server node so that the deployment server node can access each other server node without confidentiality;

[0068] (2) Install the Docker image repository and offline resource library into the local storage space of the deployment server node;

[0069] (3) Based on the cluster configuration file, the Docker image repository and the offline resource library, multiple Rpm packages are installed into the local storage space of each other server node, and multiple Docker images corresponding to each other server node are installed into the local storage space of each other server node, that is, firstly, multiple Docker images corresponding to each other server node are obtained from the Docker image repository according to the Docker image information corresponding to each other server node, and then, the multiple Docker images corresponding to each other server node are installed into the local storage space of each other server node according to the Docker image information corresponding to each other server node, and after obtaining multiple Rpm packages from the offline resource library, the multiple Rpm packages are respectively installed into the local storage space of each other server node;

[0070] (4) Turn off the firewall of the deployment server node and the firewall of each other server node to prevent the firewall of the deployment server node and the firewall of each other server node from affecting the deployment of Kubernetes services on the deployment server node.

[0071] 204. Execute a first deployment script to deploy the Kubernetes service on the deployment server node and on each other server node based on a preset deployment tool and a cluster configuration file.

[0072] In an embodiment of the present application, after the deployment server node performs environmental initialization processing on the deployment server node and each other server node, the deployment server node can execute the first deployment script, so that the first deployment script controls the deployment server node to deploy the Kubernetes service on the deployment server node based on the preset deployment tool and the cluster configuration file, and deploys the Kubernetes service on each other server node respectively, thereby realizing the deployment of the target server cluster as a Kubernetes cluster.

[0073] Specifically, in this step, the deployment server node executes the first deployment script so that the first deployment script controls the deployment server node to deploy the Kubernetes service on the deployment server node based on the preset deployment tool and the cluster configuration file, and the specific process of deploying the Kubernetes service on each other server node is as follows:

[0074] Among them, the Kubernetes service configuration information corresponding to the deployment server node contained in the cluster configuration file records the Docker image information corresponding to the deployment server node. The Docker image information corresponding to the deployment server node can be but is not limited to: the unique identifier corresponding to the Docker image required by the deployment server node.

[0075] Execute the first deployment script so that the first deployment script controls the deployment server node to perform the following operations:

[0076] Run the preset deployment tool, and control the preset deployment tool to deploy the Kubernetes service on the deployment server node according to the cluster configuration file, the Docker image repository and the offline resource library, and deploy the Kubernetes service on each other server node according to the cluster configuration file, the multiple Docker images and the multiple Rpm packages installed in the local storage space of each other server node; that is, after running the preset deployment tool, first control the preset deployment tool to obtain the multiple Docker images corresponding to the deployment server node in the Docker image repository and the multiple Rpm packages in the offline resource library according to the Docker image information corresponding to the deployment server node, and deploy the Kubernetes service on the deployment server node according to the Kubernetes service configuration information corresponding to the deployment server node, the Docker image corresponding to the deployment server node and the multiple Rpm packages, and then control the preset deployment tool to deploy the Kubernetes service on each other server node according to the Kubernetes service configuration information corresponding to each other server node, the multiple Docker images and the multiple Rpm packages installed in the local storage space of each other server node.

[0077] 205. Execute the second deployment script to deploy the Ceph service on the deployment server node and on each other server node based on the preset deployment tool and the cluster configuration file; deploy the ceph-csi-rbd plug-in on the deployment server node and on each other server node based on the helm tool.

[0078] In an embodiment of the present application, after the deployment server node deploys the Kubernetes service on the deployment server node and deploys the Kubernetes service on each other server node respectively, the second deployment script can be executed so that the second deployment script controls the deployment server node to perform the following operations: (1) run the preset deployment tool and control the preset deployment tool to deploy the Ceph service on the deployment server node according to the cluster configuration file (i.e., the Ceph service configuration information corresponding to the deployment server node), and control the preset deployment tool to deploy the Ceph service on each other server node according to the cluster configuration file (i.e., the Ceph service configuration information corresponding to each other server node), thereby realizing the deployment of the target server cluster as a Ceph cluster; (2) run the helm tool and control the helm tool to deploy the ceph-csi-rbd plug-in on the deployment server node, and control the helm tool to deploy the ceph-csi-rbd plug-in on each other server node.

[0079] Among them, the Kubernetes service deployed on any server node can use the Ceph service for data storage through the ceph-csi-rbd plug-in; any server node can also directly use the Ceph service for data storage.

[0080] It should be noted that in the actual application process, the staff can write a third deployment script that contains the entire content of the first deployment script and the entire content of the second deployment script, and compress the environment initialization script, the third deployment script, the preset deployment tool, the Docker image repository, the offline resource library, the ceph-csi-rbd plug-in and the helm tool to obtain an offline deployment compression package; after the deployment server node executes the operations described in steps 201-203, thereby realizing the environment initialization processing of the deployment server node and each other server node, the third deployment script can be executed, so that the third deployment script controls the deployment server node to first deploy Kubernetes services on the deployment server node based on the preset deployment tool and the cluster configuration file and deploy Kubernetes services on each other server node, and then deploy Ceph services on the deployment server node based on the preset deployment tool and the cluster configuration file and deploy Ceph services on each other server node, and finally, deploy the ceph-csi-rbd plug-in on the deployment server node based on the helm tool and deploy the ceph-csi-rbd plug-in on each other server node.

[0081] In order to achieve the above-mentioned purpose, according to another aspect of the present application, an embodiment of the present application further provides a storage medium, wherein the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the above-mentioned Kubernetes cluster deployment method.

[0082] In order to achieve the above-mentioned purpose, according to another aspect of the present application, an embodiment of the present application further provides a deployment device for a Kubernetes cluster, the device comprising a storage medium; and one or more processors, the storage medium is coupled to the processor, and the processor is configured to execute program instructions stored in the storage medium; when the program instructions are executed, the above-mentioned Kubernetes cluster deployment method is executed.

[0083] Furthermore, as a response to the above Figure 1 and Figure 2 In addition to the implementation of the method shown in the figure, another embodiment of the present application also provides a Kubernetes cluster deployment device, which is applied to the deployment server node in the target server cluster. This device embodiment corresponds to the aforementioned method embodiment. For ease of reading, this device embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the aforementioned method embodiment. This device is used to improve the efficiency of deploying Kubernetes clusters, specifically as follows Figure 3 As shown, the device comprises:

[0084] The processing unit 31 is used to receive an offline deployment compressed package and decompress the offline deployment compressed package, wherein the offline deployment compressed package includes an environment initialization script, a first deployment script and a preset deployment tool;

[0085] A receiving unit 32 is used to receive a cluster configuration file, wherein the cluster configuration file includes Kubernetes service configuration information corresponding to the deployment server node and Kubernetes service configuration information corresponding to each of the other server nodes;

[0086] A first execution unit 33 is used to execute the environment initialization script so as to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file;

[0087] The second execution unit 34 is used to execute the first deployment script so as to deploy the Kubernetes service on the deployment server node and deploy the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file.

[0088] Further, such as Figure 4 As shown, the offline deployment compressed package also includes a Docker image repository and an offline resource library, the Docker image repository includes multiple Docker images, and the offline resource library includes multiple Rpm packages;

[0089] The first execution unit 33 is specifically used to execute the environment initialization script so as to perform password-free processing on each of the other server nodes; install the Docker image repository and the offline resource library into the local storage space of the deployment server node; based on the cluster configuration file, the Docker image repository and the offline resource library, install multiple Rpm packages into the local storage space of each of the other server nodes, and install multiple Docker images corresponding to each of the other server nodes into the local storage space of each of the other server nodes; close the firewall of the deployment server node and the firewall of each of the other server nodes.

[0090] Further, such as Figure 4 As shown, the second execution unit 34 is specifically used to execute the first deployment script so as to run the preset deployment tool, and control the preset deployment tool to deploy the Kubernetes service on the deployment server node according to the cluster configuration file, the Docker image repository and the offline resource library, and to deploy the Kubernetes service on each of the other server nodes according to the cluster configuration file, the multiple Docker images and the multiple Rpm packages installed in the local storage space of each of the other server nodes.

[0091] Further, such as Figure 4 As shown, the preset deployment tool is an RKE deployment tool with a Cephadm deployment tool embedded in it, the offline deployment compression package also includes a second deployment script, a ceph-csi-rbd plug-in and a helm tool, and the cluster configuration file also includes the Ceph service configuration information corresponding to the deployment server node and the Ceph service configuration information corresponding to each of the other server nodes; the device also includes:

[0092] The third execution unit 35 is used to execute the second deployment script so as to run the preset deployment tool and control the preset deployment tool to deploy the Ceph service on the deployment server node according to the cluster configuration file, and to deploy the Ceph service on each of the other server nodes; run the helm tool and control the helm tool to deploy the ceph-csi-rbd plug-in on the deployment server node, and to deploy the ceph-csi-rbd plug-in on each of the other server nodes.

[0093] The embodiment of the present application provides a deployment method and device for a Kubernetes cluster. The embodiment of the present application can decompress the offline deployment compressed package after the deployment server node receives the offline deployment compressed package input by the staff, thereby obtaining an environment initialization script, a first deployment script and a preset deployment tool, and after receiving the cluster configuration file corresponding to the target server cluster input by the staff, first execute the environment initialization script so that the environment initialization script controls the deployment server node to perform environment initialization processing on the deployment server node and each other server node based on the cluster configuration file, so that the deployment server node and each other server node meet the conditions for deploying the Kubernetes service, and then execute the first deployment script so that the first deployment script controls the deployment server node to deploy the Kubernetes service on the deployment server node based on the preset deployment tool and the cluster configuration file, and respectively deploy the Kubernetes service on each other server node, thereby realizing the deployment of the target server cluster as a Kubernetes cluster. Because, in an embodiment of the present application, after the staff inputs the offline deployment compression package and the cluster configuration file corresponding to the target server cluster into the deployment server node, the deployment server node can automatically deploy the Kubernetes service on the deployment server node and each other server node. Therefore, there is no need for the staff to manually perform a series of tedious operations such as installing kubelet and configuring the network, thereby effectively improving the efficiency of deploying the Kubernetes cluster.

[0094] The deployment device of the Kubernetes cluster includes a processor and a memory. The above-mentioned processing unit, receiving unit, first execution unit, second execution unit, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.

[0095] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the efficiency of deploying Kubernetes clusters can be improved by adjusting kernel parameters.

[0096] An embodiment of the present application provides a storage medium, which includes a stored program, wherein when the program is running, a device where the storage medium is located is controlled to execute the above-mentioned Kubernetes cluster deployment method.

[0097] The storage medium may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.

[0098] An embodiment of the present application also provides a Kubernetes cluster deployment device, which includes a storage medium; and one or more processors, wherein the storage medium is coupled to the processor, and the processor is configured to execute program instructions stored in the storage medium; when the program instructions are executed, the above-mentioned Kubernetes cluster deployment method is executed.

[0099] The embodiment of the present application provides a device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented:

[0100] Receiving an offline deployment compressed package and decompressing the offline deployment compressed package, wherein the offline deployment compressed package includes an environment initialization script, a first deployment script, and a preset deployment tool;

[0101] Receive a cluster configuration file, wherein the cluster configuration file includes Kubernetes service configuration information corresponding to the deployment server node and Kubernetes service configuration information corresponding to each other server node;

[0102] Executing the environment initialization script to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file;

[0103] The first deployment script is executed to deploy the Kubernetes service on the deployment server node and to deploy the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file.

[0104] Furthermore, the offline deployment compressed package further includes a Docker image repository and an offline resource library, the Docker image repository includes multiple Docker images, and the offline resource library includes multiple Rpm packages; the execution of the environment initialization script to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file includes:

[0105] Execute the environment initialization script to perform password-free processing on each of the other server nodes; install the Docker image repository and the offline resource library into the local storage space of the deployment server node; based on the cluster configuration file, the Docker image repository and the offline resource library, install multiple Rpm packages into the local storage space of each of the other server nodes, and install multiple Docker images corresponding to each of the other server nodes into the local storage space of each of the other server nodes; close the firewall of the deployment server node and the firewall of each of the other server nodes.

[0106] Further, executing the first deployment script to deploy the Kubernetes service on the deployment server node and deploying the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file includes:

[0107] Execute the first deployment script to run the preset deployment tool, and control the preset deployment tool to deploy the Kubernetes service on the deployment server node according to the cluster configuration file, the Docker image repository and the offline resource library, and deploy the Kubernetes service on each of the other server nodes according to the cluster configuration file, the multiple Docker images and the multiple Rpm packages installed in the local storage space of each of the other server nodes.

[0108] Further, the preset deployment tool is an RKE deployment tool with a built-in Cephadm deployment tool, the offline deployment compression package also includes a second deployment script, a ceph-csi-rbd plug-in and a helm tool, and the cluster configuration file also includes Ceph service configuration information corresponding to the deployment server node and Ceph service configuration information corresponding to each of the other server nodes; the method also includes:

[0109] Execute the second deployment script to run the preset deployment tool and control the preset deployment tool to deploy the Ceph service on the deployment server node according to the cluster configuration file, and deploy the Ceph service on each of the other server nodes; run the helm tool and control the helm tool to deploy the ceph-csi-rbd plug-in on the deployment server node, and deploy the ceph-csi-rbd plug-in on each of the other server nodes.

[0110] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing program code that has the following method steps for initialization: receiving an offline deployment compressed package and decompressing the offline deployment compressed package, wherein the offline deployment compressed package includes an environment initialization script, a first deployment script and a preset deployment tool; receiving a cluster configuration file, wherein the cluster configuration file includes Kubernetes service configuration information corresponding to the deployment server node and Kubernetes service configuration information corresponding to each other server node; executing the environment initialization script to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file; executing the first deployment script to deploy the Kubernetes service on the deployment server node and deploy the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file.

[0111] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0112] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0113] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0114] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0115] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0116] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0117] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0118] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0119] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0120] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for deploying a Kubernetes cluster, characterized in that: The method is applied to a deployment server node in a target server cluster, wherein the target server cluster also includes a plurality of other server nodes, and the method includes: Receiving an offline deployment compressed package and decompressing the offline deployment compressed package, wherein the offline deployment compressed package includes an environment initialization script, a first deployment script, and a preset deployment tool; Receive a cluster configuration file, wherein the cluster configuration file includes Kubernetes service configuration information corresponding to the deployment server node and Kubernetes service configuration information corresponding to each of the other server nodes; Executing the environment initialization script to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file; Execute the first deployment script to deploy the Kubernetes service on the deployment server node and deploy the Kubernetes service on each of the other server nodes based on the preset deployment tool and the cluster configuration file; The offline deployment compressed package further includes a Docker image repository and an offline resource library, wherein the Docker image repository includes multiple Docker images, and the offline resource library includes multiple Rpm packages; the executing the environment initialization script to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file includes: Execute the environment initialization script to perform password-free processing on each of the other server nodes; install the Docker image repository and the offline resource library into the local storage space of the deployment server node; based on the cluster configuration file, the Docker image repository and the offline resource library, install multiple Rpm packages into the local storage space of each of the other server nodes, and install multiple Docker images corresponding to each of the other server nodes into the local storage space of each of the other server nodes; close the firewall of the deployment server node and the firewall of each of the other server nodes; The Kubernetes service configuration information corresponding to each other server node contained in the cluster configuration file records the Docker image information corresponding to each other server node; based on the cluster configuration file, the Docker image repository and the offline resource library, the multiple Rpm packages are installed into the local storage space of each other server node, and the multiple Docker images corresponding to each other server node are installed into the local storage space of each other server node, including: obtaining the multiple Docker images corresponding to each other server node in the Docker image repository according to the Docker image information corresponding to each other server node; installing the multiple Docker images corresponding to each other server node into the local storage space of each other server node according to the Docker image information corresponding to each other server node; after obtaining the multiple Rpm packages in the offline resource library, the multiple Rpm packages are respectively installed into the local storage space of each other server node.

2. The method according to claim 1, characterized in that The executing the first deployment script to deploy the Kubernetes service on the deployment server node and on each of the other server nodes based on the preset deployment tool and the cluster configuration file includes: Execute the first deployment script to run the preset deployment tool, and control the preset deployment tool to deploy the Kubernetes service on the deployment server node according to the cluster configuration file, the Docker image repository and the offline resource library, and deploy the Kubernetes service on each of the other server nodes according to the cluster configuration file, the multiple Docker images and the multiple Rpm packages installed in the local storage space of each of the other server nodes.

3. The method according to claim 1 or 2, characterized in that: The preset deployment tool is an RKE deployment tool with a built-in Cephadm deployment tool, the offline deployment compressed package also includes a second deployment script, a ceph-csi-rbd plug-in and a helm tool, and the cluster configuration file also includes Ceph service configuration information corresponding to the deployment server node and Ceph service configuration information corresponding to each of the other server nodes; the method also includes: Execute the second deployment script to run the preset deployment tool and control the preset deployment tool to deploy the Ceph service on the deployment server node according to the cluster configuration file, and deploy the Ceph service on each of the other server nodes; run the helm tool and control the helm tool to deploy the ceph-csi-rbd plug-in on the deployment server node, and deploy the ceph-csi-rbd plug-in on each of the other server nodes.

4. A Kubernetes cluster deployment device, characterized in that: The device is applied to a deployment server node in a target server cluster, and the target server cluster also includes multiple other server nodes. The device includes: A processing unit, configured to receive an offline deployment compressed package and decompress the offline deployment compressed package, wherein the offline deployment compressed package includes an environment initialization script, a first deployment script, and a preset deployment tool; A receiving unit, configured to receive a cluster configuration file, wherein the cluster configuration file includes Kubernetes service configuration information corresponding to the deployment server node and Kubernetes service configuration information corresponding to each of the other server nodes; A first execution unit, configured to execute the environment initialization script so as to perform environment initialization processing on the deployment server node and each of the other server nodes based on the cluster configuration file; A second execution unit, configured to execute the first deployment script so as to deploy the Kubernetes service on the deployment server node and on each of the other server nodes based on the preset deployment tool and the cluster configuration file; The offline deployment compressed package also includes a Docker image repository and an offline resource library, wherein the Docker image repository includes multiple Docker images, and the offline resource library includes multiple Rpm packages; The first execution unit is specifically used to execute the environment initialization script so as to perform password-free processing on each of the other server nodes; install the Docker image repository and the offline resource library into the local storage space of the deployment server node; based on the cluster configuration file, the Docker image repository and the offline resource library, install multiple Rpm packages into the local storage space of each of the other server nodes, and install multiple Docker images corresponding to each of the other server nodes into the local storage space of each of the other server nodes; close the firewall of the deployment server node and the firewall of each of the other server nodes; The Kubernetes service configuration information corresponding to each other server node contained in the cluster configuration file records the Docker image information corresponding to each other server node; the first execution unit is specifically used to obtain multiple Docker images corresponding to each other server node in the Docker image warehouse according to the Docker image information corresponding to each other server node; according to the Docker image information corresponding to each other server node, the multiple Docker images corresponding to each other server node are installed into the local storage space of each other server node; after obtaining multiple Rpm packages in the offline resource library, the multiple Rpm packages are respectively installed into the local storage space of each other server node.

5. The device according to claim 4, characterized in that The second execution unit is specifically used to execute the first deployment script so as to run the preset deployment tool, and control the preset deployment tool to deploy the Kubernetes service on the deployment server node according to the cluster configuration file, the Docker image repository and the offline resource library, and to deploy the Kubernetes service on each of the other server nodes according to the cluster configuration file, the multiple Docker images and the multiple Rpm packages installed in the local storage space of each of the other server nodes.

6. The device according to claim 4 or 5, characterized in that The preset deployment tool is an RKE deployment tool with a built-in Cephadm deployment tool, the offline deployment compressed package also includes a second deployment script, a ceph-csi-rbd plug-in and a helm tool, and the cluster configuration file also includes Ceph service configuration information corresponding to the deployment server node and Ceph service configuration information corresponding to each of the other server nodes; the device also includes: The third execution unit is used to execute the second deployment script to run the preset deployment tool, and control the preset deployment tool to deploy the Ceph service on the deployment server node according to the cluster configuration file, and deploy the Ceph service on each of the other server nodes; run the helm tool, and control the helm tool to deploy the ceph-csi-rbd plug-in on the deployment server node, and deploy the ceph-csi-rbd plug-in on each of the other server nodes.

7. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the Kubernetes cluster deployment method described in any one of claims 1 to 3.

8. A Kubernetes cluster deployment device, characterized in that: The device includes a storage medium; and one or more processors, the storage medium is coupled to the processor, and the processor is configured to execute program instructions stored in the storage medium; when the program instructions are executed, the deployment method of the Kubernetes cluster described in any one of claims 1 to 3 is executed.

Citation Information

Patent Citations

  • Cluster deployment method and device, terminal equipment and storage medium

    CN111782232A

  • Docker technology-based software product deployment method and system

    CN112181587A