Modular k8s cluster offline deployment system and method
Through the modular k8s cluster offline deployment system, the storage path of offline installation resources is determined using the environment detection and preparation modules, and the rapid deployment of k8s clusters in an offline environment is achieved, solving the deployment difficulty and efficiency problems in the existing technology, and improving the maintainability and scalability of the system.
Patent Information
- Application Number
- CN202510407599.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-05-02
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing k8s cluster deployment solutions are difficult to achieve rapid deployment in offline environments, and are highly dependent on the network environment, making it difficult to meet the efficiency and scalability requirements of large-scale cluster deployment.
It provides a modular k8s cluster offline deployment system, including environment detection module, environment preparation module and deployment module. By detecting hardware architecture and operating system information, it determines the local storage path of offline installation resources, and automatically deploys the k8s cluster based on offline installation resources.
It realizes the rapid deployment of k8s clusters in offline environments, reduces deployment difficulty and complexity, improves the system's maintainability and scalability, and meets the efficiency needs of large-scale cluster deployment.
Smart Images

Figure CN119922074A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a modular k8s cluster offline deployment system and method. Background Art
[0002] With the continuous maturity of technologies such as microservices, docker, and kubernetes (hereinafter referred to as k8s), cloud native architecture has been adopted by many companies. As the de facto standard in the field of container orchestration, k8s in the cloud native architecture has also been used on a large scale in the production environments of many companies. However, the installation and deployment of k8s involves many components and complex dependencies, which makes the installation and deployment process more complicated, making many beginners daunted and also affecting the implementation of k8s in enterprises.
[0003] On this basis, there are also some solutions for quickly building k8s clusters. However, in terms of network environment, most of the existing solutions rely on stable network connections to obtain the required installation packages and dependencies online. Once the network fluctuates or there is no network, the installation process will be forced to be interrupted. Moreover, for the deployment of large-scale clusters, the existing solutions perform poorly in terms of efficiency and scalability, and it is difficult to meet the needs of enterprises for rapid deployment and business expansion.
[0004] In view of this, there is an urgent need for a solution that can realize the rapid deployment of k8s clusters in an offline environment. Summary of the invention
[0005] The embodiments of the present application provide a modular k8s cluster offline deployment system, method, computer device and storage medium.
[0006] A first aspect of an embodiment of the present application provides a modular k8s cluster offline deployment system, including: an environment detection module, an environment preparation module, and a deployment module; The environment detection module is used to detect the hardware architecture of each node in the k8s cluster; The environment preparation module is used to detect the operating system information of each node, and determine the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and the operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; The deployment module is used to read the offline installation resources according to the local storage path and deploy the k8s cluster according to the offline installation resources.
[0007] In an optional embodiment of the present application, the environment preparation module is further used to set the environment parameters corresponding to each node according to the operating system information; Accordingly, the system further comprises: a network configuration module and a configuration file generation module; The network configuration module is used to configure the network parameters of each node; The configuration file generating module is used to generate a configuration file corresponding to each node according to the environment parameters, the network parameters and the operating system information.
[0008] In an optional embodiment of the present application, the modular k8s cluster offline deployment system further includes: a download module; The download module is used to download the configuration file in response to the configuration file download instruction, and store the downloaded offline configuration file locally; The download module is further used to download the deployment installation package in response to the installation package download instruction, and store the downloaded offline deployment installation package locally.
[0009] In an optional embodiment of the present application, the modular k8s cluster offline deployment system further includes: a cluster architecture determination module; The cluster architecture determination module is used to determine whether the k8s cluster belongs to a high-availability cluster architecture; if the operation result of the cluster architecture determination module is yes, the target deployment submodule contained in the deployment module is instructed to run; The target deployment submodule is used to send the installation package and configuration file corresponding to the target type server to the master node after the installation of the master node in the k8s cluster is completed, and send the configuration file of the switching mechanism software to the master node to instruct the master node to install the target type server based on the installation package and configuration file corresponding to the target type server, and install the switching mechanism software based on the configuration file of the switching mechanism software.
[0010] In an optional embodiment of the present application, the environment detection module is also used to send a hardware architecture judgment program to each of the nodes, and obtain processor information of each node by running the hardware architecture judgment program at each node, determine the hardware architecture corresponding to each node according to the processor information, and add the determination result to the record table.
[0011] In an optional embodiment of the present application, the modular k8s cluster offline deployment system further includes: an installation module; The installation module is used to determine a first target hardware architecture from the at least two hardware architectures when it is determined that the record table contains at least two hardware architectures, and to install a cross-platform simulator on a target node corresponding to the first target hardware architecture.
[0012] In an optional embodiment of the present application, the offline deployment installation package is a binary installation package; Correspondingly, the deployment module is also used to determine a second target hardware architecture among the at least two hardware architectures when it is determined that the target node includes a cross-platform simulator, translate the read binary installation package based on the second target hardware architecture, generate an offline deployment installation package corresponding to the second target hardware architecture, install the offline deployment installation package corresponding to the second target hardware architecture to the target node, and import the configuration file of the target node into the target node.
[0013] A second aspect of an embodiment of the present application provides a modular k8s cluster offline deployment method, including: Detect the hardware architecture of each node in the k8s cluster; Detecting the operating system information of each node, and determining the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and the operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; The offline installation resource is read according to the local storage path, and the k8s cluster is deployed according to the offline installation resource.
[0014] According to a third aspect of an embodiment of the present application, a computer device is provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.
[0015] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of any of the above methods when executed by a processor.
[0016] The modular k8s cluster offline deployment system provided by the embodiment of the present application includes: an environment detection module, an environment preparation module and a deployment module; the environment detection module is used to detect the hardware architecture of each node in the k8s cluster; the environment preparation module is used to detect the operating system information of each node, and determine the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; the deployment module is used to read the offline installation resources according to the local storage path, and deploy the k8s cluster according to the offline installation resources. The embodiment of the present application helps the system to realize the decomposition and modular design of functions, and improves the maintainability and scalability of the system. In addition, the deployment process of the embodiment of the present application does not require an external network connection, and the cluster deployment can be completed through the pre-downloaded offline deployment installation package and offline configuration file, which is conducive to reducing the difficulty and complexity of the offline deployment of the k8s cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 An architectural diagram of a modular k8s cluster offline deployment system provided for an embodiment of the present application; Figure 2 A flowchart of a modular k8s cluster offline deployment method provided for an embodiment of the present application; Figure 3 A flowchart of another modular k8s cluster offline deployment method provided for an embodiment of the present application; Figure 4 A schematic diagram of the computer device structure provided for one embodiment of the present application. DETAILED DESCRIPTION
[0018] In the process of implementing this application, the inventors found that the current k8s cluster deployment solution has poor deployment effect.
[0019] In response to the above problems, a modular k8s cluster offline deployment system is provided in an embodiment of the present application, including: an environment detection module, an environment preparation module and a deployment module; wherein the environment detection module is used to detect the hardware architecture of each node in the k8s cluster; the environment preparation module is used to detect the operating system information of each node, and determine the local storage path corresponding to the offline installation resources of each node based on the hardware architecture and operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; the deployment module is used to read the offline installation resources according to the local storage path, and deploy the k8s cluster according to the offline installation resources.
[0020] The solutions in the embodiments of the present application can be implemented using various computer languages, for example, the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0021] In order to make the technical solutions and advantages in the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0022] First, the terms involved in one or more embodiments of the present application are explained.
[0023] Kubernetes, or k8s for short, is an open source containerized application for managing multiple hosts in a cloud platform.
[0024] ARM architecture, full name Advanced RISC Machine, is a processor architecture based on RISC (reduced instruction set computer).
[0025] Dual-machine cluster system (Highly Available, HA): used to improve the availability of clusters, is an effective solution to ensure business continuity, generally has two or more nodes, and is divided into active nodes and standby nodes.
[0026] AMD architecture mainly includes ZEN architecture and x86 architecture. AMD's ZEN architecture is the basis of its processor design, aiming to achieve extreme performance, scalability and efficiency. In addition, AMD also adopts x86 architecture, which is one of the main architectures of its processor. The x86 architecture is a complex instruction set computer (CISC) architecture that is widely used in platforms such as personal computers, servers and workstations.
[0027] In the wave of digital transformation, container technology has been favored for its efficient resource utilization and convenient application deployment. As the core technology in the field of container orchestration, k8s plays a key role in the IT architecture of many enterprises. However, the installation process of k8s is not smooth sailing, and there are many complexities and challenges.
[0028] The traditional manual installation of k8s requires operators to have a deep understanding of the underlying technology and rich experience. This includes adjusting the kernel parameters of the operating system, optimizing the network configuration, and allocating storage resources. During the installation process, each key component needs to be installed and configured in sequence, such as etcd for storing cluster status information, API Server as the control entry of the cluster, and Controller Manager responsible for the operation of various controllers. Each component has its own specific dependencies and configuration requirements, and the slightest mistake may lead to installation failure.
[0029] The current implementation scheme is usually based on scripted installation. By writing a series of shell scripts or Python scripts, the installation steps are executed in a predetermined order. However, this method has some obvious limitations. First, the maintainability of the script is poor. When the installation requirements change or need to adapt to a new environment, it is often complicated to modify the script. Secondly, the script's ability to handle errors is relatively weak. Once a problem occurs during the installation process, it is difficult to perform effective rollback and recovery operations. In addition, when dealing with cross-architecture installations (such as AMD and ARM), this method usually requires writing different scripts separately, which increases the cost of development and maintenance.
[0030] In terms of network environment, most current solutions rely on a stable network connection to obtain the required installation packages and dependencies online. Once the network fluctuates or there is no network, the installation process will be interrupted. Moreover, for large-scale cluster deployment, existing solutions perform poorly in terms of efficiency and scalability, making it difficult to meet the needs of enterprises for rapid deployment and business expansion.
[0031] It can be seen that the current k8s deployment solution has extremely high technical requirements for operators. It requires in-depth understanding of the working principles and configuration details of each component, and a lot of professional knowledge and experience, which leads to increased labor costs and is prone to human errors affecting the installation effect. In addition, the current solution has low deployment efficiency. Especially in large-scale cluster deployment, manual operation of each node is extremely time-consuming and cannot quickly meet the needs of business launch. The adaptation work for different hardware architectures is complicated and cumbersome, and compatibility issues are prone to occur, which increases the uncertainty and risk of deployment. Moreover, it is too dependent on the network environment. It cannot be installed normally when the network is unstable or there is no network, which limits its application scenarios. Similarly, the current solution lacks flexibility and is difficult to meet diverse business needs such as high-availability architecture and single master deployment, and cannot adapt to complex and changing business environments.
[0032] The embodiment of the present application decomposes the installation process into multiple automated modules, making the entire installation process more standardized and regular, reducing errors caused by unskilled operation or misunderstanding. At the same time, the installation efficiency is greatly improved in an automated modular manner, especially in the scenario of large-scale cluster deployment, which can quickly and accurately complete the installation and configuration of multiple nodes and shorten the service launch time. For different hardware architectures (such as AMD and ARM), automatic adaptation is achieved through modular design, without tedious manual adjustments, ensuring that the installation can be successfully completed in various architectural environments.
[0033] In addition, in terms of network environment, we take advantage of automated modularization to support offline installation without network environment, get rid of network restrictions, and expand application scenarios. Moreover, through modular and flexible configuration, we can meet diverse business needs such as high-availability architecture and single-master deployment, so that k8s clusters can better adapt to different business scenarios and performance requirements.
[0034] In an embodiment of the present application, a modular k8s cluster offline deployment system is provided. The embodiment of the present application also involves a modular k8s cluster offline deployment method, a computer device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0035] Figure 1 The schematic diagram shows an architecture diagram of a modular k8s cluster offline deployment system provided according to an embodiment of the present application, which specifically includes: an environment detection module 102, an environment preparation module 104 and a deployment module 106; The environment detection module 102 is used to detect the hardware architecture of each node in the k8s cluster; The environment preparation module 104 is used to detect the operating system information of each node, and determine the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and the operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; The deployment module 106 is used to read the offline installation resources according to the local storage path and deploy the k8s cluster according to the offline installation resources.
[0036] The embodiment of the present application modularizes the deployment process of the k8s cluster, specifically decomposing the deployment process of the k8s cluster into multiple automated modules.
[0037] Among them, the environment detection module 102 is used to detect the hardware architecture of each node in the k8s cluster; in the embodiment of the present application, the hardware architecture of the node can be an ARM architecture, an AMD architecture, or other architectures, which is not limited here.
[0038] The environment preparation module 104 is used to detect the operating system information of each node in the k8s cluster, and determine the offline installation resource information of each node according to the hardware architecture and operating system information of each node, so as to determine the local storage path corresponding to the offline installation resources of each node according to the offline installation resource information.
[0039] In actual applications, offline installation resources include offline deployment installation packages and offline configuration files; offline installation resource information may include the installation package name and format of the offline deployment installation package, the file name and format of the offline configuration file, etc. In addition, in the embodiment of the present application, the offline deployment installation package is a k8s installation package; the offline configuration file is an operating system configuration file, which may include relevant configuration information of the operating system, such as kernel parameters and network parameters.
[0040] Because the hardware architectures of different nodes may be different, and the operating systems corresponding to different nodes may also be different, it is necessary to determine the offline installation resources that are compatible with each node according to the hardware architecture and operating system information of each node.
[0041] In the embodiment of the present application, in the scenario of offline deployment of the k8s cluster, in order to achieve offline deployment, the deployment installation package and configuration file required for cluster deployment need to be downloaded in advance and stored locally. Due to different hardware architectures and / or different operating systems, different installation packages will correspond. For example, if the hardware architecture of node 1 is AMD architecture and the operating system is Windows, the k8s installation package of node 1 is installation package a; if the hardware architecture of node 2 is ARM architecture and the operating system is Windows, the k8s installation package of node 2 is installation package b; if the hardware architecture of node 3 is AMD architecture and the operating system is Linux, the k8s installation package of node 3 is installation package c, etc.
[0042] Based on this, in order to ensure the normal offline deployment process of the k8s cluster, the embodiment of the present application can download and store the deployment installation packages of each version locally, so that the system can select the deployment installation package that is compatible with each node according to the hardware architecture and operating system corresponding to each node.
[0043] After determining the local storage path corresponding to the offline installation resource of each node, the deployment module 106 is used to read the offline installation resource according to the local storage path and deploy the k8s cluster according to the offline installation resource.
[0044] In actual applications, the deployment module 106 is responsible for installing the core components of k8s on each node, such as kubelet, kube-proxy, etc. It will select the appropriate installation package for installation according to the hardware architecture and operating system information of each node, and select the corresponding configuration file to configure each node accordingly.
[0045] The embodiment of the present application provides a one-click deployment and configuration function, and the deployment process does not require an external network connection. The cluster deployment can be completed through a pre-downloaded offline deployment installation package and an offline configuration file, which reduces the difficulty and complexity of deployment. In addition, since the offline deployment installation package integrates the necessary software components and dependencies, it is beneficial to ensure the consistency and stability of the deployment.
[0046] In an optional embodiment of the present application, the environment preparation module 104 is further used to set the environment parameters corresponding to each node according to the operating system information; Accordingly, the system further includes: a network configuration module 108 and a configuration file generation module 110; The network configuration module 108 is used to configure the network parameters of each node; The configuration file generating module 110 is used to generate a configuration file corresponding to each node according to the environment parameters, the network parameters and the operating system information.
[0047] In an optional embodiment of the present application, the modular k8s cluster offline deployment system further includes: a download module 112; The download module 112 is used to download the configuration file in response to the configuration file download instruction, and store the downloaded offline configuration file locally; The download module 112 is further configured to download a deployment installation package in response to an installation package download instruction, and store the downloaded offline deployment installation package locally.
[0048] Specifically, as mentioned above, the embodiment of the present application decomposes the deployment process of the k8s cluster into multiple automated modules, and each step involved in the deployment process can be implemented through different modules.
[0049] In specific implementation, the modular k8s cluster offline deployment system of the embodiment of the present application includes a network configuration module 108 and a configuration file generation module 110; the network configuration module 108 is used to configure the network parameters of each node. In practical applications, the network configuration module 108 is responsible for processing the network settings in the k8s cluster, including the creation of virtual networks, IP address allocation, configuration of network policies, etc. This module can be flexibly configured for different network topologies and requirements.
[0050] In addition, the environment preparation module 104 is also used to set the environment parameters corresponding to each node according to the operating system information; in actual applications, the environment preparation module 104 is responsible for detecting and configuring the operating system environment, such as installing necessary dependent libraries, setting kernel parameters, etc. It will make corresponding adjustments according to different operating system types and versions to ensure the compatibility and stability of the basic environment.
[0051] As for the configuration file generation module 110, it is used to generate a configuration file corresponding to each node according to the environment parameters set by the environment preparation module 104, the network parameters configured by the network configuration module 108, and the operating system information. In actual applications, the configuration file generation module 110 generates various configuration files of the k8s cluster, such as the master node configuration file, the worker node configuration file, the network configuration file, etc., according to the input (environmental parameters and network parameters) and the detection results of the operating system. These configuration files will ensure the correct operation of the k8s cluster.
[0052] In addition, as mentioned above, in the scenario of offline deployment of the k8s cluster, in order to achieve offline deployment, the deployment installation package and configuration file required for cluster deployment need to be downloaded in advance and stored locally. Then the embodiment of the present application also modularizes the download step, specifically, the download of the deployment installation package and configuration file is realized through the download module 112.
[0053] Among them, for the configuration file, the configuration file generation module 110 first generates the configuration file corresponding to each node according to the environmental parameters set by the environment preparation module 104, the network parameters configured by the network configuration module 108 and the operating system information, and then the generated configuration file is downloaded through the download module 112, and the downloaded offline configuration file is stored locally.
[0054] For the deployment installation package, the deployment installation package of each version is directly downloaded from the website through the download module 112, and the downloaded offline deployment installation package is stored locally for standby use.
[0055] After storage is completed, the correspondence between the offline configuration file and its local storage path, and the correspondence between the offline deployment installation package and its local storage path can also be recorded. Specifically, a record file can be generated, which may include the installation package name of the offline installation package, the installation package format, the correspondence between the installation package name and the operating system and hardware architecture, the correspondence between the installation package name and the local storage path, as well as the file name, file format, file name and node and / or node operating system of the offline configuration file, the correspondence between the file name and the local storage path, etc.
[0056] Based on this, in an offline deployment scenario, the deployment module 106 can read the offline deployment installation package and the offline configuration file according to the information contained in the record file to achieve offline deployment of the k8s cluster.
[0057] The embodiment of the present application can realize the automatic deployment of the k8s cluster in an offline environment. That is, the k8s cluster can be deployed even in an environment without an external network connection, which greatly broadens the deployment scenario and improves the availability and flexibility of the system.
[0058] In an optional embodiment of the present application, the modular k8s cluster offline deployment system further includes: a cluster architecture determination module; The cluster architecture determination module is used to determine whether the k8s cluster belongs to a high-availability cluster architecture; if the operation result of the cluster architecture determination module is yes, the target deployment submodule contained in the deployment module is instructed to run; The target deployment submodule is used to send the installation package and configuration file corresponding to the target type server to the master node after the installation of the master node in the k8s cluster is completed, and send the configuration file of the switching mechanism software to the master node to instruct the master node to install the target type server based on the installation package and configuration file corresponding to the target type server, and install the switching mechanism software based on the configuration file of the switching mechanism software.
[0059] Specifically, the target deployment submodule is the nginx module; the main node is the master node; the target type server is nginx, and the switching mechanism software is keepalived.
[0060] In the actual k8s cluster deployment process, you can select the modules and configuration options to be installed according to the deployment requirements. Then the system will automatically execute the installation steps in sequence according to the dependencies of the selected modules. The deployment requirements can be that the deployed k8s cluster is a high-availability architecture, or the deployed k8s cluster is not a high-availability architecture; if the deployment requirement is that the deployed k8s cluster is a high-availability architecture, the nginx module must be determined as the module to be installed; if the deployment requirement is that the deployed k8s cluster is not a high-availability architecture, when selecting the module to be installed, the nginx module is not selected.
[0061] In the embodiment of the present application, the deployment module 106 may include a certificate submodule, a docker submodule, an etcd submodule, a master submodule, and a node submodule in addition to the nginx module. In addition, the modular k8s cluster offline deployment system provided in the embodiment of the present application may also include a component installation module 116, which is responsible for installing various extension components of the k8s cluster, such as monitoring components, log components, storage components, etc. These components can be selected and installed according to needs to achieve customized functions.
[0062] Based on this, in the embodiment of the present application, the operating order of the sub-modules included in the environment detection module 102, the environment preparation module 104, and the deployment module 106; the network configuration module 108, the configuration file generation module 110, the download module 112, the cluster architecture determination module, and the component installation module 116 are as follows: 1) The environment detection module 102 detects whether the hardware architecture of each node is AMD architecture or ARM architecture; 2) The environment preparation module 104 detects the operating system information of each node and sets the corresponding environment parameters of each node according to the operating system information; 3) The network configuration module 108 configures the network parameters of each node; 4) The configuration file generation module 110 generates a configuration file corresponding to each node according to the environment parameters, network parameters and operating system information; In specific implementation, the configuration file generation module is also used to configure the IP addresses of the master and node nodes, configure the pods and service network segment addresses, select the node for installing etcd, define the log storage directory, and select the docker version.
[0063] 5) The download module 112 downloads the configuration file and the deployment installation package and stores them locally; 6) Environment preparation module 104 closes the firewall and swap partition, adds hosts configuration, and prepares for offline deployment of the installation package; 7) The certificate submodule creates k8s and etcd certificates; 8) The docker submodule changes the default data storage directory of docker, installs docker and sets it to start automatically at boot, and checks whether the docker service is normal; 9) The etcd submodule automatically distributes the etcd installation package and certificate to the etcd node, installs the etcd cluster and sets it to start automatically, and checks whether the etcd cluster is normal; 10) The master submodule automatically distributes the k8s installation package and certificate to the master node, installs the master component, authorizes the API Server to access Kubelet, and checks the cluster status; 11) The cluster architecture determination module determines whether the cluster is a high-availability architecture; if not, the HA software is not installed, and the single master's apiserver address is not loaded; if so, the nginx submodule is run; 12) The nginx submodule automatically distributes the nginx installation package to the master node, automatically distributes the nginx and keepalived configuration files according to the configuration files, installs the nginx and keepalived services and sets them to start automatically, and checks whether the high-availability VIP is effective; 13) The node submodule automatically distributes the k8s installation package and certificate to the node node, distributes and decompresses the cni plug-in binary package, distributes the k8s cluster configuration file, starts the node component, and checks the cluster status; 14) The component installation module 116 automatically distributes the plug-in installation package to the node. Choose to install flannel or calico according to the business environment, and choose to install coredns, ingress-nginx, dashboard, etc.
[0064] In addition, the component installation module 116 may also include a monitoring submodule. In addition to the nginx module being an optional module, the monitoring submodule is also an optional module, which is used to select and install prometheus as a monitoring platform according to the business environment, and install the prometheus suite with one click. Therefore, the embodiment of the present application can determine whether to select the monitoring submodule as a module to be installed according to whether there is a monitoring demand.
[0065] In the case of choosing to install the monitoring submodule, the embodiment of the present application can integrate resource management and monitoring functions, display the CPU, memory, disk and other resource usage of the cluster in real time, and provide an alarm and notification mechanism, which is conducive to timely discovery and handling of resource bottlenecks or failures. In addition, this method can meet diverse deployment requirements, such as supporting high-availability architecture and single-master deployment, flexible selection of etcd deployment nodes, support for batch addition of node nodes, support for custom selection of docker versions, support for custom configuration of pod and service network segments, and support for calico and flannel network plug-ins to adapt to different business scenarios and application requirements.
[0066] In addition, during the module installation process, the system will perform various tests and verifications to ensure the correctness of the installation. If an error occurs, the system will give detailed error prompts and solution suggestions. For example, when installing a node, the system will first detect the node's hardware architecture and operating system information, and then select the appropriate installation package from the pre-prepared installation package library for installation. After the installation is complete, a series of verification operations will be performed, such as checking whether the service is started successfully and whether the port is listening normally.
[0067] For large-scale cluster deployment, the system will use a parallel installation method to execute installation tasks on multiple nodes at the same time, which is conducive to improving installation efficiency.
[0068] The embodiment of the present application can realize flexible installation architecture selection, that is, providing two modes: single master node and high-availability architecture, to meet scenarios with different scales and reliability requirements; in addition, the high-availability architecture ensures the high reliability and fault tolerance of the cluster through multiple master nodes and automatic failover mechanism.
[0069] In an optional embodiment of the present application, the environment detection module 102 is also used to send the hardware architecture judgment program to each node, obtain the processor information of each node by running the hardware architecture judgment program on each node, determine the hardware architecture corresponding to each node according to the processor information, and add the determination result to the record table.
[0070] Specifically, the hardware architecture of a node can be determined by the processor model of the node. Among them, the processor models of AMD architecture usually start with a letter, such as "A" for APU in the AMD series, "R" for AMD's Ryzen series, "FX" for AMD's Bulldozer series, etc. The subsequent digital sequence usually indicates the specific model and performance level. The processor models of ARM architecture are more diverse, but they usually do not start with AMD's specific letters. You can query the processor information of the specific device, such as checking the device specification manual or using the system information tool to obtain it.
[0071] Therefore, the embodiment of the present application can send the hardware architecture judgment program to each node through the environment detection module 102, and run the hardware architecture judgment program on each node to obtain the processor model or device specification manual of each node, so as to determine the hardware architecture corresponding to each node based on this information, and add the determination result to the record table (added to the machine list by category), which is used to record the hardware architecture corresponding to each node.
[0072] In an optional embodiment of the present application, the modular k8s cluster offline deployment system further includes: an installation module 116; The installation module 116 is used to determine a first target hardware architecture from the at least two hardware architectures when it is determined that the record table contains at least two hardware architectures, and install a cross-platform simulator on a target node corresponding to the first target hardware architecture.
[0073] In an optional embodiment of the present application, the offline deployment installation package is a binary installation package; Correspondingly, the deployment module 106 is also used to determine a second target hardware architecture among the at least two hardware architectures when it is determined that the target node includes a cross-platform simulator, translate the read binary installation package based on the second target hardware architecture, generate an offline deployment installation package corresponding to the second target hardware architecture, install the offline deployment installation package corresponding to the second target hardware architecture to the target node, and import the configuration file of the target node into the target node.
[0074] Specifically, there are at least two hardware architectures in the k8s cluster, that is, when any two nodes in the k8s cluster correspond to different hardware architectures, in order to achieve compatibility, it is necessary to install cross-platform simulators on some nodes.
[0075] Among them, the first target hardware architecture can be determined according to the number of nodes corresponding to the same hardware architecture. For example, there are 20 nodes in the k8s cluster, of which the hardware architecture of 3 nodes is AMD architecture, and the hardware architecture of the remaining 17 nodes is ARM architecture. Then the AMD architecture can be determined as the first target hardware architecture, and the cross-platform simulator can be installed on the 3 nodes corresponding to the AMD architecture. The embodiment of the present application selects a small number of nodes for cross-platform simulator installation, which is conducive to saving resources and avoiding resource waste.
[0076] After the cross-platform simulator is installed, the binary installation package of the node where the cross-platform simulator is located can be translated through the cross-platform simulator to generate an offline deployment installation package corresponding to the second target hardware architecture, and the offline deployment installation package corresponding to the second target hardware architecture can be installed to the node, and the configuration file of the node can be imported into the node.
[0077] For example, the hardware architecture of node 3 is AMD architecture, and when a cross-platform simulator is installed on node 3, since the deployment installation package of node 3 is adapted to the AMD architecture, in order to achieve architecture compatibility, the deployment installation package of node 3 can be binary translated based on the ARM architecture, and the translated binary installation package can be installed to node 3, and the configuration file of node 3 can be imported into node 3.
[0078] The embodiment of the present application uses binary translation technology for binary service packages, which can translate binary code on one hardware architecture into executable code on another hardware architecture. This technology can dynamically translate binary code on the x86 architecture into code on the ARM architecture at runtime, thereby achieving compatibility between the two architectures.
[0079] In addition, container technology can also be used. Container technology such as Docker provides a lightweight, portable virtualization environment that allows developers to package and run applications and their dependencies in containers. By configuring the appropriate image and container runtime, developers can run ARM-based container images on AMD-based hardware. In practical applications, multi-platform build tools such as Docker Buildx can be used to build images for different architectures.
[0080] The embodiments of the present application can automatically deploy k8s clusters on different hardware architectures (AMD, ARM), thereby achieving compatibility with two mainstream hardware architectures, AMD 64 and ARM64, and expanding the deployment scope of the k8s cluster; in addition, by supporting mixed deployment of servers with different architectures, it is beneficial to improve resource utilization efficiency and deployment flexibility.
[0081] The modular k8s cluster offline deployment system provided by the embodiment of the present application includes: an environment detection module, an environment preparation module and a deployment module; the environment detection module is used to detect the hardware architecture of each node in the k8s cluster; the environment preparation module is used to detect the operating system information of each node, and determine the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; the deployment module is used to read the offline installation resources according to the local storage path, and deploy the k8s cluster according to the offline installation resources. The embodiment of the present application helps the system to realize the decomposition and modular design of functions, and improves the maintainability and scalability of the system. In addition, the deployment process of the embodiment of the present application does not require an external network connection, and the cluster deployment can be completed through the pre-downloaded offline deployment installation package and offline configuration file, which is conducive to reducing the difficulty and complexity of the offline deployment of the k8s cluster.
[0082] It should be understood that each module in the above modular k8s cluster offline deployment system can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0083] See also Figure 2 An embodiment of the present application provides a modular k8s cluster offline deployment method, which specifically includes the following steps.
[0084] Step 202: Detect the hardware architecture of each node in the k8s cluster.
[0085] Step 204: Detect the operating system information of each node, and determine the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and the operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file.
[0086] Step 206: read the offline installation resources according to the local storage path, and deploy the k8s cluster according to the offline installation resources.
[0087] In an optional embodiment of the present application, the modular k8s cluster offline deployment method further includes: Setting the environment parameters corresponding to each node according to the operating system information; Configuring network parameters of each node; A configuration file corresponding to each node is generated according to the environmental parameters, the network parameters and the operating system information.
[0088] In an optional embodiment of the present application, the modular k8s cluster offline deployment method further includes: In response to the configuration file download instruction, download the configuration file, and store the downloaded offline configuration file locally; In response to the installation package download instruction, the deployment installation package is downloaded, and the downloaded offline deployment installation package is stored locally.
[0089] In an optional embodiment of the present application, the modular k8s cluster offline deployment method further includes: Determine whether the k8s cluster belongs to a high-availability cluster architecture; If the running result of the cluster architecture determination module is yes, after the installation of the master node in the k8s cluster is completed, the installation package and configuration file corresponding to the target type server are sent to the master node, and the configuration file of the switching mechanism software is sent to the master node to instruct the master node to install the target type server based on the installation package and configuration file corresponding to the target type server, and install the switching mechanism software based on the configuration file of the switching mechanism software.
[0090] A flowchart of another modular k8s cluster offline deployment method provided by an embodiment of the present application is as follows Figure 3 As shown, in an optional embodiment of the present application, the modular k8s cluster offline deployment method also includes: steps 302 to 308.
[0091] Step 302: Send the hardware architecture determination program to each node.
[0092] Step 304: Obtain processor information of each node by running the hardware architecture determination program on each node.
[0093] Step 306: Determine the hardware architecture corresponding to each node according to the processor information.
[0094] Step 308: Add the determination result to the record table.
[0095] In an optional embodiment of the present application, the modular k8s cluster offline deployment method further includes: When it is determined that the record table contains at least two hardware architectures, a first target hardware architecture is determined from the at least two hardware architectures, and a cross-platform simulator is installed on a target node corresponding to the first target hardware architecture.
[0096] In an optional embodiment of the present application, the offline deployment installation package is a binary installation package; Accordingly, the modular k8s cluster offline deployment method further includes: When it is determined that the target node includes a cross-platform simulator, a second target hardware architecture is determined among the at least two hardware architectures, and based on the second target hardware architecture, the read binary installation package is translated to generate an offline deployment installation package corresponding to the second target hardware architecture, and the offline deployment installation package corresponding to the second target hardware architecture is installed to the target node, and the configuration file of the target node is imported into the target node.
[0097] The modular k8s cluster offline deployment method provided in the embodiment of the present application detects the hardware architecture of each node in the k8s cluster; detects the operating system information of each node, and determines the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and the operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; reads the offline installation resources according to the local storage path, and deploys the k8s cluster according to the offline installation resources. The deployment process of the embodiment of the present application does not require an external network connection, and the cluster deployment can be completed through the pre-downloaded offline deployment installation package and offline configuration file, which is conducive to reducing the difficulty and complexity of the offline deployment of the k8s cluster.
[0098] For the specific limitations of the above-mentioned modular k8s cluster offline deployment method, please refer to the limitations of the modular k8s cluster offline deployment system above, which will not be repeated here.
[0099] It should be understood that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0100] In one embodiment, a computer device is provided, the internal structure diagram of which can be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a modular k8s cluster offline deployment method as above is implemented. Including: including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, any step in the modular k8s cluster offline deployment method as above is implemented.
[0101] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any step in the above modularized k8s cluster offline deployment method can be implemented.
[0102] 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 combining 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.) containing computer-usable program codes.
[0103] 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.
[0104] 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.
[0105] 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. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0106] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0107] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A modular k8s cluster offline deployment system, characterized in that: include: Environment detection module, environment preparation module and deployment module; The environment detection module is used to detect the hardware architecture of each node in the k8s cluster; The environment preparation module is used to detect the operating system information of each node, and determine the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and the operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; The deployment module is used to read the offline installation resources according to the local storage path and deploy the k8s cluster according to the offline installation resources.
2. According to claim 1, the modular k8s cluster offline deployment system is characterized in that: The environment preparation module is also used to set the environment parameters corresponding to each node according to the operating system information; Accordingly, the system further comprises: a network configuration module and a configuration file generation module; The network configuration module is used to configure the network parameters of each node; The configuration file generating module is used to generate a configuration file corresponding to each node according to the environment parameters, the network parameters and the operating system information.
3. According to claim 2, the modular k8s cluster offline deployment system is characterized in that: Also includes: Download module; The download module is used to download the configuration file in response to the configuration file download instruction, and store the downloaded offline configuration file locally; The download module is further used to download the deployment installation package in response to the installation package download instruction, and store the downloaded offline deployment installation package locally.
4. According to claim 1, the modular k8s cluster offline deployment system is characterized in that: It also includes: a cluster architecture determination module; The cluster architecture determination module is used to determine whether the k8s cluster belongs to a high-availability cluster architecture; if the operation result of the cluster architecture determination module is yes, the target deployment submodule contained in the deployment module is instructed to run; The target deployment submodule is used to send the installation package and configuration file corresponding to the target type server to the master node after the installation of the master node in the k8s cluster is completed, and send the configuration file of the switching mechanism software to the master node to instruct the master node to install the target type server based on the installation package and configuration file corresponding to the target type server, and install the switching mechanism software based on the configuration file of the switching mechanism software.
5. According to claim 1, the modular k8s cluster offline deployment system is characterized in that: The environment detection module is also used to send the hardware architecture judgment program to each node, obtain the processor information of each node by running the hardware architecture judgment program on each node, determine the hardware architecture corresponding to each node according to the processor information, and add the determination result to the record table.
6. According to claim 5, the modular k8s cluster offline deployment system is characterized in that: Also includes: Install the module; The installation module is used to determine a first target hardware architecture from the at least two hardware architectures when it is determined that the record table contains at least two hardware architectures, and to install a cross-platform simulator on a target node corresponding to the first target hardware architecture.
7. The modular k8s cluster offline deployment system according to claim 6 is characterized in that: The offline deployment installation package is a binary installation package; Correspondingly, the deployment module is also used to determine a second target hardware architecture among the at least two hardware architectures when it is determined that the target node includes a cross-platform simulator, translate the read binary installation package based on the second target hardware architecture, generate an offline deployment installation package corresponding to the second target hardware architecture, install the offline deployment installation package corresponding to the second target hardware architecture to the target node, and import the configuration file of the target node into the target node.
8. A modular k8s cluster offline deployment method, applied to the modular k8s cluster offline deployment system according to any one of claims 1 to 7, characterized in that: include: Detect the hardware architecture of each node in the k8s cluster; Detecting the operating system information of each node, and determining the local storage path corresponding to the offline installation resources of each node according to the hardware architecture and the operating system information, wherein the offline installation resources include an offline deployment installation package and an offline configuration file; The offline installation resource is read according to the local storage path, and the k8s cluster is deployed according to the offline installation resource.
9. A computer device comprising: It includes a memory and a processor, the memory stores a computer program, and is characterized in that when the processor executes the computer program, it implements the steps of the modular k8s cluster offline deployment method described in claim 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of the modular k8s cluster offline deployment method described in claim 8 are implemented.
Citation Information
Patent Citations
Domestic hardware and operating system container cloud automatic offline deployment method
CN114265600A
Cluster deployment method, computing device and readable storage medium
CN116566811A
Hybrid architecture k8s cluster offline deployment method, system and device and storage medium
CN118733068A
Container platform offline deployment method supporting heterogeneous and multiple operating systems
CN118838606A
Method and apparatus of deploying a cluster, and storage medium
US20230060053A1