A Kubernetes multi-cluster management method, device, equipment, and storage medium
By deploying preset agents in Kubernetes clusters to collect and manage multi-cluster information, the problems of complexity, instability and inconsistency of multi-cluster management in the existing technology are solved, and efficient, simple and consistent multi-cluster management is achieved.
Patent Information
- Application Number
- CN202211027099.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-25
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2042-08-25
AI Technical Summary
The existing technology has complexity, instability and inconsistency in multi-Kubernetes cluster management, which leads to high operation and maintenance difficulties, high learning costs, and inconsistent storage information, which can easily lead to management failure.
By deploying preset agents outside the main management cluster, using this agent to call test cases to collect cluster information, and implementing management of multiple clusters by returning information, avoiding the extension of the Kubernetes API and simplifying the configuration and deployment process.
It realizes efficient communication and management between clusters, reduces the complexity and instability of multi-cluster management, improves management consistency and ease of use, and reduces learning costs and operation and maintenance difficulties.
Smart Images

Figure CN115396441B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cluster management, and in particular to a Kubernetes multi-cluster management method, device, equipment, and storage medium. Background Art
[0002] Whether it is a private cloud or a public cloud, there will be a large number of K8S (Kubernetes) clusters that need to be managed. These clusters do not have a unified management platform, which greatly increases the difficulty of operation and maintenance. Each cluster has differences, different network plug-ins, different K8S versions, and even clusters that do secondary development of K8S components. This is because existing solutions such as KubeFederation need to expand the K8S API (Application Program Interface) when implementing multi-cluster management. Modifying the original K8S API requires modifying multiple configurations, and the deployment is extremely complex and cumbersome. For people who are not familiar with KubeFederation, the learning cost is extremely high. In addition, the storage information is stored in each etcd through K8S's CRD, and these cluster information, authentication information, and user information are different for each cluster. This storage method is prone to information inconsistency, which ultimately leads to problems in multi-cluster management. The existing patent CN202111462252.2 mentions unified management of multiple Kubernetes clusters through a custom declarative API. This approach will make the entire K8S API too bloated, requiring the writing and generation of a large number of CRDs. When problems occur with CRDs, the entire cluster can easily crash and become unusable. The existing patent CN202111018688.2 uses a cluster management scheduling module to manage multiple clusters, which requires the development of a separate registration and management scheduling module.
[0003] In summary, how to improve the efficiency of inter-cluster communication and management, avoid the problems of overly complex, unstable and inconsistent cluster management, and achieve simple, efficient and consistent multi-cluster management is a technical problem to be solved in this field. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a Kubernetes multi-cluster management method, device, equipment, and storage medium, which can improve the efficiency of inter-cluster communication and management, avoid the problems of overly complex, unstable, and inconsistent cluster management, and achieve simple, efficient, and consistent multi-cluster management. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a Kubernetes multi-cluster management method, which is applied to a main management cluster, including:
[0006] Deploy a preset agent program for other Kubernetes clusters outside the master management cluster to obtain a slave management cluster;
[0007] Sending a management instruction to the slave management cluster so that the preset agent program calls a corresponding test case to collect cluster information of the slave management cluster and generates corresponding feedback information;
[0008] The feedback information is received to implement management of multiple Kubernetes clusters.
[0009] Optionally, before deploying the preset agent program for other Kubernetes clusters outside the main management cluster, the method further includes:
[0010] Deploy the preset master program for the Kubernetes cluster to obtain the main management cluster.
[0011] Optionally, the step of deploying a preset master program on the Kubernetes cluster to obtain a main management cluster includes:
[0012] The configuration information of the Kubernetes cluster is modified, and the preset master program is deployed through the yaml file to obtain the main management cluster.
[0013] Optionally, before deploying the preset agent program for other Kubernetes clusters outside the main management cluster, the method further includes:
[0014] The preset agent program is encapsulated with a communication protocol.
[0015] Optionally, the receiving the feedback information to implement management of multiple Kubernetes clusters includes:
[0016] Add the cluster information of the slave management cluster in advance through a graphical interface;
[0017] Enter the cluster's kubeconfig through the preset program interface to display the corresponding return information to manage multiple Kubernetes clusters.
[0018] Optionally, after receiving the feedback information to implement management of multiple Kubernetes clusters, the method further includes:
[0019] The target information in the returned information is saved in a local database based on user needs.
[0020] In a second aspect, the present application discloses a Kubernetes multi-cluster management method, which is applied to a slave management cluster, including:
[0021] Receive the management instruction sent by the main management cluster, use the preset agent program pre-deployed by the main management cluster for the slave management cluster to call the corresponding test case to collect the cluster information of the slave management cluster, and generate corresponding feedback information;
[0022] The feedback information is sent to the main management cluster so that the main management cluster can manage multiple Kubernetes clusters.
[0023] In a third aspect, the present application discloses a Kubernetes multi-cluster management device, which is applied to a main management cluster, including:
[0024] A program deployment module, used to deploy a preset agent program for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster;
[0025] An information collection module, used for sending management instructions to the slave management cluster, so that the preset agent program calls the corresponding test case to collect cluster information of the slave management cluster and generates corresponding feedback information;
[0026] The information receiving module is used to receive the feedback information to achieve the management of Kubernetes multiple clusters.
[0027] In a fourth aspect, the present application discloses an electronic device, including:
[0028] Memory, used to store computer programs;
[0029] A processor is used to execute the computer program to implement the steps of the aforementioned disclosed Kubernetes multi-cluster management method.
[0030] In a fifth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed Kubernetes multi-cluster management method are implemented.
[0031] It can be seen that the present application discloses a Kubernetes multi-cluster management method, which is applied to the main management cluster, including: deploying preset agents for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster; sending management instructions to the slave management cluster so that the preset agent calls the corresponding test case to collect the cluster information of the slave management cluster and generates corresponding feedback information; receiving the feedback information to achieve the management of Kubernetes multi-cluster. It can be seen that the present application manages Kubernetes clusters by deploying preset agents. The main management cluster directly issues instructions to the preset agent. Use the preset agent to directly access the K8S Apiserver, and then use the API to control each cluster, collect data or control the cluster to achieve the management of Kubernetes multi-cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0033] Figure 1 A flow chart of a Kubernetes multi-cluster management method disclosed in this application;
[0034] Figure 2 A flow chart of a master cluster managing an agent cluster disclosed in this application;
[0035] Figure 3 A specific Kubernetes multi-cluster management method flow chart disclosed in this application;
[0036] Figure 4 Fill in the code for a target cluster KubeConfig disclosed in this application;
[0037] Figure 5 This is another specific flow chart of the Kubernetes multi-cluster management method disclosed in this application;
[0038] Figure 6 This is a schematic diagram of the structure of a Kubernetes multi-cluster management device disclosed in this application;
[0039] Figure 7 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0041] Whether it is a private cloud or a public cloud, there will be a large number of K8S clusters that need to be managed. These clusters do not have a unified management platform, which greatly increases the difficulty of operation and maintenance. Each cluster has differences, different network plug-ins, different K8S versions, and even clusters that do secondary development of K8S components, because existing solutions such as KubeFederation need to expand the K8S API when implementing multi-cluster management. Modifying the original K8S API requires modifying multiple configurations, and the deployment is extremely complex and cumbersome. For people who are not familiar with KubeFederation, the learning cost is extremely high. In addition, the storage information is stored in each etcd through K8S's CRD, and these cluster information, authentication information, and user information are different for each cluster. This storage method is prone to information inconsistency, which ultimately leads to problems in multi-cluster management. The existing patent CN202111462252.2 mentions unified management of multiple Kubernetes clusters through a custom declarative API. This approach will make the entire K8S API too bloated, requiring the writing and generation of a large number of CRDs. When problems occur with CRDs, the entire cluster can easily crash and become unusable. The existing patent CN202111018688.2 uses a cluster management scheduling module to manage multiple clusters, which requires the development of a separate registration and management scheduling module.
[0042] To this end, this application discloses a Kubernetes multi-cluster management solution that can improve the efficiency of inter-cluster communication and management, avoid problems caused by overly complex, unstable, and inconsistent cluster management, and achieve simple, efficient, and consistent multi-cluster management.
[0043] Reference Figure 1 As shown, an embodiment of the present invention discloses a Kubernetes multi-cluster management method, which is applied to a main management cluster, including:
[0044] Step S11: deploying a preset agent program for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster.
[0045] In this embodiment, refer to Figure 2As shown, the multi-cloud management agent program is written using the programming language Golong, and the written multi-cloud management agent program is deployed to other Kubernetes clusters except the main management cluster. During the deployment process, it is necessary to modify the configuration in the slave management cluster in the yaml file. After the modification is completed, the agent component is deployed to the agent cluster by executing the corresponding deployment command in the slave management cluster to obtain the slave management cluster. For example: deploy a kubernetes agent cluster. Modify the configuration in the agent cluster under the clusterdeployment.yaml file: modify Clustername:b-idc-sjzntest-20220215, modify clusterRole:agent and jwtSecret:"OrZpAUpoAxZRdOjiPQ1A4tRgXNnxtotD". After the modification is completed, the agent component is deployed to the agent cluster by executing the command kubectlapply-fclusterdeployment.yaml in the agetn cluster. Among them, the code implementation of the slave management cluster is as follows:
[0046]
[0047]
[0048] In this embodiment, refer to Figure 2As shown, before deploying the preset agent program for other Kubernetes clusters outside the main management cluster, it also includes: deploying the preset master program for the Kubernetes cluster to obtain the main management cluster. It can be understood that the master program is written using the program development language Golong, and the written master program is deployed to the main management cluster. During the deployment process, it is necessary to modify the configuration in the main management cluster in the yaml file. After the modification, the master program is deployed to the main management cluster by executing the corresponding deployment command in the main management cluster. It is necessary to compile and package to generate the image in advance, and then deploy the master program through the yaml file. For example: first deploy a kubernetes cluster, and then modify the configuration in the clusterdeployment.yamlmaster cluster, modify Clustername:host, modify clusterRole:host and jwtSecret:"" to empty. After the modification is completed, the master component is deployed to the master cluster by executing the command kubectlapply-f clusterdeployment.yaml in the master cluster. After the deployment is completed, the jwtSecret is obtained through the command kubectl get secret clusterdeployment|grep-v"apiVersion"|grepjwtSecret. The main management cluster deployment code is as follows:
[0049]
[0050] In this embodiment, before deploying the preset agent program for other Kubernetes clusters outside the main management cluster, it also includes: encapsulating the preset agent program with a communication protocol. It can be understood that by encapsulating the communication technology in the agent and directly using the agent to issue instructions to the kube-apiserver, the cumbersome steps of communicating with the CRD are omitted for managing the slave management cluster.
[0051] Step S12: Sending a management instruction to the slave management cluster so that the preset agent program calls a corresponding test case to collect cluster information of the slave management cluster and generates corresponding feedback information.
[0052] In this embodiment, the master directly issues instructions to the agent. The agent directly accesses the K8S apiserver. Manipulate the agent cluster, display the agent cluster data, and manage the agent cluster. It can be understood that the master issues instructions to the multi-cloud management agent through the interface, and the multi-cloud management agent interface instructions call the K8S api to complete the management and control of the agent cluster and generate corresponding feedback information. It should be noted that this embodiment does not need to expand the K8S api when implementing multi-cluster management. Both the agent and the master are non-invasive, and there is no need to add or modify the K8S API resources, modify the original K8S api or modify multiple configurations. The master only needs to issue corresponding management instructions to the agent so that the agent can directly call the original K8S api for management or control. The deployment is simple, the learning cost is low, a large number of custom resources are saved, the CRD is streamlined, and various problems caused by CRD failures are avoided.
[0053] Step S13: Receive the feedback information to implement management of multiple Kubernetes clusters.
[0054] In this embodiment, the multi-cloud management agent transmits information back to the master cluster to display resource information or return processing results, which can improve the efficiency of inter-cluster communication and management. Multi-cluster management is achieved through agent and master communication, and the agent cluster is managed by the master cluster.
[0055] In this embodiment, after receiving the feedback information to achieve management of Kubernetes multiple clusters, it also includes: saving the target information in the feedback information to a local database based on user needs. It is understandable that when the feedback information contains the target information required by the corresponding user, the target information needs to be stored accordingly.
[0056] It can be seen that the present application discloses a Kubernetes multi-cluster management method, which is applied to the main management cluster, including: deploying preset agents for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster; sending management instructions to the slave management cluster so that the preset agent calls the corresponding test case to collect the cluster information of the slave management cluster and generates corresponding feedback information; receiving the feedback information to achieve the management of Kubernetes multi-cluster. It can be seen that the present application manages Kubernetes clusters by deploying preset agents. The main management cluster directly issues instructions to the preset agent. Use the preset agent to directly access the K8S Apiserver, and then use the API to control each cluster, collect data or control the cluster to achieve the management of Kubernetes multi-cluster.
[0057] Reference Figure 3 As shown, the embodiment of the present invention discloses a specific Kubernetes multi-cluster management method, which is applied to the main management cluster. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically:
[0058] Step S21: Modify the configuration information of the Kubernetes cluster, and deploy the preset master program through the yaml file to obtain the main management cluster.
[0059] In this embodiment, the configuration information of the Kubernetes cluster is modified in advance. Since there is no direct communication between the existing Kubernetes multi-clusters, and if the Kubernetes multi-clusters are managed and controlled by the main management cluster to manage other slave management clusters, it is necessary to modify the configuration information of the Kubernetes cluster accordingly, and deploy the self-developed back-end program to the Kubernetes cluster to realize K8S multi-cloud management. Therefore, it is necessary to modify the yaml file of the pre-deployed Kubernetes cluster, and then deploy the preset master program in the Kubernetes cluster to obtain the main management cluster.
[0060] Step S22: deploying a preset agent program for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster.
[0061] Step S23: Sending a management instruction to the slave management cluster so that the preset agent program calls a corresponding test case to collect cluster information of the slave management cluster and generates corresponding feedback information.
[0062] For more detailed processing procedures in steps S22 and S23, please refer to the aforementioned disclosed embodiments, which will not be described in detail here.
[0063] Step S24: Add the cluster information of the slave management cluster in advance through a graphical interface; input the kubeconfig of the cluster through a preset program interface to display the corresponding return information to achieve the management of Kubernetes multiple clusters.
[0064] In this embodiment, the master and agent will automatically identify information. The master cluster can obtain cluster information through the command kubectl getcluster, and then realize the control and management of the slave management cluster. The development platform uses react to write the platform front end and uses a graphical interface to manage the multi-cloud management agent cluster. Add the corresponding cluster through the graphical interface. Figure 4 As shown, by inputting the kubeconfig of the agent cluster, the master cluster can manage multiple clusters. The master cluster directly saves the agent cluster information in the mysql database. Since the mysql database is directly connected, the cluster information is stored in the database. Whether the agent cluster or the master cluster is modified, it will be synchronized to the database, avoiding the previous cluster storage information is stored in each ETCD through K8S's CRD, and these cluster information, authentication information, user information, etc. are different for each cluster. This storage method is prone to information inconsistency, which ultimately leads to problems in multi-cluster management. Avoid data inconsistency, which leads to the collapse of the multi-cluster management function. In this embodiment, the key information is stored in the mysql database to avoid data inconsistency problems in ETCD storage.
[0065] It can be seen that the application stores the associated information in the database through the master and the multi-cloud management agent, avoiding the problem of inconsistent data in ETCD storage, and the embodiment of the application has fewer modules in the implementation process of management and control from the management cluster, which greatly reduces the learning cost of K8S multi-cluster management. No CRD deployment is required, no bloated K8S api extension, and the function is directly encapsulated in the program to achieve multi-cluster management. No ETCD is required, and no data needs to be stored in ETCD. Only the agent and master programs need to be deployed.
[0066] Reference Figure 5 As shown, the embodiment of the present invention discloses a specific Kubernetes multi-cluster management method, which is applied to the slave management cluster. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically:
[0067] Step S31: receiving a management instruction sent by the master management cluster, using a preset agent program pre-deployed by the master management cluster for the slave management cluster to call a corresponding test case to collect cluster information of the slave management cluster, and generating corresponding feedback information.
[0068] In this embodiment, the slave management cluster receives the management instructions sent by the master management cluster through the interface, and based on the agent program pre-deployed in the slave management cluster, calls the Kubernetes cluster API to collect the cluster information of the slave management cluster, and generates corresponding feedback information.
[0069] Step S32: Send the feedback information to the main management cluster so that the main management cluster can manage multiple Kubernetes clusters.
[0070] In this embodiment, the feedback information is sent to the main management cluster, and based on user needs, the corresponding cluster information is selected to be directly saved in the MySQL database, rather than saved in the respective ETCD of the Kubernetes cluster, to avoid information inconsistency caused by different data storage methods of each cluster, which in turn causes problems in multi-cluster management.
[0071] It can be seen that the present application discloses a Kubernetes multi-cluster management method, which is applied to the main management cluster, including: deploying preset agents for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster; sending management instructions to the slave management cluster so that the preset agent calls the corresponding test case to collect the cluster information of the slave management cluster and generates corresponding feedback information; receiving the feedback information to achieve the management of Kubernetes multi-cluster. It can be seen that the present application manages Kubernetes clusters by deploying preset agents. The main management cluster directly issues instructions to the preset agent. Use the preset agent to directly access the K8S Apiserver, and then use the API to control each cluster, collect data or control the cluster to achieve the management of Kubernetes multi-cluster.
[0072] Reference Figure 6 As shown, the embodiment of the present invention discloses a specific Kubernetes multi-cluster management device, which is applied to the main management cluster, including:
[0073] A program deployment module 11 is used to deploy a preset agent program for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster;
[0074] An information collection module 12, used to send a management instruction to the slave management cluster so that the preset agent program calls a corresponding test case to collect cluster information of the slave management cluster and generates corresponding feedback information;
[0075] The information receiving module 13 is used to receive the feedback information to achieve the management of Kubernetes multiple clusters.
[0076] It can be seen that the present application discloses a Kubernetes multi-cluster management method, which is applied to the main management cluster, including: deploying preset agents for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster; sending management instructions to the slave management cluster so that the preset agent calls the corresponding test case to collect the cluster information of the slave management cluster and generates corresponding feedback information; receiving the feedback information to achieve the management of Kubernetes multi-cluster. It can be seen that the present application manages Kubernetes clusters by deploying preset agents. The main management cluster directly issues instructions to the preset agent. Use the preset agent to directly access the K8S Apiserver, and then use the API to control each cluster, collect data or control the cluster to achieve the management of Kubernetes multi-cluster.
[0077] In some specific implementations, the program deployment module 11 may specifically include:
[0078] The cluster deployment submodule is used to deploy the preset master program for the Kubernetes cluster to obtain the main management cluster.
[0079] In some specific implementations, the cluster deployment submodule may specifically include:
[0080] The information modification unit is used to modify the configuration information of the Kubernetes cluster and deploy the preset master program through a yaml file to obtain the main management cluster.
[0081] In some specific implementations, the program deployment module 11 may specifically include:
[0082] The protocol encapsulation unit is used to perform communication protocol encapsulation on the preset agent program.
[0083] In some specific implementations, the information receiving module 13 may specifically include:
[0084] The information receiving unit is used to add the cluster information of the slave management cluster in advance through a graphical interface; input the kubeconfig of the cluster through a preset program interface to display the corresponding return information to realize the management of Kubernetes multiple clusters.
[0085] In some specific implementations, the information receiving module 13 may specifically include:
[0086] The information storage unit is used to store the target information in the feedback information into a local database based on user needs.
[0087] Furthermore, the present application also discloses an electronic device. Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0088] Figure 7 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the Kubernetes multi-cluster management method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0089] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0090] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0091] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0092] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the Kubernetes multi-cluster management method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.
[0093] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the Kubernetes multi-cluster management method disclosed above is implemented. The specific steps of the method can refer to the corresponding contents disclosed in the above embodiments, and will not be repeated here.
[0094] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0095] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be directly implemented with a software module executed by a hardware or processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0096] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0097] The above is a detailed introduction to a Kubernetes multi-cluster management method, device, equipment, and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A Kubernetes multi-cluster management method, characterized in that: Applicable to the main management cluster, including: Deploy a preset agent program for other Kubernetes clusters outside the master management cluster to obtain a slave management cluster; Sending a management instruction to the slave management cluster so that the preset agent program calls a corresponding test case to collect cluster information of the slave management cluster and generates corresponding feedback information; Receiving the feedback information to implement management of multiple Kubernetes clusters; Before deploying the preset agent program for other Kubernetes clusters outside the main management cluster, the method further includes: Deploy the preset master program to the Kubernetes cluster to obtain the main management cluster; The process of deploying a preset master program on the Kubernetes cluster to obtain a main management cluster includes: Modify the configuration information of the Kubernetes cluster, and deploy the preset master program through the yaml file to obtain the main management cluster; The step of deploying a preset agent program for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster includes: Modify the configuration information in the slave management cluster in the yaml file, and deploy the agent component to the agent cluster by executing the corresponding deployment command in the slave management cluster to obtain the slave management cluster; The sending of the management instruction to the slave management cluster includes: The management instructions are sent to the agent component of the slave management cluster through the preset master program of the master management cluster.
2. The Kubernetes multi-cluster management method according to claim 1, characterized in that: Before deploying the preset agent program for other Kubernetes clusters outside the main management cluster, the method further includes: The preset agent program is encapsulated with a communication protocol.
3. The Kubernetes multi-cluster management method according to claim 1, characterized in that: The receiving of the returned information to implement management of multiple Kubernetes clusters includes: Add the cluster information of the slave management cluster in advance through a graphical interface; Enter the cluster's kubeconfig through the preset program interface to display the corresponding return information to manage multiple Kubernetes clusters.
4. The Kubernetes multi-cluster management method according to any one of claims 1 to 3, characterized in that: After receiving the feedback information to implement management of multiple Kubernetes clusters, the method further includes: The target information in the returned information is saved in a local database based on user needs.
5. A Kubernetes multi-cluster management method, characterized in that: Applicable to the slave management cluster, including: Receive the management instruction sent by the main management cluster, use the preset agent program pre-deployed by the main management cluster for the slave management cluster to call the corresponding test case to collect the cluster information of the slave management cluster, and generate corresponding feedback information; Send the feedback information to the main management cluster so that the main management cluster can manage multiple Kubernetes clusters; Before receiving the management instruction sent by the main management cluster, the method further includes: deploying a preset agent program for other Kubernetes clusters outside the main management cluster; Before deploying the preset agent program for other Kubernetes clusters outside the main management cluster, the method further includes: deploying the preset master program for the Kubernetes cluster to obtain the main management cluster; The process of deploying a preset master program on the Kubernetes cluster to obtain a main management cluster includes: Modify the configuration information of the Kubernetes cluster, and deploy the preset master program through the yaml file to obtain the main management cluster; Deploy preset agents for other Kubernetes clusters outside the main management cluster to obtain slave management clusters, including: Modify the configuration information in the slave management cluster in the yaml file, and deploy the agent component to the agent cluster by executing the corresponding deployment command in the slave management cluster to obtain the slave management cluster; Receive management instructions sent by the main management cluster, including: The management instruction sent by the preset master program of the main management cluster is received by the agent component of the slave management cluster.
6. A Kubernetes multi-cluster management device, characterized in that: Applicable to the main management cluster, including: A program deployment module, used to deploy a preset agent program for other Kubernetes clusters outside the main management cluster to obtain a slave management cluster; An information collection module, used for sending management instructions to the slave management cluster, so that the preset agent program calls the corresponding test case to collect cluster information of the slave management cluster and generates corresponding feedback information; An information receiving module, used to receive the feedback information to achieve management of multiple Kubernetes clusters; The program deployment module includes: a cluster deployment submodule, which is used to deploy a preset master program on the Kubernetes cluster to obtain a main management cluster; The cluster deployment submodule includes: an information modification unit, which is used to modify the configuration information of the Kubernetes cluster and deploy the preset master program through a yaml file to obtain the main management cluster; The program deployment module is specifically used to modify the configuration information in the slave management cluster in the yaml file, and deploy the agent component to the agent cluster by executing the corresponding deployment command in the slave management cluster to obtain the slave management cluster; The information collection module is specifically used to send management instructions to the agent component of the slave management cluster through the preset master program of the master management cluster.
7. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the Kubernetes multi-cluster management method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the Kubernetes multi-cluster management method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Multi-cloud multi-cluster Kubernetes management system and method and equipment
CN113641503A
Implementation method and system for multi-container cluster management
CN114374692A
Multi-cloud interconnection method and device, equipment, storage medium and product
CN113220432A
Method for managing plurality of wide area network clusters based on one platform
CN113923116A