Cluster management method, device, electronic device and storage medium
By obtaining key parameters, starting cluster creation application instances, and using container mirroring automation to complete cluster creation, solving the problem of inefficient cluster deployment in the existing technology and achieving efficient cluster management.
Patent Information
- Application Number
- CN202210661922.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-06-13
AI Technical Summary
In the existing technology, cluster deployment methods are relatively inefficient and require manual configuration of ansible server, resulting in inefficient cluster creation management.
By obtaining the first key parameters, starting the cluster creation application instance, using container mirroring to solidify the dependencies of ansible server and task scripts to realize cluster creation operations. The application instance runs on the container orchestration engine in a work-like container form, and automatically completes cluster creation.
It realizes the automation of cluster creation management and improves the efficiency of cluster management.
Smart Images

Figure CN115113975B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing technology, and in particular to a cluster management method, device, electronic device and storage medium. Background Art
[0002] In related technologies, container orchestration engines (such as Kubernetes) are often deployed using the Ansible tool. This involves configuring a specific virtual machine (VM) within a selected group of VMs as an Ansible server. The Ansible server contains the necessary dependency packages for cluster installation, as well as Ansible scripts. The Ansible server is primarily responsible for executing Ansible scripts, establishing Secure Shell (SSH) connections with other VMs, copying dependency packages to the target VM, and performing installation operations.
[0003] However, in the deployment of the entire cluster, the configuration and preparation of the Ansible server need to be done manually, which is inefficient. Summary of the Invention
[0004] The present invention provides a cluster management method, device, electronic device and storage medium, which are used to solve the defect of low efficiency of cluster deployment in the prior art and realize the automation of cluster creation and management.
[0005] In a first aspect, the present invention provides a cluster management method, comprising:
[0006] Creating a first virtual machine, the first virtual machine serving as an installation node of the cluster;
[0007] Obtaining a first key parameter for cluster creation, where the first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0008] Based on the first key parameter, the cluster creation application instance is started, and the cluster creation application instance runs on the container orchestration engine in the form of a working class container.
[0009] Optionally, according to a cluster management method provided by the present invention, the first key parameters include: the IP address of the first virtual machine, the root password of the first virtual machine, the cluster version, and the container runtime type on which the cluster depends; the container orchestration engine is Kubernetes; and starting the cluster to create an application instance based on the first key parameters includes:
[0010] By communicating with the service interface of Kubernetes, the cluster is started to create an application instance based on the first key parameter.
[0011] Optionally, according to a cluster management method provided by the present invention, after starting the cluster to create an application instance based on the first key parameter, the method further includes:
[0012] Determine a cluster management task, where the cluster management task is any one of the following: a cluster expansion task, a cluster reduction task, or a cluster deletion task;
[0013] Based on the cluster management task, a second key parameter for cluster management is obtained. The second key parameter is used as an initialization environment variable for starting a target application instance. The target application instance is used to perform cluster management operations. The container image corresponding to the target application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0014] Based on the second key parameter, the target application instance is started, and the target application instance runs on the container orchestration engine in the form of a working class container.
[0015] Optionally, according to a cluster management method provided by the present invention, before acquiring a second key parameter for cluster management based on the cluster management task, the method further includes:
[0016] When the cluster management task is the cluster capacity expansion task, a second virtual machine for capacity expansion is created.
[0017] Optionally, according to a cluster management method provided by the present invention, when the cluster management task is the cluster expansion task, the second key parameters include: the IP address of the first virtual machine, the root password of the first virtual machine, the IP address of the second virtual machine, the root password of the second virtual machine, the cluster version, and the container runtime type on which the cluster depends.
[0018] Optionally, according to a cluster management method provided by the present invention, after starting the cluster to create an application instance based on the first key parameter, the method further includes:
[0019] When it is determined that the cluster creation application instance is completed, displaying first information indicating that the cluster is ready;
[0020] Alternatively, when it is determined that the target application instance is executed completely, second information indicating that the cluster is ready is displayed.
[0021] In a second aspect, the present invention further provides a cluster management device, comprising:
[0022] A creation module, configured to create a first virtual machine, the first virtual machine serving as an installation node of the cluster;
[0023] An acquisition module is configured to obtain a first key parameter for cluster creation. The first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0024] A startup module is used to start the cluster creation application instance based on the first key parameter, and the cluster creation application instance runs on the container orchestration engine in the form of a working class container.
[0025] In a third aspect, the present invention further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the cluster management method as described above is implemented.
[0026] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described cluster management methods.
[0027] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned cluster management methods.
[0028] The cluster management method, device, electronic device and storage medium provided by the present invention can start a cluster creation application instance based on the first key parameter by obtaining a first key parameter for cluster creation. The container image corresponding to the cluster creation application instance is solidified with the dependent components of the Ansible server and the task script of cluster management, and then the cluster creation application instance can perform a cluster creation operation on the first virtual machine. The cluster creation application instance runs on the container orchestration engine in the form of a working container. The life cycle of the cluster creation application instance is the execution time length of a management command. After the cluster creation operation is completed, the container corresponding to the cluster creation application instance will exit, which can realize the automation of cluster creation management and improve the efficiency of cluster management. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0030] Figure 1 This is a schematic diagram of the OpenStack deployment form provided by related technologies;
[0031] Figure 2 This is a schematic diagram of the top-level K8S cluster deployment provided by related technologies;
[0032] Figure 3 This is one of the flow charts of the cluster management method provided by the present invention;
[0033] Figure 4 It is a schematic diagram of the deployment form of each component provided by the present invention;
[0034] Figure 5 This is the second flow chart of the cluster management method provided by the present invention;
[0035] Figure 6 This is the third flow chart of the cluster management method provided by the present invention;
[0036] Figure 7 It is a structural diagram of the cluster management device provided by the present invention;
[0037] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0038] In order to facilitate a clearer understanding of the embodiments of the present invention, some relevant background knowledge is first introduced as follows.
[0039] Openstack is a combination of many technologies, including numerous services. The ultimate goal of Kolla, a related technology, is to create a corresponding Docker image (Image) for each OpenStack service. Kolla's Docker image has a very small granularity, and it has a specific Image for each OpenStack service. After combining the Kolla deployment model with Kubernetes (K8S for short), all the core components of Openstack run in the form of Pods on the K8S base (K8S carries Openstack components in the form of Pods). Communication between Openstack components becomes communication between Pods. Each service of Openstack can be called through the Rest interface.
[0040] Figure 1 This is a schematic diagram of the openstack deployment form provided by related technologies, such as Figure 1 As shown in the figure, the core component Pod of Openstack is in a Pod network plane. The core components of Openstack can include Nova components, Neutron components, Cinder components or Glance components, etc. A Pod can be pulled up on the K8S base. The Pod and the core component Pod of Openstack are in the same network plane. Therefore, the Pod has the ability to call the Openstack interface. This Pod can be mainly responsible for creating virtual machines.
[0041] Figure 2 This is a schematic diagram of the top-level K8S cluster deployment provided by related technologies, such as Figure 2 As shown in the figure, container virtualization is to virtualize multiple resource groups on a single operating system to share hardware resources. It is a resource allocation method with a smaller granularity. K8S can be deployed to a group of virtual machines to provide container services to the outside world as a cluster.
[0042] In order to overcome the above-mentioned defects, the present invention provides a cluster management method, apparatus, electronic device and storage medium, which can realize automation of cluster creation management by starting a cluster creation application instance based on a first key parameter.
[0043] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0044] Figure 3 This is one of the flow charts of the cluster management method provided by the present invention, such as Figure 3 As shown, the execution subject of the cluster management method can be a container cluster manager (CCM), and the CCM can be a Pod that is in the same network plane as the core component Pod of Openstack. The method includes:
[0045] Step 301: Create a first virtual machine, which serves as an installation node of the cluster;
[0046] Specifically, in order to create a cluster on a virtual machine, a first virtual machine may be created, and the first virtual machine may serve as an installation node of the cluster.
[0047] Step 302: Obtain a first key parameter for cluster creation. The first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0048] Step 303: Based on the first key parameter, the cluster creation application instance is started, and the cluster creation application instance runs on the container orchestration engine in the form of a work class container.
[0049] Specifically, after creating the first virtual machine, a first key parameter can be obtained. The first key parameter can be used as an initialization environment variable for starting the cluster creation application instance, and then the cluster creation application instance can be started based on the first key parameter. The container image corresponding to the cluster creation application instance is solidified with the dependent components of the Ansible server and the task script of cluster management. The cluster creation operation can be performed through the cluster creation application instance. At the same time, since the cluster creation application instance runs on the container orchestration engine in the form of a work-class container, after the cluster creation operation is executed, the container corresponding to the cluster creation application instance will exit.
[0050] Optionally, the cluster management method provided by the present invention can be applied to a containerized platform that can use Openstack as the infrastructure layer. The main function of Openstack is to decouple the physical topology and logical topology of the IT system. By allowing a machine to run multiple operating systems (i.e., virtual machines) at the same time, it is possible to improve the resource utilization of the physical machine while ensuring the independence and isolation of the business instances.
[0051] Optionally, the above-mentioned containerization platform can build a K8S-based container orchestration engine on top of the infrastructure layer to achieve finer-grained resource utilization, and with the help of K8S's container orchestration capabilities, physical resources can be dynamically expanded horizontally according to business load.
[0052] Optionally, for this containerized platform, the infrastructure layer can utilize Kolla to implement containerized deployment of OpenStack components. Furthermore, this containerized platform can integrate Kubernetes as the OpenStack foundation. By combining component containerization with container orchestration technology, this containerized platform enables multi-replication, high availability, and dynamic scaling of OpenStack services, simplifying OpenStack deployment. All core OpenStack components run as pods on the Kubernetes foundation. Communication between OpenStack components can be converted to inter-pod communication.
[0053] Alternatively, for the aforementioned containerized platforms, OpenStack can create virtual machines on managed physical machines and deploy a Kubernetes cluster within them. The container capabilities used by users are provided by the Kubernetes cluster within the virtual machines.
[0054] Optionally, Figure 4 This is a schematic diagram of the deployment of various components provided by the present invention, such as Figure 4 As shown, the CCM consists of a CCM frontend and a CCM backend. These frontends, backends, and cluster management applications (jobs) are all hosted on the OpenStack Kubernetes foundation, co-located with the OpenStack control plane containers. These frontends, backends, cluster management jobs, and OpenStack control plane containers can communicate with each other over the Kubernetes Layer 2 network.
[0055] Alternatively, the CCM backend can be a microservice developed based on Client Go, enabling communication with the Kubernetes message bus and OpenStack core components. The CCM frontend can be a user interface. The frontend interface can directly call the CCM backend interface, which in turn is responsible for operating the OpenStack and Kubernetes interfaces to create virtual machines and start jobs.
[0056] Optionally, all the basic dependency components of Ansible server, such as Python and open-ssh, can be solidified in the container image of the Job. At the same time, the task scripts for cluster management can also be solidified into the Job container image. The entrypoint of the Job (the entrypoint specifies the default entry command of the image) is set to a shell script that receives input parameters. The parameters of the shell script are all obtained from the environment variable env of the container. Different management processes can be executed based on the obtained parameters: such as creating a cluster, deleting a cluster, scaling a cluster, upgrading nodes in the cluster, etc. The Job can interact with the virtual machine through the SSH protocol.
[0057] Optionally, the virtual machine needs to be started according to a preset virtual machine image, which may contain all the software packages that the K8S cluster depends on when deployed.
[0058] It is understandable that based on the Pod network, communication between CCM, Openstack containers, and K8S message buses can be achieved. Based on the Virtual Local Area Network (VLAN) technology, communication between cluster deployment jobs and virtual machines in the K8S base can be achieved, thereby completing the creation of a container cluster.
[0059] As you can understand, CCM can process requests concurrently, creating multiple virtual machine clusters and launching corresponding jobs for each, thus ensuring the simultaneous management of multiple clusters. In large-scale scenarios, CCM can deploy multiple replicas and elastically scale them. Jobs are lightweight containers that offer flexible deployment and rapid startup and shutdown. This is crucial for enhancing the user experience and ensuring the stability of Platform as a Service (PaaS) platforms.
[0060] The cluster management method provided by the present invention can start a cluster creation application instance based on the first key parameter by obtaining a first key parameter for cluster creation. The container image corresponding to the cluster creation application instance is solidified with the dependent components of the Ansible server and the task script of cluster management, and then the cluster creation application instance can perform a cluster creation operation on the first virtual machine. The cluster creation application instance runs on the container orchestration engine in the form of a working container. The life cycle of the cluster creation application instance is the execution time length of a management command. After the cluster creation operation is completed, the container corresponding to the cluster creation application instance will exit, which can realize the automation of cluster creation management and improve the efficiency of cluster management.
[0061] Optionally, the first key parameter includes: an IP address of the first virtual machine, a root password of the first virtual machine, a cluster version, and a container runtime type that the cluster depends on; the container orchestration engine is Kubernetes; and starting the cluster to create an application instance based on the first key parameter includes:
[0062] By communicating with the service interface of Kubernetes, the cluster is started to create an application instance based on the first key parameter.
[0063] Optionally, Figure 5 This is the second flow chart of the cluster management method provided by the present invention, such as Figure 5 As shown, the cluster management method may include: steps 501 to 506, wherein:
[0064] Step 501: CCM instantiates a virtual machine (under the same namespace), which serves as a node for the K8S installation.
[0065] Step 502: CCM collects all key parameters for creating K8S clusters.
[0066] For example, the key parameters may include the virtual machine IP, virtual machine root password, cluster K8S version, and the container runtime type (docker or containerd) that K8S depends on.
[0067] Step 503: The CCM maintains the cluster and creates the job's YAML file.
[0068] Optionally, the key parameters collected in step 502 may be entered into a yaml file, and these key parameters may be used as initialization environment variables for starting the job.
[0069] Step 504: CCM integrates Client Go to communicate with the API server of the Openstack base K8S, and applies YAML to launch the corresponding Job to perform cluster creation operations.
[0070] Step 505: The CCM polls whether the job is completed (completing) as a basis for determining whether the process is successfully executed;
[0071] Step 506: After the cluster is created, the CCM front end needs to display that the cluster is ready (Ready).
[0072] Optionally, after starting the cluster to create an application instance based on the first key parameter, the method further includes:
[0073] Determine a cluster management task, where the cluster management task is any of the following: a cluster expansion task, a cluster reduction task, a cluster deletion task, a cluster upgrade task, or a cluster rollback task;
[0074] Based on the cluster management task, a second key parameter for cluster management is obtained. The second key parameter is used as an initialization environment variable for starting a target application instance. The target application instance is used to perform cluster management operations. The container image corresponding to the target application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0075] Based on the second key parameter, the target application instance is started, and the target application instance runs on the container orchestration engine in the form of a working class container.
[0076] Specifically, after creating a cluster, in order to realize cluster management functions such as cluster expansion, cluster reduction, cluster deletion, cluster upgrade or cluster rollback, the cluster management task can be determined, and then based on the cluster management task, the second key parameter for cluster management can be obtained, and then the target application instance can be started based on the second key parameter. The container image corresponding to the target application instance is solidified with the dependent components of the Ansible server and the task script of cluster management, and then the target application instance can perform operations such as cluster expansion, cluster reduction, cluster deletion, cluster upgrade or cluster rollback. The target application instance runs on the container orchestration engine in the form of a work-class container. After executing the cluster management operation, the container corresponding to the target application instance will exit, and various cluster management automation can be realized.
[0077] It is understandable that CCM has the ability to communicate with both the Openstack core components and the api-server of the K8S base.
[0078] On the one hand, CCM can complete virtual machine management tasks by calling Openstack interfaces, such as creating, adding, and deleting virtual machine nodes.
[0079] On the other hand, CCM can communicate with the api-server of the K8S base to create other business Pods and complete specific functions. The management of the K8S cluster on the virtual machine can be undertaken by the business Pod. The business Pod is configured as an Ansible server by solidifying the Ansible task in the image. CCM can pass the virtual machine node information (IP address, username and password, etc.) to the Ansible server container in the form of environment variable injection and pull up the Pod. After the Pod is started, it executes cluster management tasks according to the constraints of the input parameters. The Pod has a clear survival time, that is, the life cycle is the execution time of a management command, so the Pod runs in the K8S base in the form of a Job.
[0080] It can be understood that the K8S cluster deployment logic is encapsulated in the Job. The necessary software dependencies for the K8S cluster installation are pre-installed into the virtual machine image in advance. By using multiple components to work together, complex cluster management functions can be achieved.
[0081] Optionally, before acquiring a second key parameter for cluster management based on the cluster management task, the method further includes:
[0082] When the cluster management task is the cluster capacity expansion task, a second virtual machine for capacity expansion is created.
[0083] It can be understood that in order to achieve cluster expansion, a second virtual machine for expansion can be created first, and then based on the cluster expansion task, the second key parameter for cluster expansion can be obtained, and then the target application instance can be started based on the second key parameter. The container image corresponding to the target application instance is solidified with the dependent components of the Ansible server and the task script of cluster management, and then the target application instance can perform the cluster expansion operation. The target application instance runs on the container orchestration engine in the form of a work-class container. After the cluster expansion operation is executed, the container corresponding to the target application instance will exit, and the automation of cluster expansion can be achieved.
[0084] Optionally, when the cluster management task is the cluster expansion task, the second key parameters include: the IP address of the first virtual machine, the root password of the first virtual machine, the IP address of the second virtual machine, the root password of the second virtual machine, the cluster version, and the container runtime type on which the cluster depends.
[0085] Optionally, Figure 6 This is the third flow chart of the cluster management method provided by the present invention, as shown in FIG. Figure 6 As shown, the cluster management method includes: steps 601 to 607, wherein:
[0086] Step 601: The CCM creates a virtual machine for capacity expansion.
[0087] Step 602: CCM collects all key parameters for K8S cluster expansion.
[0088] For example, the IP addresses of all virtual machines in the current cluster, the root password of the virtual machine, the K8S version of the cluster, and the container runtime type (docker or containerd) that K8S depends on.
[0089] Step 603: The CCM collects key parameters of the virtual machine for capacity expansion.
[0090] For example, the virtual machine IP, virtual machine root password, cluster K8S version, and the container runtime type that K8S depends on (docker or containerd).
[0091] Step 604: The CCM maintains the YAML file for the cluster expansion job.
[0092] Optionally, the key parameters collected in step 702 and step 703 can be written into a YAML file, and these parameters serve as initialization environment variables for starting the Job.
[0093] Step 605: CCM integrates the communication with the api-server of the K8S client go base (or through sshpass), applies yaml to launch the corresponding job, and performs cluster expansion operations;
[0094] Step 606: The CCM polls whether the job is completed, which serves as a basis for determining whether the process is successfully executed.
[0095] Step 607: After the cluster expansion is completed, the CCM front-end may display Cluster Ready.
[0096] It is understandable that cluster scaling is similar to cluster scaling, except that the process needs to be reversed and the virtual machine is deleted after the job is completed.
[0097] It is understood that cluster deletion can be done by launching a cluster deletion job, and then deleting the virtual machine after the job completes. (If the user has already cleared the business, the virtual machine can also be deleted directly.)
[0098] Optionally, after starting the cluster to create an application instance based on the first key parameter, the method further includes:
[0099] When it is determined that the cluster creation application instance is completed, displaying first information indicating that the cluster is ready;
[0100] Alternatively, when it is determined that the target application instance is executed completely, second information indicating that the cluster is ready is displayed.
[0101] As you can understand, Pod networking enables communication between CCM containers, OpenStack containers, and the K8S message bus, enabling automated virtualized resource management and job startup. VLAN technology enables communication between cluster deployment jobs and virtual machines in the K8S base, completing container cluster management. CCM can process requests concurrently, manage multiple virtual machine clusters simultaneously, and support the parallel launch of corresponding container cluster management jobs, ensuring concurrent management of multiple clusters. In large-scale usage scenarios, CCM supports multi-replica deployment and elastic scaling to ensure platform stability. Job deployment is flexible and startup and shutdown are fast, enhancing the cluster management experience.
[0102] The cluster management method provided by the present invention can start a cluster creation application instance based on the first key parameter by obtaining a first key parameter for cluster creation. The container image corresponding to the cluster creation application instance is solidified with the dependent components of the Ansible server and the task script of cluster management, and then the cluster creation application instance can perform a cluster creation operation on the first virtual machine. The cluster creation application instance runs on the container orchestration engine in the form of a working container. The life cycle of the cluster creation application instance is the execution time length of a management command. After the cluster creation operation is completed, the container corresponding to the cluster creation application instance will exit, which can realize the automation of cluster creation management and improve the efficiency of cluster management.
[0103] The cluster management device provided by the present invention is described below. The cluster management device described below and the cluster management method described above can be referenced to each other.
[0104] Figure 7 This is a schematic diagram of the structure of the cluster management device provided by the present invention, such as Figure 7 As shown, the device includes: a creation module 701, an acquisition module 702 and a startup module 703, wherein:
[0105] A creation module 701 is configured to create a first virtual machine, which serves as an installation node of the cluster;
[0106] An acquisition module 702 is configured to acquire a first key parameter for cluster creation. The first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0107] The starting module 703 is used to start the cluster creation application instance based on the first key parameter, and the cluster creation application instance runs on the container orchestration engine in the form of a working class container.
[0108] The cluster management device provided by the present invention can start a cluster creation application instance based on the first key parameter by obtaining the first key parameter for cluster creation. The container image corresponding to the cluster creation application instance is solidified with the dependent components of the Ansible server and the task script of cluster management, and then the cluster creation application instance can perform a cluster creation operation on the first virtual machine. The cluster creation application instance runs on the container orchestration engine in the form of a working container. The life cycle of the cluster creation application instance is the execution time length of a management command. After the cluster creation operation is completed, the container corresponding to the cluster creation application instance will exit, which can realize the automation of cluster creation management and improve the efficiency of cluster management.
[0109] Figure 8 Schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 8 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the cluster management method, for example, the method includes:
[0110] Creating a first virtual machine, the first virtual machine serving as an installation node of the cluster;
[0111] Obtaining a first key parameter for cluster creation, where the first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0112] Based on the first key parameter, the cluster creation application instance is started, and the cluster creation application instance runs on the container orchestration engine in the form of a working class container.
[0113] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0114] On the other hand, the present invention further provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the cluster management method provided by the above methods. For example, the method includes:
[0115] Creating a first virtual machine, the first virtual machine serving as an installation node of the cluster;
[0116] Obtaining a first key parameter for cluster creation, where the first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0117] Based on the first key parameter, the cluster creation application instance is started, and the cluster creation application instance runs on the container orchestration engine in the form of a working class container.
[0118] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for cluster management provided by the above methods is implemented. For example, the method includes:
[0119] Creating a first virtual machine, the first virtual machine serving as an installation node of the cluster;
[0120] Obtaining a first key parameter for cluster creation, where the first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script.
[0121] Based on the first key parameter, the cluster creation application instance is started, and the cluster creation application instance runs on the container orchestration engine in the form of a working class container.
[0122] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0123] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A cluster management method, characterized in that: include: Creating a first virtual machine, the first virtual machine serving as an installation node of the cluster; Obtaining a first key parameter for cluster creation, where the first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script. Based on the first key parameter, start the cluster creation application instance, where the cluster creation application instance runs on the container orchestration engine in the form of a work class container; Determine a cluster management task, where the cluster management task is any one of the following: a cluster expansion task, a cluster reduction task, or a cluster deletion task; Based on the cluster management task, a second key parameter for cluster management is obtained. The second key parameter is used as an initialization environment variable for starting a target application instance. The target application instance is used to perform cluster management operations. The container image corresponding to the target application instance is solidified with dependent components of the Ansible server and a cluster management task script. Based on the second key parameter, the target application instance is started, and the target application instance runs on the container orchestration engine in the form of a working class container.
2. The cluster management method according to claim 1, characterized in that: The first key parameters include: the IP address of the first virtual machine, the root password of the first virtual machine, the cluster version, and the container runtime type that the cluster depends on; the container orchestration engine is Kubernetes; and starting the cluster to create an application instance based on the first key parameters includes: By communicating with the service interface of Kubernetes, the cluster is started to create an application instance based on the first key parameter.
3. The cluster management method according to claim 1, characterized in that: Before acquiring the second key parameter for cluster management based on the cluster management task, the method further includes: When the cluster management task is the cluster capacity expansion task, a second virtual machine for capacity expansion is created.
4. The cluster management method according to claim 1 or 3, characterized in that: When the cluster management task is the cluster expansion task, the second key parameters include: the IP address of the first virtual machine, the root password of the first virtual machine, the IP address of the second virtual machine, the root password of the second virtual machine, the cluster version, and the container runtime type on which the cluster depends.
5. The cluster management method according to claim 1, characterized in that: After starting the cluster to create an application instance based on the first key parameter, the method further includes: When it is determined that the cluster creation application instance is completed, displaying first information indicating that the cluster is ready; Alternatively, when it is determined that the target application instance is executed completely, second information indicating that the cluster is ready is displayed.
6. A cluster management device for executing the cluster management method according to claim 1, characterized in that: include: A creation module, configured to create a first virtual machine, the first virtual machine serving as an installation node of the cluster; An acquisition module is configured to obtain a first key parameter for cluster creation. The first key parameter is used as an initialization environment variable for starting a cluster creation application instance. The cluster creation application instance is used to perform a cluster creation operation on the first virtual machine. The container image corresponding to the cluster creation application instance is solidified with dependent components of the Ansible server and a cluster management task script. A startup module is used to start the cluster creation application instance based on the first key parameter, and the cluster creation application instance runs on the container orchestration engine in the form of a working class container.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the cluster management method according to any one of claims 1 to 5 is implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the cluster management method according to any one of claims 1 to 5 is implemented.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the cluster management method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method for deploying container cloud on OpenStack, storage medium, electronic equipment and system
CN109656686A
Cluster node telescoping system based on cloud platform, implementation method and operation method
CN113220416A