A method, device, equipment and storage medium for off-line deployment of a K8S cluster

CN115857955BActive Publication Date: 2026-08-21PURPLE MOUNTAIN LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211475931.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-23
Publication Date
2026-08-21
Estimated Expiration
2042-11-23

AI Technical Summary

Technical Problem

[0003]有鉴于此,本发明的目的在于提供一种离线部署K8S集群的方法、装置、设备及存储介质,解决了现有技术中部署K8S效率较低的技术问题

Benefits of technology

[0034]可见,本发明通过获取离线安装脚本信息;其中,所述离线安装脚本信息包括部署安装包和集群压缩包镜像;根据Terraform和预定义配置信息创建Openstack资源,得到返回的资源配置文件;获取预定义镜像仓库项目,并根据所述离线安装脚本信息、所述资源配置文件和所述预定义镜像仓库项目部署K8S集群。本发明以Kubespray的terraform,产生资源配置文件。与集群压缩包镜像相融合,进而将Kubespray可以离线生成集群的优势与集群压缩包镜像可以快速安装K8S集群的优势相结合,只要输入预定义配置信息就可以实现K8S集群的部署。和现有技术需要通过手动方式按照安装文件一步一步部署K8S集群相比,本发明提供的离线部署K8S集群的方法可以调用离线安装脚本信息实现K8S集群的一键式部署,即安装人员只需要输入预定义配置信息就可以实现K8S集群的一键式部署,极大地提高了K8S集群的部署效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115857955B_ABST
    Figure CN115857955B_ABST
Patent Text Reader

Abstract

The application discloses a kind of method, device, equipment and readable storage medium of deployment K8S cluster, applied to computer technology field, including obtaining offline installation script information;Wherein, offline installation script information includes deployment installation package and cluster compressed package image;According to Terraform and pre-defined configuration information, create Openstack resource, obtain the resource configuration file returned;Pre-defined image warehouse item is obtained, and according to offline installation script information, resource configuration file and pre-defined image warehouse item deployment K8S cluster.The application is with the terraform of Kubespray, produces resource configuration file.Combined with cluster compressed package image, the advantage that Kubespray can be offline generation cluster is combined with the advantage that cluster compressed package image can quickly install K8S cluster, and as long as pre-defined configuration information is input, one-key deployment of K8S cluster can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for offline deployment of a K8S cluster. Background Technology

[0002] In current technologies, Kubernetes (K8S) clusters are typically deployed manually. For example, using the Breeze open-source tool (a graphical deployment tool for Kubernetes), installers run the tool on a machine with Breeze installed via a graphical interface and follow the steps in the official documentation within a browser. However, when installers interact with the machine running Breeze through the graphical interface, omissions or errors can occur, leading to low deployment efficiency for the Kubernetes cluster. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a method, apparatus, device and storage medium for offline deployment of K8S clusters, which solves the technical problem of low efficiency in deploying K8S in the prior art.

[0004] To address the aforementioned technical problems, this invention provides a method for offline deployment of a Kubernetes cluster, comprising:

[0005] Obtain offline installation script information; wherein, the offline installation script information includes deployment installation packages and cluster compressed package images;

[0006] Create OpenStack resources based on Terraform and predefined configuration information, and obtain the returned resource configuration files;

[0007] Obtain a predefined image repository project and deploy a K8S cluster based on the offline installation script information, the resource configuration file, and the predefined image repository project.

[0008] Optionally, before obtaining the predefined image repository project, the following steps are also included:

[0009] Based on the cluster compressed image, a system configuration file is generated using the system configuration template;

[0010] A mirror repository is generated based on the deployment installation package and the system configuration file;

[0011] Generate image repository files using the image repository template;

[0012] The predefined image repository project is created based on the image repository and the image repository file.

[0013] Optionally, after creating the OpenStack resource based on Terraform and predefined configuration information and obtaining the returned resource configuration file, the method further includes:

[0014] The resource configuration file, the deployment installation package, and the cluster compressed image are sent to the jump server to execute the deployment of the K8S cluster.

[0015] Optionally, after obtaining the predefined image repository project and deploying the K8S cluster based on the offline installation script information, the resource configuration file, and the predefined image repository project, the method further includes:

[0016] Use automated operation and maintenance tools to obtain the configuration file corresponding to the K8S cluster.

[0017] Optionally, the method for offline deployment of a Kubernetes cluster further includes:

[0018] The real-time logs generated during the deployment of the K8S cluster are displayed through remote procedure calls.

[0019] Optionally, the method for offline deployment of a Kubernetes cluster further includes:

[0020] Monitor the deployment progress of the K8S cluster and return a message indicating successful deployment.

[0021] The present invention also provides an apparatus for offline deployment of a Kubernetes cluster, comprising:

[0022] An offline installation script information acquisition module is used to acquire offline installation script information; wherein, the offline installation script information includes deployment installation packages and cluster compressed package images;

[0023] The resource configuration file acquisition module is used to create OpenStack resources based on Terraform and predefined configuration information, and obtain the returned resource configuration file.

[0024] The K8S cluster deployment module is used to obtain predefined image repository projects and deploy K8S clusters according to the offline installation script information, the resource configuration files, and the predefined image repository projects.

[0025] Optionally, the device for offline deployment of the Kubernetes cluster further includes:

[0026] The system configuration file generation module is used to generate a system configuration file based on the cluster compressed package image using a system configuration template.

[0027] The image repository generation module is used to generate an image repository based on the deployment installation package and the system configuration file;

[0028] The image repository file generation module is used to generate image repository files using image repository templates;

[0029] The predefined image repository project creation module is used to create the predefined image repository project based on the image repository and the image repository file.

[0030] The present invention also provides a device for offline deployment of a Kubernetes cluster, comprising:

[0031] Memory, used to store computer programs;

[0032] A processor for executing the computer program to implement the steps of the above-described method for offline deployment of a K8S cluster.

[0033] The present invention also provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the above-described method for offline deployment of a K8S cluster.

[0034] As can be seen, this invention obtains offline installation script information, which includes a deployment installation package and a cluster compressed image. It creates OpenStack resources based on Terraform and predefined configuration information, obtaining the returned resource configuration file. It then obtains a predefined image repository project and deploys a Kubernetes cluster based on the offline installation script information, the resource configuration file, and the predefined image repository project. This invention uses Kubespray's Terraform to generate resource configuration files. This is integrated with the cluster compressed image, combining Kubespray's advantage of offline cluster generation with the advantage of rapid Kubernetes cluster installation from the cluster compressed image. Kubernetes cluster deployment can be achieved simply by inputting predefined configuration information. Compared to existing technologies that require manual step-by-step deployment of Kubernetes clusters according to installation files, this invention provides an offline Kubernetes cluster deployment method that can call offline installation script information to achieve one-click deployment. Installers only need to input predefined configuration information to achieve one-click deployment, greatly improving the deployment efficiency of Kubernetes clusters.

[0035] In addition, the present invention also provides an apparatus, device and readable storage medium for offline deployment of K8S clusters, which also have the above-mentioned beneficial effects. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0037] Figure 1 A flowchart illustrating a method for offline deployment of a Kubernetes cluster, as provided in an embodiment of the present invention;

[0038] Figure 2 A flowchart illustrating a method for offline deployment of a K8S cluster provided in an embodiment of the present invention;

[0039] Figure 3 A schematic diagram of a device for offline deployment of a K8S cluster provided in an embodiment of the present invention;

[0040] Figure 4 This is a schematic diagram of the structure of a device for offline deployment of a K8S cluster provided in an embodiment of the present invention. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0042] Please refer to Figure 1 , Figure 1 A flowchart illustrating a method for offline deployment of a Kubernetes cluster, as provided in an embodiment of the present invention. The method may include:

[0043] S100, obtain offline installation script information; the offline installation script information includes deployment installation packages and cluster compressed package images.

[0044] The execution subject in this embodiment is a terminal. This embodiment does not limit the type of terminal, as long as it can perform the file transfer resume operation after power failure. For example, it can be a general-purpose terminal or a dedicated terminal. The offline script information in this embodiment includes a deployment installation package (a binary installation package generated by kubekey) and a cluster compressed image (a tar archive image packaged from the kubesphere source cluster). The deployment installation package Kubekey in this embodiment provides a fast and efficient method for installing a Kubesphere (container management platform) cluster.

[0045] S101 creates OpenStack resources based on Terraform and predefined configuration information, and obtains the returned resource configuration file.

[0046] This embodiment uses Terraform (an orchestration tool for securely and efficiently building, modifying, and version-controlling infrastructure) related files from Kubespray (Kubespray is an open-source project from Google for deploying production-grade Kubernetes server clusters, integrating Ansible as a deployment tool) to create OpenStack resources according to predefined configuration information. Once the OpenStack resources are created, the resource configuration file is returned. OpenStack in this embodiment is an open-source cloud computing management platform project, a combination of a series of open-source software projects. OpenStack provides scalable and elastic cloud computing services for both private and public clouds. The project goal is to provide a simple-to-implement, scalable, rich, and standardized cloud computing management platform. OpenStack is a cloud platform management project, not a single piece of software. This project consists of several main components that perform specific tasks. OpenStack is an open-source project designed to provide software for the construction and management of public and private clouds. This embodiment does not limit the specific content of the predefined configuration information; any user-defined configuration information obtained is acceptable. For example, the configuration information may include IP address (Internet Protocol address), route name, private repository, and authentication information; or it may include pod (a pod is the smallest deployment unit in a Kubernetes system), authentication information, image information, and private repository. This embodiment does not limit the specific name of the resource configuration file. For example, the resource configuration file (tfstate file) may be named nginx-deployment.yaml; or the resource configuration file may be named nginx-service.yaml.

[0047] S102: Obtain the predefined image repository project and deploy the K8S cluster based on the offline installation script information, resource configuration files, and the predefined image repository project.

[0048] This embodiment does not limit the specific way the predefined image repository project is formed, as long as it is a predefined image repository project generated based on an image repository template. For example, a predefined image repository project can be generated based on an image repository template from Docker Hub (Docker Hub is used for source code management integration and also for build and testing tools to accelerate deployment cycles, reducing deployment cycles from days to minutes); or, a predefined image repository project can be generated based on an image repository template from GitHub (GitHub is a hosting platform for open source and private software projects, as it only supports Git as the sole version control format for hosting).

[0049] Furthermore, to quickly obtain a predefined image repository project, the process before obtaining the predefined image repository project may also include:

[0050] Generate a system configuration file using a system configuration template based on the cluster compressed image;

[0051] Generate an image repository based on the deployment installation package and system configuration files;

[0052] Generate image repository files using the image repository template;

[0053] The predefined image repository project is created based on the image repository and the image repository file.

[0054] This embodiment generates a system configuration file (config-sample.yaml file) from the cluster compressed image (kubesphere.tar.gz) using a system configuration template (config-sample.yaml.j2 template); generates an image repository based on the deployment package (the binary installation package generated by kubekey) and the system configuration file; generates an image repository file using the image repository template; and creates the predefined image repository project based on the image repository and the image repository file (create_project_harbor.sh file). This embodiment can directly generate a predefined image repository project using the cluster compressed image, system configuration template, and deployment package, eliminating the need for users to obtain a predefined image repository project according to the operation manual.

[0055] Furthermore, in order to deploy a Kubernetes cluster based on resource configuration files, deployment packages, and cluster compressed image images, after creating OpenStack resources based on Terraform and predefined configuration information and obtaining the returned resource configuration files, the following can also be included:

[0056] Send the resource configuration files, deployment packages, and cluster compressed image to the jump server to execute the deployment of the Kubernetes cluster.

[0057] This embodiment copies resource configuration files, deployment packages, and cluster compressed image images to a jump server to perform the deployment of a Kubernetes cluster. This embodiment does not limit the specific type or installation location of the jump server. For example, the jump server could be Puppet (a centralized configuration management system for Linux / Unix platforms, using its own Puppet description language); or it could be SaltStack (a centralized server infrastructure management platform with configuration management, remote execution, and monitoring functions); or it could be Ansible (an open-source automation platform and configuration management tool); or it could be Bastion (a container used for management). This embodiment does not limit the specific installation location of the jump server. The jump server can be installed on this terminal or on another terminal.

[0058] Furthermore, to configure the relevant parameters of the Kubernetes cluster, after obtaining the predefined image repository project and deploying the Kubernetes cluster based on the offline installation script information, resource configuration files, and the predefined image repository project, the following may also be included:

[0059] Use automated operation and maintenance tools to obtain the configuration files corresponding to the K8S cluster.

[0060] This embodiment does not limit the specific type of automated operation and maintenance tool, as long as it can obtain the configuration file corresponding to the Kubernetes cluster and modify the parameters. For example, the automated operation and maintenance tool could be Puppet (a centralized configuration management system for Linux / Unix platforms); or it could be Saltstack (an automated infrastructure management tool); or it could be Ansible (an open-source automation platform, a configuration management tool, and an automated operation and maintenance tool). After the Kubernetes cluster is deployed, when it is necessary to obtain and modify relevant configuration information, the automated operation and maintenance tool can be used.

[0061] Furthermore, in order to obtain log information generated during the deployment of the Kubernetes cluster in real time, the above-mentioned method for offline deployment of the Kubernetes cluster may also include:

[0062] Real-time logs generated during the deployment of a Kubernetes cluster can be displayed through remote procedure calls.

[0063] This embodiment does not limit the specific remote procedure call (RPC) framework used for the remote procedure call. For example, the RPC framework could be an RPC (Remote Procedure Call); or it could be the Dubbo remote procedure call service framework; or it could be gRPC (High-Performance Remote Procedure Call framework). This embodiment invokes the RPC framework to display real-time logs generated during the deployment of the Kubernetes cluster, thereby obtaining real-time logs generated during the deployment process and promptly identifying problems that arise during the deployment.

[0064] Furthermore, in order to obtain the deployment progress of the Kubernetes cluster in a timely manner, the above-mentioned method for offline deployment of the Kubernetes cluster may also include:

[0065] Monitor the deployment progress of the Kubernetes cluster and return a message indicating successful deployment.

[0066] This embodiment does not limit the specific entity monitoring the Kubernetes cluster, as long as the entity can reside within the device where the Kubernetes cluster is deployed offline, and is part of that device. For example, the entity monitoring the deployment progress of the Kubernetes cluster could be Prometheus (an open-source system monitoring and alerting system); or it could be a cluster manager, such as Spark (a standalone cluster manager, a simple Spark cluster manager that easily creates clusters based on Spark's own Master-Worker cluster); or it could be Hadoop YARN (Spark can integrate with Hadoop, using Yarn for resource scheduling). This embodiment utilizes the cluster manager to monitor the deployment progress of the Kubernetes cluster and returns a deployment success message, ensuring timely return of a deployment success message after deployment completion and guaranteeing the smooth execution of subsequent operations.

[0067] The offline deployment method for Kubernetes (K8S) clusters provided in this invention involves obtaining offline installation script information, including a deployment installation package and a cluster compressed image. OpenStack resources are created based on Terraform and predefined configuration information, resulting in a returned resource configuration file. A predefined image repository project is obtained, and the K8S cluster is deployed based on the offline installation script information, the resource configuration file, and the predefined image repository project. This invention uses Terraform in Kubespray to generate the resource configuration file. This is integrated with the cluster compressed image, combining the advantages of Kubespray's ability to generate clusters offline with the advantage of the cluster compressed image's ability to quickly install K8S clusters. K8S cluster deployment can be achieved simply by inputting predefined configuration information. Compared to existing technologies that require manual step-by-step deployment of K8S clusters according to installation files, the offline deployment method provided by this invention can call the offline installation script information to achieve one-click deployment of the K8S cluster. That is, installers only need to input predefined configuration information to achieve one-click deployment of the K8S cluster, greatly improving the deployment efficiency of the K8S cluster. Furthermore, embodiments of the present invention can invoke automated operation and maintenance tools, enabling timely acquisition of the configuration files corresponding to the K8S cluster and modification of parameters; furthermore, embodiments of the present invention can invoke a remote procedure call framework to display real-time logs generated during the deployment of the K8S cluster, realizing a log display service, and allowing for problem tracing based on the logs; furthermore, embodiments of the present invention can utilize the cluster manager to monitor the deployment progress of the K8S cluster and return a deployment success notification, enabling rapid acquisition of information on successful K8S cluster deployment and facilitating rapid commencement of subsequent work.

[0068] For a clearer understanding of this invention, please refer to the following details. Figure 2 , Figure 2The flowchart illustrates a method for offline deployment of a Kubernetes cluster, as provided in this embodiment of the invention. Specifically, it may include: obtaining kubesphere.tar.gz (cluster compressed image) and kk (deployment installation package); creating OpenStack resources based on Terraform and predefined configuration information, obtaining the returned tfstate file (resource configuration file); saving the tfstate file, kubesphere.tar.gz, and kk, and connecting to the bastion (jump host); and generating the config-sample.yaml file (system configuration template) by calling kubesphere.tar.gz and the config-sample.yaml.j2 template. The process involves: generating an image repository based on the kk and config-sample.yaml files; calling the create_project_harbor.sh.j2 template (image repository template) to generate the create_project_harbor.sh file (image repository file); generating a predefined image repository project based on the create_project_harbor.sh file and the image repository; deploying a K8S cluster with one click based on the tfstate file, the predefined image repository project, kubesphere.tar.gz, and kk; and outputting a terminal that supports kubectl commands (command line tool) and the K8S login URL (Uniform Resource Locator).

[0069] The following describes an apparatus for offline deployment of a K8S cluster provided by an embodiment of the present invention. The apparatus for offline deployment of a K8S cluster described below and the method for offline deployment of a K8S cluster described above can be referred to in correspondence.

[0070] Please refer to the details. Figure 3 , Figure 3 A schematic diagram of a device for offline deployment of a Kubernetes cluster provided in an embodiment of the present invention may include:

[0071] The offline installation script information acquisition module 100 is used to acquire offline installation script information; wherein, the offline installation script information includes deployment installation packages and cluster compressed package images;

[0072] The resource configuration file acquisition module 200 is used to create OpenStack resources based on Terraform and predefined configuration information, and obtain the returned resource configuration file.

[0073] The K8S cluster deployment module 300 is used to obtain a predefined image repository project and deploy a K8S cluster according to the offline installation script information, the resource configuration file and the predefined image repository project.

[0074] Furthermore, based on the above embodiments, the apparatus for offline deployment of a Kubernetes cluster may further include:

[0075] The system configuration file generation module is used to generate a system configuration file based on the cluster compressed package image using a system configuration template.

[0076] The image repository generation module is used to generate an image repository based on the deployment installation package and the system configuration file;

[0077] The image repository file generation module is used to generate image repository files using image repository templates;

[0078] The predefined image repository project creation module is used to create the predefined image repository project based on the image repository and the image repository file.

[0079] Furthermore, based on any of the above embodiments, the apparatus for offline deployment of a K8S cluster may further include:

[0080] The copy module is used to send the resource configuration file, the deployment installation package, and the cluster compressed package image to the jump host to perform the action of deploying the K8S cluster.

[0081] Furthermore, based on any of the above embodiments, the apparatus for offline deployment of a K8S cluster may further include:

[0082] The automated operation and maintenance tool invocation module is used to invoke automated operation and maintenance tools to obtain the configuration file corresponding to the K8S cluster.

[0083] Furthermore, based on any of the above embodiments, the apparatus for offline deployment of a K8S cluster may further include:

[0084] The real-time log display module is used to display the real-time logs generated during the deployment of the K8S cluster via remote procedure calls.

[0085] Furthermore, based on any of the above embodiments, the apparatus for offline deployment of a K8S cluster may further include:

[0086] The cluster manager calls a module to monitor the deployment progress of the K8S cluster and return a message indicating successful deployment.

[0087] It should be noted that the order of the modules in the above-mentioned offline deployment device for K8S clusters can be changed without affecting the logic.

[0088] The apparatus for offline deployment of a Kubernetes cluster provided in this embodiment of the invention includes: an offline installation script information acquisition module 100, used to acquire offline installation script information; wherein, the offline installation script information includes a deployment installation package and a cluster compressed package image; a resource configuration file acquisition module 200, used to create OpenStack resources based on Terraform and predefined configuration information, and obtain the returned resource configuration file; and a Kubernetes cluster deployment module 300, used to acquire a predefined image repository project, and deploy the Kubernetes cluster based on the offline installation script information, the resource configuration file, and the predefined image repository project.

[0089] The offline deployment device for Kubernetes (K8S) clusters provided in this invention can use Terraform in Kubespray to generate resource configuration files. This is then integrated with the cluster compressed image, combining the advantages of Kubespray's ability to generate clusters offline with the advantage of the cluster compressed image's ability to quickly install K8S clusters. Deploying a K8S cluster only requires inputting predefined configuration information. Compared to existing technologies that require manual step-by-step deployment of K8S clusters according to installation files, the offline deployment device provided by this invention can call offline installation scripts to achieve one-click deployment of the K8S cluster. That is, installers only need to input predefined configuration information to achieve one-click deployment of the K8S cluster, greatly improving the deployment efficiency of K8S clusters. Furthermore, embodiments of the present invention can invoke automated operation and maintenance tools, enabling timely acquisition of the configuration files corresponding to the K8S cluster and modification of parameters; furthermore, embodiments of the present invention can invoke a remote procedure call framework to display real-time logs generated during the deployment of the K8S cluster, realizing a log display service, and allowing for problem tracing based on the logs; furthermore, embodiments of the present invention can utilize the cluster manager to monitor the deployment progress of the K8S cluster and return a deployment success notification, enabling rapid acquisition of information on successful K8S cluster deployment and facilitating rapid commencement of subsequent work.

[0090] The following describes the device for offline deployment of K8S clusters provided in the embodiments of the present invention. The device for offline deployment of K8S clusters described below and the method for offline deployment of K8S clusters described above can be referred to in correspondence.

[0091] Please refer to Figure 4 , Figure 4 A schematic diagram of a device for offline deployment of a Kubernetes cluster, provided as an embodiment of the present invention, may include:

[0092] Memory 10 is used to store computer programs;

[0093] Processor 20 is used to execute computer programs to implement the steps of the method for offline deployment of a K8S cluster described above.

[0094] The memory 10, processor 20, and communication interface 31 all communicate with each other through the communication bus 32.

[0095] In this embodiment of the invention, the memory 10 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment, the memory 10 may store programs for implementing the following functions:

[0096] Obtain offline installation script information; this information includes the deployment installation package and the cluster compressed image.

[0097] Create OpenStack resources based on Terraform and predefined configuration information, and obtain the returned resource configuration files;

[0098] Obtain a predefined image repository project and deploy a Kubernetes cluster based on the offline installation script information, resource configuration files, and the predefined image repository project.

[0099] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.

[0100] Furthermore, memory 10 may include read-only memory and random access memory, providing instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores operating systems and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and handling hardware-based tasks.

[0101] Processor 20 can be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic device. Processor 20 can be a microprocessor or any conventional processor. Processor 20 can call programs stored in memory 10.

[0102] Communication interface 31 can be an interface for the communication module, used to connect with other devices or systems.

[0103] Of course, it should be noted that, Figure 4The structure shown does not constitute a limitation on the devices for offline deployment of Kubernetes clusters in the embodiments of this application. In practical applications, devices for offline deployment of Kubernetes clusters may include those that are more advanced than those shown in the embodiments of this application. Figure 4 More or fewer components as shown, or combinations of certain components.

[0104] The following describes the computer-readable storage medium provided in the embodiments of the present invention. The readable storage medium described below can be referred to in correspondence with the offline deployment method of K8S cluster described above.

[0105] The present invention also provides a readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described method for offline deployment of a K8S cluster.

[0106] The readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0107] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0108] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0109] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0110] The method, apparatus, device, and readable storage medium for offline deployment of K8S clusters provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for offline deployment of a Kubernetes cluster, characterized in that, include: Obtain offline installation script information; wherein, the offline installation script information includes deployment installation packages and cluster compressed package images; The OpenStack resource is created based on Terraform and predefined configuration information in Kubespray, and the returned resource configuration file is obtained. The resource configuration file, the deployment installation package, and the cluster compressed image are sent to the jump server to execute the deployment of the K8S cluster; Obtain a predefined image repository project, and deploy a K8S cluster based on the offline installation script information, the resource configuration file, and the predefined image repository project; After the K8S cluster is deployed, when it is necessary to obtain and modify relevant configuration information, the automated operation and maintenance tool is invoked to obtain the configuration file corresponding to the K8S cluster and modify the parameters. By invoking the remote procedure call framework to perform remote procedure calls, the real-time logs generated during the deployment of the K8S cluster can be displayed, so as to obtain the real-time logs generated during the deployment of the K8S cluster in real time and discover problems that occur during the deployment of the K8S cluster in a timely manner. The Spark cluster manager is used to monitor the deployment progress of the Kubernetes cluster and return a deployment success message. This ensures that a deployment success message is returned in a timely manner after deployment is completed, so as to ensure the smooth execution of subsequent operations. Prior to obtaining the predefined image repository project, the process also includes: Based on the cluster compressed image, a system configuration file is generated using the system configuration template; A mirror repository is generated based on the deployment installation package and the system configuration file; Generate image repository files using the image repository template; The predefined image repository project is created based on the image repository and the image repository file.

2. An apparatus for offline deployment of a Kubernetes cluster, characterized in that, The method for offline deployment of a Kubernetes cluster based on claim 1 includes: An offline installation script information acquisition module is used to acquire offline installation script information; wherein, the offline installation script information includes deployment installation packages and cluster compressed package images; The resource configuration file acquisition module is used to create OpenStack resources based on Terraform and predefined configuration information, and obtain the returned resource configuration file. The K8S cluster deployment module is used to obtain predefined image repository projects and deploy K8S clusters according to the offline installation script information, the resource configuration files, and the predefined image repository projects.

3. A device for offline deployment of a Kubernetes cluster, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the method for offline deployment of a K8S cluster as described in claim 1 when executing the computer program.

4. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method for offline deployment of a K8S cluster as described in claim 1.