A single-cluster initialization method based on kubelet startup parameter dynamic configuration
By using a dynamic configuration method based on kubelet startup parameters, the system automatically detects and adjusts kubelet parameters, solving the initialization problem of Kubernetes clusters with multiple architectures and vendors, and achieving efficient and secure cluster initialization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-14
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies cannot efficiently and securely automate the initialization of Kubernetes clusters on servers with multiple architectures and vendors, and require manual adjustment of kubelet configuration, resulting in low efficiency and security risks.
This paper provides a single-cluster initialization method based on dynamic configuration of kubelet startup parameters. It automatically detects server connectivity through cluster initialization metadata, parses and dynamically adjusts kubelet startup parameters to adapt to servers with different architectures and models.
It enables automated cluster initialization on servers with multiple architectures and vendors, improving efficiency and security, reducing human intervention, and enhancing the standardization and stability of the cluster.
Smart Images

Figure CN115469970B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cluster initialization, in particular to a single cluster initialization method based on dynamic configuration of kubelet startup parameters. BACKGROUND
[0002] Cluster initialization is to configure the server according to the demand, including host configuration, firewall configuration, disabling SELINUX, configuring yum source and other operations, and at the same time installing kubelet, kubeadm and docker on the server. Its function is to add all servers to the kubernetes cluster for unified management and scheduling.
[0003] At present, in order to ensure the normal initialization of the cluster, the servers of the same architecture are generally selected during the initialization of the cluster, and then a unified configuration file is used during the initialization of the cluster. With the promotion of China's information creation, the market share of domestic equipment is gradually increasing, and the kubernetes cluster must face the application requirements of adapting to different devices of various manufacturers. At the same time, the scenario of running a large number of customers, multi-architecture, multi-manufacturer, and multi-model devices in the same cluster is increasing, and the existing technology cannot meet the market application requirements. In actual application scenarios, for different models of servers of the same architecture and servers carrying different businesses, the kubelet configuration of each server node needs to be manually adjusted, which is not efficient and has a large security risk, and the standardization and stability of the cluster adaptation project need to be improved.
[0004] Therefore, how to provide a kubernetes cluster initialization method that improves efficiency while improving standardization and stability has become a technical problem to be solved. SUMMARY
[0005] Therefore, in order to overcome the shortcomings of the prior art, the present application mainly solves the problem of automatically completing the initialization in a kubernetes cluster where arm and X86 architectures exist at the same time and the servers of each architecture may be different models of servers of different manufacturers. It also solves the problem of manually differentiating kubelet startup parameters due to different businesses carried by the servers.
[0006] On the one hand, the present application provides a single cluster initialization method based on dynamic configuration of kubelet startup parameters, comprising:
[0007] Step S1: planning the cluster according to user demand, creating cluster initialization metadata;
[0008] Step S2: triggering cluster initialization according to the default cluster initialization strategy or the adjusted cluster initialization strategy using the cluster initialization metadata;
[0009] Step S3: detecting the connectivity of the server of the cluster initialization metadata;
[0010] Step S4: parsing the detected cluster initialization metadata, starting the kubelet according to the cluster initialization strategy, and completing the cluster initialization.
[0011] Further, in step S1 of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameter, the initialization metadata is a cluster planning table, the cluster planning table includes cluster basic information and server information that needs to join the cluster, and the server information includes: server name, server IP address, server architecture, server load service type, server management user and management user corresponding password.
[0012] Further, step S2 of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameter includes:
[0013] The default cluster initialization strategy or the adjusted cluster initialization strategy triggers the cluster initialization on the cluster-init service page.
[0014] The cluster-init service obtains the values of the server name, server IP address, server management user and management user corresponding password by parsing the cluster initialization metadata.
[0015] Further, in step S2 of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameter, the adjusted cluster initialization strategy is obtained by defining a data structure and each attribute in the data structure.
[0016] Further, step S3 of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameter includes: detecting whether the network between the server where the cluster-init service is located and all servers in the planning table is reachable and detecting whether the server can be logged in using the management user and the management user corresponding password in the cluster planning table.
[0017] Further, step S3 of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameter includes:
[0018] When the server of the cluster initialization metadata fails the connectivity detection, check the adjusted cluster initialization metadata.
[0019] When the server of the cluster initialization metadata passes the connectivity detection, parse the cluster initialization metadata to obtain the values of the server architecture and the server load service type.
[0020] Further, the step S4 of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameter of the application comprises: when triggering cluster initialization by using a default cluster initialization strategy, selecting a corresponding installation template according to the value of the server bearing service type, and copying the file of the corresponding architecture to the server according to the value of the server architecture.
[0021] Further, the step S4 of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameter of the application comprises: when triggering cluster initialization by using an adjusted cluster initialization strategy, adjusting the cluster initialization configuration according to the adjusted cluster initialization strategy.
[0022] Further, the step S4 of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameter of the application comprises: issuing a kubelet startup command through cluster-init, checking the kubelet state of all servers and detecting whether all servers are included in the cluster in the kubelet self-starting process through cluster-init, and completing cluster initialization when the state of kubelet on all servers is active.
[0023] Finally, the application further provides a terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method when executing the program.
[0024] The single cluster initialization method based on the dynamic configuration of the kubelet startup parameter of the application has the following beneficial effects:
[0025] 1. Selecting the corresponding kubelet binary file according to the architecture of the server can realize the coexistence of servers with multiple architectures in one cluster and automatic cluster initialization.
[0026] 2. Combining the adjustable cluster initialization strategy function, automatically adapting different models of servers with the same architecture.
[0027] 3. Combining the adjustable cluster initialization strategy function, dynamically adjusting the kubelet startup parameter of each server according to the planning attribute of the server.
[0028] 4. The cluster-init service realizes dynamic automatic adjustment of configuration through cluster initialization strategy analysis, without human intervention, and improves the convenience of delivery.
[0029] 5. Converting requirements into strategies and saving them to the database improves the maintainability of products and supports mixed architecture deployment. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. Obviously, the drawings described below only some of the embodiments of the present application, and for those skilled in the art, on the premise of not creating labor, can also obtain other drawings from these drawings.
[0031] Figure 1 The flow chart of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameters for the exemplary first embodiment of the present application.
[0032] Figure 2 The flow chart of the single cluster initialization method based on the dynamic configuration of the kubelet startup parameters for the exemplary fifth embodiment of the present application. DETAILED DESCRIPTION
[0033] The embodiments of the present application will be described in detail below with reference to the drawings.
[0034] It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict; and based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creating labor fall within the scope of the present disclosure.
[0035] It should be noted that the various aspects of the embodiments described below are within the scope of the appended claims. It should be apparent that the aspects described herein can be embodied in a wide variety of forms and that any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, one skilled in the art should appreciate that one aspect described herein can be implemented independently of any other aspects and that two or more of these aspects can be combined in various ways. For example, an apparatus can be implemented and / or a method can be practiced using any number of the aspects set forth herein. In addition, such an apparatus can be implemented and / or this method can be practiced using other structure and / or functionality in addition to or other than one or more of the aspects set forth herein.
[0036] The following explanations of the terms involved in each of the embodiments are as follows:
[0037] Kubelet, cluster management component, used to manage other services running on each server in the cluster.
[0038] cluster-init, cluster initialization service component, used to parse cluster planning data, cluster initialization strategy and issue initialization configuration when initializing the cluster.
[0039] Figure 1As shown in the flowchart of a single cluster initialization method based on dynamic configuration of kubelet startup parameters according to an exemplary first embodiment of the present application, Figure 1 The method of the present embodiment includes:
[0040] Step S1: Plan a cluster according to user requirements and create cluster initialization metadata.
[0041] Step S2: Trigger cluster initialization according to the default cluster initialization strategy or the adjusted cluster initialization strategy using the cluster initialization metadata.
[0042] Step S3: Detect the connectivity of the server of the cluster initialization metadata.
[0043] Step S4: Parse the detected cluster initialization metadata, start kubelet according to the cluster initialization strategy, and complete cluster initialization.
[0044] In step S1 of the single cluster initialization method based on dynamic configuration of kubelet startup parameters of the present embodiment, the initialization metadata is a cluster planning table, which includes cluster basic information and server information that needs to join the cluster, and the server information includes server name, server IP address, server architecture, server load service type, server management user, and management user corresponding password.
[0045] The exemplary second embodiment of the present application provides a single cluster initialization method based on dynamic configuration of kubelet startup parameters. Figure 1 As shown in the preferred embodiment of the method of the present embodiment, step S2 of the method of the present embodiment includes:
[0046] Trigger cluster initialization on the cluster-init service page using the default cluster initialization strategy or the adjusted cluster initialization strategy.
[0047] The cluster-init service obtains the values of the server name, server IP address, server management user, and management user corresponding password by parsing the cluster initialization metadata.
[0048] In actual application, in step S2 of the method of the present embodiment, the adjusted cluster initialization strategy is obtained by defining a data structure and each attribute in the data structure.
[0049] The exemplary third embodiment of the present application provides a single cluster initialization method based on dynamic configuration of kubelet startup parameters. Figure 1In a preferred embodiment of the method shown, step S3 of this embodiment includes: detecting whether the network is reachable between the server where the cluster-init service is located and all servers in the planning table, and detecting whether the management user corresponding to the server in the cluster planning table and the password corresponding to the management user can log in to the server.
[0050] Step S3 of the method in this embodiment includes:
[0051] If the server that initializes the cluster metadata fails the connectivity test, check and adjust the cluster initialization metadata.
[0052] When the server that initializes the cluster metadata passes the connectivity test, it parses the cluster initialization metadata and obtains the values of the server architecture and the type of business the server supports.
[0053] The fourth exemplary embodiment of the present invention provides a single cluster initialization method based on dynamic configuration of kubelet startup parameters. This embodiment is... Figure 1 A preferred embodiment of the method shown.
[0054] Step S4 of the method in this embodiment includes: when cluster initialization is triggered by the default cluster initialization strategy, selecting the corresponding installation template according to the value of the service type carried by the server, and copying the corresponding architecture files to the server according to the value of the server architecture.
[0055] Step S4 of the method in this embodiment includes: when cluster initialization is triggered by an adjusted cluster initialization strategy, adjusting the cluster initialization configuration according to the adjusted cluster initialization strategy.
[0056] Step S4 of the method in this embodiment includes: issuing a kubelet startup command through cluster-init; during the kubelet startup process, checking the kubelet status of all servers and detecting whether all servers are included in the cluster through cluster-init; and completing cluster initialization when the kubelet status on all servers is active.
[0057] Figure 2 This is a flowchart illustrating a single-cluster initialization method based on dynamic configuration of kubelet startup parameters, as exemplarily described in the fifth embodiment of the present invention. This embodiment is... Figure 1 A preferred embodiment of the method shown.
[0058] In this embodiment, before cluster initialization, delivery personnel can plan the cluster according to customer needs. The main output of the planning is a cluster planning table, which includes basic cluster information and information on servers to be added to the cluster. The server information has the following structure:
[0059]
[0060]
[0061] On the deployment service page, import the cluster planning table into the system as cluster initialization metadata. After the cluster initialization data is successfully imported, the deployment service page displays the version's preset cluster initialization strategy. Users can choose the default cluster initialization strategy according to their actual needs, or adjust the strategy on the cluster-init service page according to the rules, and then execute cluster initialization.
[0062] In this embodiment, the default cluster initialization strategy is the version default cluster initialization strategy. When the default cluster initialization strategy is selected for cluster initialization, its parsing logic and startup parameter settings are as follows:
[0063] Delivery personnel can trigger cluster initialization directly on the cluster-init page without modifying the cluster initialization strategy.
[0064] The cluster-init service parses the cluster planning table imported by the operator to obtain the hostname, hostip, user, and passwd values. It then checks the connectivity of the servers, including network reachability between the server hosting the cluster-init service and all servers in the planning table, and whether the administrator user and password for each server in the planning table can be used to log in. The specific commands for performing these checks are "ping {hostip}" and "sshpass -p {passwd} ssh {user}@{hostip}", where the hostip, user, and passwd values are replaced with their actual values. If a server in the cluster planning table fails the connectivity test, the personnel in charge need to adjust the data in the cluster planning table accordingly. Once the connectivity tests for all servers in the cluster planning table are passed, the next processing step begins.
[0065] Since the cluster initialization strategy remains unchanged, the internal logic of cluster-init is maintained during strategy matching. First, based on the value of business_type (the default values for business_type are OM, IaaS, Network, DB, and Security), the corresponding installation template is selected. Based on the value of arch (the current arch values are amd64 and arm64), the corresponding architecture files are copied to the server. When the arch value is amd64, the cluster-init service copies the corresponding x86 architecture files to the server; if the arch value is arm64, the cluster-init service copies the corresponding arm architecture files to the server. In this embodiment, the copied files are the kubelet binary and the containerd binary.
[0066] After the above logic is executed, the kubelet startup parameters are prepared. Because no adjustments to the kubelet startup parameters are needed under the default initialization strategy, the default configuration is used for startup. The kubelet startup configuration is as follows:
[0067] Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig= / etc / kubernetes / bootstrap-kubelet.conf--kubeconfig= / etc / kubernetes / kubelet.conf"
[0068] Environment="KUBELET_CONFIG_ARGS=--config= / var / lib / kubelet / config.yaml"
[0069] EnvironmentFile=- / var / lib / kubelet / kubeadm-flags.env
[0070] EnvironmentFile=- / etc / sysconfig / kubelet
[0071] ExecStart= / usr / bin / kubelet\$KUBELET_KUBECONFIG_ARGS\$KUBELET_CONFIG_AR GS--node-ip=%v--v=2--topology-manager-policy=best-effort--cpu-manager-policy=static EOF
[0072] Cluster-init issues the kubelet startup command, and each server starts its kubelet automatically. During the kubelet startup process, cluster-init checks the kubelet status of all servers and checks whether all servers have been included in the cluster. When the kubelet status on all servers is active, the cluster initialization process ends.
[0073] In this embodiment, when the adjusted cluster initialization strategy is selected for cluster initialization, the parsing logic and startup parameter settings are as follows:
[0074] On the cluster-init page, enter the initialization strategy as described. After the delivery personnel adjust the cluster initialization strategy, they can directly trigger cluster initialization on the cluster-init page.
[0075] The cluster-init service parses the cluster planning table imported by the operator to obtain the hostname, hostip, user, and passwd values. It then checks the connectivity of the servers, including network reachability between the server hosting the cluster-init service and all servers in the planning table, and whether the administrator user and password for each server in the planning table can be used to log in. The specific commands for performing these checks are "ping {hostip}" and "sshpass -p {passwd} ssh {user}@{hostip}", where the hostip, user, and passwd values are replaced with their actual values. If a server in the cluster planning table fails the connectivity test, the personnel in charge need to adjust the data in the cluster planning table accordingly. Once the connectivity tests for all servers in the cluster planning table are passed, the next processing step begins.
[0076] Specifically, in this embodiment, the delivery personnel define the strategy as follows:
[0077]
[0078] Wherein, source_key is the key for policy parsing; source_from is the source corresponding to source_key, which can come from the cluster planning table or be obtained by executing commands on the server; source_val is the value corresponding to source_key, which can be a fixed value, the result obtained by executing commands on the server, or data parsing from the planning table; expression is the expression for policy parsing; target_obj is the object on which this policy applies; and target_env is the final adjustment item based on the value of expression.
[0079] When the numa_node value is greater than or equal to 8, the kubelet startup parameter "--cpu-manager-policy=none" is added. The known numa_node value for dual-socket Phytium 2500 servers is 16. Because kubelet will fail to start when the numa_node value is greater than or equal to 8, this strategy can solve the problem of kubelet failing to start.
[0080] The cluster-init service obtains the server's numanode value by executing the command ("numactl -H") on the server and assigns the obtained value to numa_node. It parses the value according to the expression numa_node>=8. If the value of numa_node is greater than or equal to 8, it adjusts the kubelet parameters by adding the --cpu-manager-policy=none configuration. When this configuration is added, kubelet will not listen to numa nodes when it starts.
[0081] Specifically, in this embodiment, the delivery personnel define the strategy as follows:
[0082]
[0083] Wherein, source_key is the key for policy parsing; source_from is the source corresponding to source_key, which can come from the cluster planning table or be obtained by executing commands on the server; source_val is the value corresponding to source_key, which can be a fixed value, the result obtained by executing commands on the server, or data parsing from the planning table; expression is the expression for policy parsing; target_obj is the object on which this policy applies; and target_env is the final adjustment item based on the value of expression.
[0084] When -kube-reserved is not set, the default values for kubelet are cpu=200m, memory=500Mi, storage=1Gi.
[0085] The cluster-init service obtains the business_type value of each server by parsing the data in the data planning table. If the business_type value is equal to OM, the kubelet parameters are adjusted to add the configuration -kube-reserved=pu=500m,memory=1Gi,storage=2Gi. When the business_type value is equal to OM, it indicates that the server is a management server. To ensure the stability of the management server, the server resource reservation is increased relative to other servers.
[0086] Finally, the present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method.
[0087] This terminal device has the same technical effects as the single cluster initialization method described above, which is based on dynamic configuration of kubelet startup parameters.
[0088] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A single-cluster initialization method based on dynamic configuration of kubelet startup parameters, characterized in that, The method includes: Step S1: Plan the cluster according to user needs and create cluster initialization metadata; wherein, the initialization metadata is a cluster planning table, which includes basic cluster information and server information to be added to the cluster. The server information includes: server name, server IP address, server architecture, server service type, server management user, and the password corresponding to the management user. Step S2: Cluster initialization is triggered based on the default or adjusted cluster initialization policy using cluster initialization metadata. When the default cluster initialization policy is selected, the parsing logic and startup parameter settings are as follows: The `cluster-init` service parses the cluster planning table imported by the operator. Since the cluster initialization policy remains unchanged, the internal logic of `cluster-init` is maintained. Based on the value of `business_type` (the server's business type), the corresponding installation template is selected. Based on the value of `arch` (the server's architecture), the corresponding architecture file is copied to the server. Under the default initialization policy, no adjustment to the kubelet startup parameters is required; the default configuration is used for startup. When an adjusted cluster initialization policy is selected, the parsing logic and startup parameter settings are as follows: The `cluster-init` service parses the cluster planning table imported by the operator. The `cluster-init` service obtains the server's `numanode` value by executing a command on the server and assigns the obtained value to `numa_node`. If the value of `numa_node` is greater than or equal to 8, the kubelet parameters are adjusted, adding `--cpu-manager-policy=none`. Configuration; The cluster-init service obtains the business type (business_type) value of each server by parsing the data in the data planning table. If the business_type value is equal to OM, the kubelet parameters are adjusted. When the business_type value is equal to OM, it indicates that the server is a management server. To ensure the stability of the management server, the server resource reservation is increased relative to other servers. Step S3: Check the connectivity of the server that initializes the cluster metadata; Step S4: Parse the detected cluster initialization metadata, start the kubelet according to the default cluster initialization strategy or the adjusted cluster initialization strategy, and complete the cluster initialization.
2. The single cluster initialization method based on dynamic configuration of kubelet startup parameters according to claim 1, characterized in that, Step S2 includes: Cluster initialization is triggered on the cluster-init service page using the default cluster initialization strategy or the adjusted cluster initialization strategy; The cluster-init service obtains the server name, server IP address, server management user, and the corresponding password of the management user by parsing the cluster initialization metadata.
3. The single cluster initialization method based on dynamic configuration of kubelet startup parameters according to claim 1, characterized in that, In step S2, the adjusted cluster initialization strategy is obtained by defining the data structure and the representation of each attribute in the data structure.
4. The single cluster initialization method based on dynamic configuration of kubelet startup parameters according to claim 1, characterized in that, Step S3 includes: detecting whether the network is reachable between the server where the cluster-init service is located and all servers in the planning table, and detecting whether the management user and the password corresponding to the management user of the server in the cluster planning table can log in to the server.
5. The single cluster initialization method based on dynamic configuration of kubelet startup parameters according to claim 1, characterized in that, Step S3 includes: If the server that initializes the cluster metadata fails the connectivity test, check and adjust the cluster initialization metadata. When the server that initializes the cluster metadata passes the connectivity test, it parses the cluster initialization metadata and obtains the values of the server architecture and the type of business the server supports.
6. The single cluster initialization method based on dynamic configuration of kubelet startup parameters according to claim 1, characterized in that, Step S4 includes: when cluster initialization is triggered using the default cluster initialization strategy, selecting the corresponding installation template based on the value of the service type carried by the server, and copying the corresponding architecture files to the server based on the value of the server architecture.
7. The single cluster initialization method based on dynamic configuration of kubelet startup parameters according to claim 1, characterized in that, Step S4 includes: when cluster initialization is triggered using an adjusted cluster initialization strategy, adjusting the cluster initialization configuration according to the adjusted cluster initialization strategy.
8. The single cluster initialization method based on dynamic configuration of kubelet startup parameters according to claim 1, characterized in that, Step S4 includes: issuing a kubelet startup command through cluster-init; during the kubelet startup process, checking the kubelet status of all servers and detecting whether all servers are included in the cluster through cluster-init; and completing cluster initialization when the kubelet status on all servers is active.
9. A terminal device, characterized in that, The terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method according to any one of claims 1-8.
Citation Information
Patent Citations
Method and system for guaranteeing cloud computing server cluster network
CN103747059A
Cluster deployment method and device, terminal equipment and storage medium
CN111782232A