A method and device for automatically deploying a kubernetes cluster

CN116401006BActive Publication Date: 2026-09-18SUZHOU SICUI IND INTERNET TECH RES INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310233938.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-13
Publication Date
2026-09-18
Estimated Expiration
2043-03-13

AI Technical Summary

Technical Problem

当前Kubernetes集群这些部署工作通过手动来完成,通常需要一个节点安装后再安装另一个节点,效率低下,若当节点需要调整,维护的工作量也比较大,不利于提高集群的工作效率

Benefits of technology

[0060] 1) Quick installation: All nodes can be installed simultaneously, without needing to be installed in sequence, improving cluster deployment efficiency;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116401006B_ABST
    Figure CN116401006B_ABST
Patent Text Reader

Abstract

The application discloses a kubernetes cluster automatic deployment method and device, and relates to the technical field of software deployment; the deployment method comprises node management and kubernetes installation; the node management elects a server node, takes the server node as a node management server, takes other nodes as node management clients, and other nodes send registration messages to the server node to register the nodes; node data synchronization is realized according to node registration; node state management is realized by using a state machine; cluster high-availability management is realized according to the number of cluster nodes and the server node to elect a cluster high-availability mode; the kubernetes installation comprises a starting process, a server node installation process and an other node installation process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention discloses a method relating to the field of software deployment technology, specifically a method and apparatus for automatic deployment of a Kubernetes cluster. Background Technology

[0002] Kubernetes is a new distributed architecture based on container technology. It is an open-source container cluster management system from Google, a portable and scalable container orchestration and management tool designed for container services. It is used to manage containerized workloads and services, facilitating declarative configuration and automation. It boasts a large and rapidly evolving ecosystem, making Kubernetes services, support, and tools widely available.

[0003] Installing and deploying a Kubernetes cluster is a complex and tedious process, including installing basic software, starting the cluster, installing network interfaces, adding nodes, and achieving high availability. Currently, these deployment tasks are done manually, typically requiring the installation of one node at a time, which is inefficient. Furthermore, if node adjustments are needed, the maintenance workload is significant, hindering the improvement of cluster efficiency. Summary of the Invention

[0004] This invention addresses the problems of existing technologies by providing a method and apparatus for automatic deployment of Kubernetes clusters. It enables rapid and automatic deployment of Kubernetes clusters, allowing nodes in the cluster to simultaneously start the installation program, automatically synchronizing installation progress and forming the cluster, significantly reducing deployment time. Furthermore, when the number of nodes in the cluster changes, the cluster can automatically adjust the roles of each node, reducing cluster maintenance workload.

[0005] The specific solution proposed in this invention is as follows:

[0006] This invention provides a method for automatic deployment of a Kubernetes cluster, the deployment method comprising: node management and Kubernetes installation;

[0007] The node management includes node registration, node data synchronization, node status management, and cluster high availability management. The node management process involves electing a server node, which acts as the node management server, while other nodes act as node management clients. Other nodes register with the server node by sending registration messages. Node data synchronization is achieved based on the registration. A state machine is used for node status management. Finally, based on the number of nodes in the cluster and the elected server node, a cluster high availability mode is deployed for cluster high availability management.

[0008] The Kubernetes installation includes a startup process, a server node installation process, and other node installation processes. The startup process initiates the installation, scans the ports of each node in the cluster, and determines whether a node management server exists in the cluster. If it does not exist, the current node is elected as the server node, and the server node is installed and deployed according to the server node installation process. If it exists, the current node is another node, and other nodes are installed and deployed according to the other node installation process.

[0009] Furthermore, the startup process described in the method for automatically deploying a Kubernetes cluster includes the following specific steps:

[0010] S1: Start the installation process on each node of the cluster, and each node of the cluster enters the START state;

[0011] S2: Scan the ports of each node in the cluster to check if a node management server exists in the network where the cluster is located.

[0012] If it does not exist, the current node starts the node management server, elects the current node as the server node, and installs and deploys the server node according to the server node installation process described above.

[0013] If it exists, the current node starts the node management client, sends a registration message to the node management server to register the current node, and installs and deploys other nodes according to the other node installation process.

[0014] Furthermore, the method for automatically deploying a Kubernetes cluster, which involves installing and deploying the server node according to the server node installation process, includes:

[0015] S1: The current node is the server node. Configure the server node, and the server node enters the CONFIGURED state.

[0016] S2: The system environment is configured based on the server node, the container runtime software is installed, the software installation is completed, and the server node enters the PREPARRED state.

[0017] S3: Generate a virtual IP address for the server node and configure the virtual IP address on the relevant interface;

[0018] S4: Start the Kubernetes cluster; the server nodes enter the CP_UP state.

[0019] Determine if the number of nodes in the cluster is greater than or equal to 3. If so, start the cluster high availability mode and the server node enters the HA_UP state.

[0020] S5: Install network interface;

[0021] S6: Deploy applications.

[0022] Furthermore, in the method for automatic deployment of a Kubernetes cluster, if the server node enters the HA_UP state in S4, it assigns control-plane roles to other nodes, and the other nodes enter the CP_UP state. When the server node goes offline, a server node election is performed. If the current node is not elected, it enters the HA_WAIT state.

[0023] Furthermore, the method for automatically deploying a Kubernetes cluster, which involves installing and deploying other nodes according to the installation process for other nodes, includes:

[0024] S1: If the current node is another node, periodically synchronize the state of the server node until the server node's state is CONFIGURED or a state after CONFIGURED. Then, other nodes synchronize the server node's configuration file to their local machine.

[0025] S2: Use other nodes to parse the configuration file, complete the configuration, and other nodes enter the CONFIGURED state;

[0026] S3: Configure the system environment based on other nodes, install the software during container runtime, and after the software installation is completed, other nodes enter the PREPARRED state;

[0027] S4: Periodically synchronize the state of the server node until the state of the server node is CP_UP and then proceed to S5;

[0028] S5: Synchronize certificates from other nodes;

[0029] S6: Send role requests to the server node based on other nodes;

[0030] S7: Get the role request result. If the role request result is worker, then other nodes join the cluster as workers and enter the WK_UP state.

[0031] If the role request result is control-plane, then other nodes join the cluster as control-plane and enter the CP_UP state.

[0032] The present invention also provides an apparatus for automatic deployment of a Kubernetes cluster, comprising: a node management module and a Kubernetes installation module;

[0033] The node management module is responsible for node registration, node data synchronization, node status management, and cluster high availability management. The module elects a server node, which acts as the node management server, and other nodes act as node management clients. Other nodes register with the server node by sending registration messages through the node management module. Node data synchronization is achieved based on the registration. A state machine is used for node status management. Based on the number of nodes in the cluster and the elected server node, a cluster high availability mode is deployed for cluster high availability management.

[0034] The Kubernetes installation module is responsible for the startup process, the server node installation process, and the installation process for other nodes. The Kubernetes installation module executes the startup process to start the installation, scans the ports of each node in the cluster, and determines whether a node management server exists in the cluster. If it does not exist, it elects the current node as the server node and installs and deploys the server node according to the server node installation process. If it exists, the current node is another node, and the other nodes are installed and deployed according to the other node installation process.

[0035] Furthermore, the Kubernetes installation module in the aforementioned device for automatic deployment of a Kubernetes cluster executes the startup process, specifically through the following steps:

[0036] S1: Start the installation process on each node of the cluster, and each node of the cluster enters the START state;

[0037] S2: Scan the ports of each node in the cluster to check if a node management server exists in the network where the cluster is located.

[0038] If it does not exist, the current node starts the node management server, elects the current node as the server node, and installs and deploys the server node according to the server node installation process described above.

[0039] If it exists, the current node starts the node management client, sends a registration message to the node management server to register the current node, and installs and deploys other nodes according to the other node installation process.

[0040] Furthermore, in the aforementioned device for automatic deployment of a Kubernetes cluster, the Kubernetes installation module installs and deploys server nodes according to the server node installation process, including:

[0041] S1: The current node is the server node. Configure the server node, and the server node enters the CONFIGURED state.

[0042] S2: The system environment is configured based on the server node, the container runtime software is installed, the software installation is completed, and the server node enters the PREPARRED state.

[0043] S3: Generate a virtual IP address for the server node and configure the virtual IP address on the relevant interface;

[0044] S4: Start the Kubernetes cluster; the server nodes enter the CP_UP state.

[0045] Determine if the number of nodes in the cluster is greater than or equal to 3. If so, start the cluster high availability mode and the server node enters the HA_UP state.

[0046] S5: Install network interface;

[0047] S6: Deploy applications.

[0048] Furthermore, in the aforementioned Kubernetes cluster automatic deployment device, if the server node enters the HA_UP state in S4, it assigns control-plane roles to other nodes, and the other nodes enter the CP_UP state. When the server node goes offline, a server node election is performed. If the current node is not elected, it enters the HA_WAIT state.

[0049] Furthermore, in the aforementioned device for automatic deployment of a Kubernetes cluster, the Kubernetes installation module installs and deploys other nodes according to the installation process for other nodes, including:

[0050] S1: If the current node is another node, periodically synchronize the state of the server node until the server node's state is CONFIGURED or a state after CONFIGURED. Then, other nodes synchronize the server node's configuration file to their local machine.

[0051] S2: Use other nodes to parse the configuration file, complete the configuration, and other nodes enter the CONFIGURED state;

[0052] S3: Configure the system environment based on other nodes, install the software during container runtime, and after the software installation is completed, other nodes enter the PREPARRED state;

[0053] S4: Periodically synchronize the state of the server node until the state of the server node is CP_UP and then proceed to S5;

[0054] S5: Synchronize certificates from other nodes;

[0055] S6: Send role requests to the server node based on other nodes;

[0056] S7: Get the role request result. If the role request result is worker, then other nodes join the cluster as workers and enter the WK_UP state.

[0057] If the role request result is control-plane, then other nodes join the cluster as control-plane and enter the CP_UP state.

[0058] The advantages of this invention are:

[0059] This invention provides a method for automatic deployment of a Kubernetes cluster, which has the following advantages compared with existing technologies:

[0060] 1) Quick installation: All nodes can be installed simultaneously, without needing to be installed in sequence, improving cluster deployment efficiency;

[0061] 2) Synchronize installation progress: All nodes can report their installation progress to the server and adjust their respective installation processes according to the server's status;

[0062] 3) Automatic installation: After the server node is configured, automatic installation begins. Other nodes automatically recognize the server status and perform their respective installation steps.

[0063] 4) High availability automatic maintenance: The role of each node in the high availability cluster can be automatically adjusted according to the number of nodes. Attached Figure Description

[0064] 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 some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0065] Figure 1 This is a schematic diagram of the overall architecture of the present invention.

[0066] Figure 2 This is a schematic diagram of node state machine maintenance involved in the present invention.

[0067] Figure 3 This is a schematic diagram of the installation and deployment process involved in this invention. Detailed Implementation

[0068] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.

[0069] This invention provides a method for automatic deployment of a Kubernetes cluster, the deployment method comprising: node management and Kubernetes installation;

[0070] The node management includes node registration, node data synchronization, node status management, and cluster high availability management. The node management process involves electing a server node, which acts as the node management server, while other nodes act as node management clients. Other nodes register with the server node by sending registration messages. Node data synchronization is achieved based on the registration. A state machine is used for node status management. Finally, based on the number of nodes in the cluster and the elected server node, a cluster high availability mode is deployed for cluster high availability management.

[0071] The Kubernetes installation includes a startup process, a server node installation process, and other node installation processes. The startup process initiates the installation, scans the ports of each node in the cluster, and determines whether a node management server exists in the cluster. If it does not exist, the current node is elected as the server node, and the server node is installed and deployed according to the server node installation process. If it exists, the current node is another node, and other nodes are installed and deployed according to the other node installation process.

[0072] This invention enables rapid and automated deployment of Kubernetes clusters. Nodes in the cluster simultaneously start the installation program, and all nodes automatically synchronize their installation progress, automatically forming the cluster and significantly reducing deployment time. Furthermore, when the number of nodes in the cluster changes, the cluster can automatically adjust the roles of each node, reducing the workload of cluster maintenance.

[0073] In the method of this invention, the cluster nodes are divided. The node where the Name Node Management Service is located is called the server node, and the other nodes are called other nodes. The node management client interacts with the server node and can be called the agent node.

[0074] In applications, based on the technical solutions of the present invention, in some embodiments of the present invention, node management is mainly divided into node registration, node data synchronization, node status management and cluster high availability management.

[0075] Node registration involves the following steps: if the current node is a server node, the node management server is started to listen for node registration; if the current node is not a server node, the node management client is started to register the current node with the node management server.

[0076] The node data synchronization process is mainly responsible for synchronizing the basic configuration and related certificates of the cluster.

[0077] Node state management utilizes a state machine, primarily responsible for maintaining the current node's state and reporting it to the node management server. Cluster nodes process different events and undergo state transitions. Each node can have the following states:

[0078] START: The installation program has started.

[0079] CONFIGURED: Configuration read complete;

[0080] PREPARED: System environment variables have been set and configuration read, and software such as kubelet has been installed.

[0081] CP_UP: Kubernetes started successfully, and the current node role is control-plane;

[0082] WK_UP: Kubernetes started successfully, and the current node role is worker;

[0083] HA_UP: The cluster has successfully started in high availability mode, and the current node has been elected or designated as the server node;

[0084] HA_WAIT: The number of nodes in the high-availability cluster has changed, and it is waiting for a new server node to be reassigned a role.

[0085] refer to Figure 2 The state transitions of each node during installation and maintenance are described below:

[0086] START: The first state after a node starts is the START state; if the current node is a server node, it will immediately perform configuration, and after configuration is complete, it will enter the CONFIGURED state; if the current node is an agent node, it will wait for the server state to change to CONFIGURED or a state after CONFIGURED, and then perform synchronization and configuration resolution. After configuration is complete, the current node will enter the CONFIGURED state.

[0087] CONFIGURED: After a node enters the CONFIGURED state, it will enter the PREPARED state after the software installation is complete.

[0088] PREPARED: After a node enters the PREPARED state, if the current node is a server node, Kubernetes will start immediately. After successful startup, it will enter the CP_UP state. If the current node is an agent node, it will check whether the server has entered the CP_UP or HA_UP state. If so, the current node will join the cluster as a worker and enter the WK_UP state. If not, the server status will be checked again periodically.

[0089] CP_UP: If the cluster starts HA, the server node enters the HA_UP state. If the current node is an agent node and the server node has assigned it the role of control-plane, the agent node switches its role to control-plane and enters the CP_UP state. If the current node is an agent node and its state is CP_UP, a server node election will occur when the server node goes offline. If the current node is not elected as the server, it enters the HA_WAIT state.

[0090] Cluster high availability management provides high availability support for the cluster. For example, a virtual IP is generated on a node in the cluster with the role of "control-plane" and configured on the corresponding interface. If the number of nodes in the current cluster is less than 3, the node containing the virtual IP is selected as the control-plane, and the other nodes switch their roles to worker. If the number of nodes in the current cluster is 3 or more, high availability support can be enabled, selecting 3 nodes as control-planes and the node containing the virtual IP as the server node.

[0091] The Kubernetes installation process mainly includes the following functions: Kubernetes configuration management, installation of software such as kubelet and kubectl, installation of container runtime software, installation of software such as helm, installation of network interface (CNI), and installation of charts.

[0092] Further, refer to Figure 3 Based on the aforementioned startup process, the specific steps are as follows:

[0093] S01: Start the installation process on each node of the cluster, and each node of the cluster enters the START state;

[0094] S02: Scan the ports of each node in the cluster to check if a node management server exists in the network where the cluster is located.

[0095] If it does not exist, the current node starts the node management server, elects the current node as the server node, and deploys the server node according to the server node installation process steps S03-S08.

[0096] If it exists, the current node starts the node management client, sends a registration message to the node management server to register the current node, and installs and deploys other nodes according to the other node installation process steps S09-S15.

[0097] The installation and deployment of the server node according to the server node installation process includes:

[0098] S03: The current node is the server node. Configure the server node, and the server node enters the CONFIGURED state.

[0099] S04: The system environment is configured based on the server node. During container runtime, software such as kubelet and kubectl are installed. After the software installation is completed, the server node enters the PREPARRED state.

[0100] S05: Generate a virtual IP address for the server node and configure the virtual IP address on the relevant interface;

[0101] S06: Start the Kubernetes cluster; server nodes enter the CP_UP state.

[0102] Determine if the number of nodes in the cluster is greater than or equal to 3. If so, start the cluster high availability mode and the server node enters the HA_UP state.

[0103] S07: Install network interface;

[0104] S08: Deploy the application.

[0105] The installation and deployment of other nodes according to the other node installation process includes:

[0106] S09: When the current node is another node, periodically synchronize the server node's state until the server node's state is CONFIGURED or a state after CONFIGURED. Then, other nodes synchronize the server node's configuration file to their local machine.

[0107] S10: Use other nodes to parse the configuration file, complete the configuration, and other nodes enter the CONFIGURED state;

[0108] S11: Configure the system environment according to other nodes, install software such as kubelet and kubectl for container runtime, and after the software installation is completed, other nodes enter PREPARRED state;

[0109] S12: Periodically synchronize the state of the server node until the state of the server node is CP_UP and then proceed to S5;

[0110] S13: Synchronize certificates of other nodes;

[0111] S14: Send role requests to the server node based on other nodes;

[0112] S15: Get the role request result. If the role request result is worker, then other nodes join the cluster as workers and enter the WK_UP state.

[0113] If the role request result is control-plane, then other nodes join the cluster as control-plane and enter the CP_UP state.

[0114] The method of this invention records the installation progress by setting different states in the installation process of each node and synchronizing the states through the node management program. Different data synchronization is performed in different states, which solves the problems of configuration and certificate dependencies and the order in which nodes join the cluster. It reduces manual judgment and operation and achieves the purpose of rapid installation and deployment.

[0115] The present invention also provides an apparatus for automatic deployment of a Kubernetes cluster, comprising: a node management module and a Kubernetes installation module;

[0116] The node management module is responsible for node registration, node data synchronization, node status management, and cluster high availability management. The module elects a server node, which acts as the node management server, and other nodes act as node management clients. Other nodes register with the server node by sending registration messages through the node management module. Node data synchronization is achieved based on the registration. A state machine is used for node status management. Based on the number of nodes in the cluster and the elected server node, a cluster high availability mode is deployed for cluster high availability management.

[0117] The Kubernetes installation module is responsible for the startup process, the server node installation process, and the installation process for other nodes. The Kubernetes installation module executes the startup process to start the installation, scans the ports of each node in the cluster, and determines whether a node management server exists in the cluster. If it does not exist, it elects the current node as the server node and installs and deploys the server node according to the server node installation process. If it exists, the current node is another node, and the other nodes are installed and deployed according to the other node installation process.

[0118] The information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the method embodiment of the present invention, and the specific details can be found in the description of the method embodiment of the present invention, and will not be repeated here.

[0119] Similarly, the device of this invention can quickly and automatically deploy a Kubernetes cluster. Nodes in the cluster simultaneously start the installation program, and all nodes automatically synchronize their installation progress, automatically forming the cluster, greatly shortening the cluster deployment time. Furthermore, when the number of nodes in the cluster changes, the cluster can automatically adjust the roles of each node, reducing the workload of cluster maintenance.

[0120] It should be noted that not all steps and modules in the above processes and device structures are mandatory; some steps or modules may be omitted as needed. The execution order of each step is not fixed and can be adjusted as required. The system structure described in the above embodiments can be a physical structure or a logical structure. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or they may be jointly implemented by certain components in multiple independent devices.

[0121] The above-described embodiments are merely preferred embodiments provided to fully illustrate the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention. The scope of protection of the present invention is defined by the claims.

Claims

1. A method for automatic deployment of a Kubernetes cluster, characterized by: The deployment method includes: node management and Kubernetes installation; The node management includes node registration, node data synchronization, node status management, and cluster high availability management. The node management elects a server node, which serves as the node management server. Other nodes serve as node management clients. Other nodes send registration messages to the server node to register. Node data synchronization is achieved based on node registration. A state machine is used for node status management. Cluster high availability management is achieved by deploying a cluster high availability mode based on the number of cluster nodes and the server node election. The Kubernetes installation includes a startup process, a server node installation process, and other node installation processes. The startup process initiates the installation, scans the ports of each node in the cluster to determine if a node management server exists. If not, the current node is elected as the server node, and the server node is installed and deployed according to the server node installation process. If the server node exists, the current node becomes another node, and the other nodes are installed and deployed according to the other node installation process. The process of installing and deploying the server node according to the described server node installation procedure includes: setting the current node as the server node, configuring the server node, and having the server node enter the CONFIGURED state. The server node begins configuring the system environment, installs the container runtime software, and after the software installation is complete, the server node enters the PREPARRED state. The process of installing and deploying other nodes according to the installation procedure for other nodes includes: if the current node is another node, periodically synchronizing the status of the server node until the server node's status is CONFIGURED or a status after CONFIGURED; and synchronizing the server node's configuration file to the local machine on other nodes. The configuration is completed by parsing the configuration file using other nodes, and the other nodes then enter the CONFIGURED state.

2. The method for automatic deployment of a Kubernetes cluster according to claim 1, characterized in that: The startup process consists of the following steps: S1: Start the installation process on each node of the cluster, and each node of the cluster enters the START state; S2: Scan the ports of each node in the cluster to check if a node management server exists in the network where the cluster is located. If it does not exist, the current node starts the node management server, elects the current node as the server node, and installs and deploys the server node according to the server node installation process described above. If it exists, the current node starts the node management client, sends a registration message to the node management server to register the current node, and installs and deploys other nodes according to the other node installation process.

3. A method for automatic deployment of a Kubernetes cluster according to claim 1 or 2, characterized in that: The installation and deployment of the server node according to the server node installation process includes: S1: The current node is the server node. Configure the server node, and the server node enters the CONFIGURED state. S2: The system environment is configured based on the server node, the container runtime software is installed, the software installation is completed, and the server node enters the PREPARRED state. S3: Generate a virtual IP address for the server node and configure the virtual IP address on the relevant interface; S4: Start the Kubernetes cluster; the server nodes enter the CP_UP state. Determine if the number of nodes in the cluster is greater than or equal to 3. If so, start the cluster high availability mode and the server node enters the HA_UP state. S5: Install network interface; S6: Deploy applications.

4. The method for automatic deployment of a Kubernetes cluster according to claim 3, characterized in that: In S4, if the server node enters the HA_UP state, it assigns control-plane roles to other nodes, and the other nodes enter the CP_UP state. When the server node goes offline, a server node election is performed. If the current node is not elected, it enters the HA_WAIT state.

5. A method for automatic deployment of a Kubernetes cluster according to claim 1 or 2, characterized in that: The installation and deployment of other nodes according to the other node installation process includes: S1: If the current node is another node, periodically synchronize the state of the server node until the server node's state is CONFIGURED or a state after CONFIGURED. Then, other nodes synchronize the server node's configuration file to their local machine. S2: Use other nodes to parse the configuration file, complete the configuration, and other nodes enter the CONFIGURED state; S3: Configure the system environment based on other nodes, install the software during container runtime, and after the software installation is completed, other nodes enter the PREPARRED state; S4: Periodically synchronize the state of the server node until the state of the server node is CP_UP and then proceed to S5; S5: Synchronize certificates from other nodes; S6: Send role requests to the server node based on other nodes; S7: Get the role request result. If the role request result is worker, then other nodes join the cluster as workers and enter the WK_UP state. If the role request result is control-plane, then other nodes join the cluster as control-plane and enter the CP_UP state.

6. An apparatus for automatically deploying a Kubernetes cluster, characterized in that: include: Node management module and Kubernetes installation module; The node management module is responsible for node registration, node data synchronization, node status management, and cluster high availability management. The module elects a server node, which acts as the node management server, and other nodes act as node management clients. Other nodes register with the server node by sending registration messages through the node management module. Node data synchronization is achieved based on the registration. A state machine is used for node status management. Based on the number of nodes in the cluster and the elected server node, a cluster high availability mode is deployed for cluster high availability management. The Kubernetes installation module is responsible for the startup process, the server node installation process, and the installation processes for other nodes. The module executes the startup process to begin installation, scans the ports of each node in the cluster, and determines whether a node management server exists. If not, it elects the current node as the server node and installs and deploys it according to the server node installation process. If the server node exists, it becomes another node and installs and deploys the other nodes according to their respective installation processes. The Kubernetes installation module installs and deploys the server node according to the server node installation process, including: setting the current node as the server node, configuring the server node, and the server node entering the CONFIGURED state. The server node begins configuring the system environment, installs the container runtime software, and after the software installation is complete, the server node enters the PREPARRED state. The Kubernetes installation module installs and deploys other nodes according to the installation process for other nodes, including: when the current node is another node, periodically synchronizing the state of the server node until the server node's state is CONFIGURED or a state after CONFIGURED, and synchronizing the server node's configuration files to the local machine on other nodes. The configuration is completed by parsing the configuration file using other nodes, and the other nodes then enter the CONFIGURED state.

7. The apparatus for automatic deployment of a Kubernetes cluster according to claim 6, characterized in that: The Kubernetes installation module executes the startup process, and the specific steps are as follows: S1: Start the installation process on each node of the cluster, and each node of the cluster enters the START state; S2: Scan the ports of each node in the cluster to check if a node management server exists in the network where the cluster is located. If it does not exist, the current node starts the node management server, elects the current node as the server node, and installs and deploys the server node according to the server node installation process described above. If it exists, the current node starts the node management client, sends a registration message to the node management server to register the current node, and installs and deploys other nodes according to the other node installation process.

8. An apparatus for automatic deployment of a Kubernetes cluster according to claim 6 or 7, characterized in that: The Kubernetes installation module installs and deploys the server node according to the server node installation process, including: S1: The current node is the server node. Configure the server node, and the server node enters the CONFIGURED state. S2: The system environment is configured based on the server node, the container runtime software is installed, the software installation is completed, and the server node enters the PREPARRED state. S3: Generate a virtual IP address for the server node and configure the virtual IP address on the relevant interface; S4: Start the Kubernetes cluster; the server nodes enter the CP_UP state. Determine if the number of nodes in the cluster is greater than or equal to 3. If so, start the cluster high availability mode and the server node enters the HA_UP state. S5: Install network interface; S6: Deploy applications.

9. The apparatus for automatic deployment of a Kubernetes cluster according to claim 8, characterized in that: In S4, if the server node enters the HA_UP state, it assigns control-plane roles to other nodes, and the other nodes enter the CP_UP state. When the server node goes offline, a server node election is performed. If the current node is not elected, it enters the HA_WAIT state.

10. An apparatus for automatically deploying a Kubernetes cluster according to claim 6 or 7, characterized in that: The Kubernetes installation module installs and deploys other nodes according to the other node installation process, including: S1: If the current node is another node, periodically synchronize the state of the server node until the server node's state is CONFIGURED or a state after CONFIGURED. Then, other nodes synchronize the server node's configuration file to their local machine. S2: Use other nodes to parse the configuration file, complete the configuration, and other nodes enter the CONFIGURED state; S3: Configure the system environment based on other nodes, install the software during container runtime, and after the software installation is completed, other nodes enter the PREPARRED state; S4: Periodically synchronize the state of the server node until the state of the server node is CP_UP and then proceed to S5; S5: Synchronize certificates from other nodes; S6: Send role requests to the server node based on other nodes; S7: Get the role request result. If the role request result is worker, then other nodes join the cluster as workers and enter the WK_UP state. If the role request result is control-plane, then other nodes join the cluster as control-plane and enter the CP_UP state.

Citation Information

Patent Citations

  • Method for automatically setting up Kubernetes master node based on Ansible tool, and terminal device

    CN108694053A

  • High-performance cluster management method based on Slurm

    CN110177020A