A method and system for upgrading the version of a Kubernetes cluster
Through the automated data export server and client mechanism, the kubernetes cluster information is obtained and notified, and the automated version upgrade of the kubernetes cluster is realized, solving the problems of complex and high risk in the existing technology, and achieving the effect of simplifying upgrades, reducing risks and shortening time.
Patent Information
- Application Number
- CN202111637542.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2041-12-29
AI Technical Summary
When upgrading kubernetes clusters, the existing technology cannot upgrade kubernetes software, businesses deployed on kubernetes and kubernetes ecosystem software at the same time, resulting in complex, high risk and long-term upgrade process.
Link to the kubernetes manager through the data export server, obtain cluster information, and periodically notify the client of the data export client to realize the automatic version upgrade of the kubernetes cluster.
It has implemented the upgrade of kubernetes software, business and ecological software, which simplifies the upgrade process, reduces risks, shortens the upgrade time, and supports rapid fallback to previous versions.
Smart Images

Figure CN114385205B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of kubernetes clusters, and specifically to a method and system for upgrading the version of a kubernetes cluster. Background Art
[0002] In the process of migrating services to containers, the kubernetes orchestration tool is required to deploy container services. In reality, there are many kubernetes clusters online, with different deployment times and versions. As time goes by and kubernetes development progresses, kubernetes will go through multiple rounds of iterative development. The version of the kubernetes software itself needs to be upgraded, various applications on top of kubernetes need to be upgraded, and the software in the kubernetes ecosystem also needs to be upgraded. When performing an upgrade, there are a large number of configurations, versions, software, etc. that need to be changed. At this time, an automated tool is needed to upgrade kubernetes, the applications on top of kubernetes, and the software in the ecosystem, in order to simplify the upgrade process, reduce the risks brought by the upgrade, and prevent upgrade failures.
[0003] In the process of implementing the present invention, the applicant found that there are at least the following problems in the prior art:
[0004] In currently similar technical solutions, the official upgrade tool of kubernetes is used to upgrade versions one by one, and upgrades are carried out one by one according to the documentation of the software in the kubernetes ecosystem.
[0005] 1. It can only upgrade the software version of kubernetes individually.
[0006] 2. It can only upgrade the version of the applications on top of kubernetes individually.
[0007] 2. It is necessary to upgrade the kubernetes ecosystem applications individually one by one.
[0008] 3. Due to many dependencies, the upgrade operation cannot be completed quickly and completely, and the impact time on the business is relatively long. Summary of the Invention
[0009] The embodiments of the present invention provide a method and system for upgrading the version of a kubernetes cluster, which can upgrade the kubernetes software, the services deployed on kubernetes, and the software in the kubernetes ecosystem together, with simple operation and convenient use, and can select any version for upgrade.
[0010] To achieve the above object, on the one hand, an embodiment of the present invention provides a method for upgrading the version of a Kubernetes cluster, including:
[0011] Link to the Kubernetes manager through the data export server, and obtain information about the Kubernetes cluster managed by the Kubernetes manager from within the Kubernetes manager;
[0012] The data export client requests the information about the Kubernetes cluster obtained by the data export server from the data export server through the link service provided by the data export server, and the data export server periodically notifies the data export client of the information about the Kubernetes cluster it has obtained;
[0013] Obtain the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster obtained from the data export client, and perform corresponding upgrade operations on the Kubernetes cluster according to the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster.
[0014] On the other hand, an embodiment of the present invention provides a system for upgrading the version of a Kubernetes cluster, including:
[0015] A data export unit for linking to the Kubernetes manager and obtaining information about the Kubernetes cluster managed by the Kubernetes manager from within the Kubernetes manager;
[0016] A data export client for requesting the information about the Kubernetes cluster obtained by the data export server from the data export server through the link service provided by the data export server, and the data export server periodically notifies the data export client of the information about the Kubernetes cluster it has obtained;
[0017] An upgrade unit for obtaining the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster obtained from the data export client, and performing corresponding upgrade operations on the Kubernetes cluster according to the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster.
[0018] The above technical solution has the following beneficial effects: Upgrade the Kubernetes software, the services deployed on Kubernetes, and the Kubernetes ecosystem software together, with simple operation and convenient use, and any version can be selected for upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0020] Figure 1 is a flowchart of a method for upgrading the version of a Kubernetes cluster according to an embodiment of the present invention;
[0021] Figure 2 is a structural diagram of a system for upgrading the version of a Kubernetes cluster according to an embodiment of the present invention;
[0022] Figure 3 is a flowchart of another method for upgrading the version of a Kubernetes cluster according to an embodiment of the present invention. Detailed implementation manners
[0023] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0024] As Figure 1 shown, in combination with the embodiments of the present invention, a method for upgrading the version of a Kubernetes cluster is provided, including:
[0025] S101: The data export server links to the Kubernetes manager and obtains the information of the Kubernetes cluster managed by it from the Kubernetes manager;
[0026] S102: The data export client requests the information of the Kubernetes cluster from the data export server through the link service provided by the data export server, and the data export server periodically notifies the information of the Kubernetes cluster it has obtained to the data export client;
[0027] S103: The upgrade unit obtains the given information about the upgrade of the Kubernetes cluster and the information of the Kubernetes cluster from the data export client, and performs corresponding upgrade operations on the Kubernetes cluster according to the given information about the upgrade of the Kubernetes cluster and the information of the Kubernetes cluster.
[0028] Preferably, step 101 specifically includes:
[0029] S1011: The data export server links to the tool kubectl of the kubernetes manager, and the kubernetes manager is used to manage the kubernetes cluster;
[0030] S1012: And use the context function of the tool kubectl to write the information of the kubernetes cluster into the specified configuration config of kubectl;
[0031] S1013: The data export server obtains the information of the kubernetes cluster managed by the kubernetes manager from the specified configuration config of kubectl.
[0032] Preferably, it further includes:
[0033] S104: Set the given information about the kubernetes cluster upgrade, and the given information about the kubernetes cluster upgrade includes at least one of the following: the given information about the upgrade of the kubenetes software of the service, the given information about the upgrade of the resources deployed on kubernetes, and the given information about the upgrade of the kubernetes ecosystem software;
[0034] The setting of the given information about the kubernetes cluster upgrade specifically includes:
[0035] S1041: Set whether to upgrade the version of the kubenetes software of the service, the version to be upgraded to during the upgrade, and set the data difference between the version to be upgraded and the current version to form the given information about the upgrade of the kubenetes software of the service;
[0036] S1042: Set whether to upgrade the version of the resources deployed on kubernetes, the version to be upgraded to during the upgrade, and set the data difference between the version to be upgraded and the current version to form the given information about the upgrade of the resources deployed on kubernetes;
[0037] S1043: Set whether to upgrade the version of the kubernetes ecosystem software, the version to be upgraded to during the upgrade, and the data difference between the version to be upgraded and the current version to form the given information about the upgrade of the kubernetes ecosystem software.
[0038] Preferably, the information of the Kubernetes cluster includes: the information of the Kubernetes cluster where the service is located, the information of the Kubernetes resources deployed on Kubernetes, and the information of the Kubernetes ecosystem software;
[0039] Step 103 specifically includes:
[0040] S1031: Identify the upgrade category according to the given information about the Kubernetes cluster upgrade. The upgrade category includes at least one of the following: upgrading the version of the Kubernetes software of the service, upgrading the version of the resources deployed on Kubernetes, and upgrading the version of the Kubernetes ecosystem software;
[0041] S1032: If the upgrade category is to upgrade the version of the Kubernetes software of the service, generate a version upgrade configuration for the Kubernetes software of the service according to the given information about the upgrade of the Kubernetes software of the service and the information of the Kubernetes cluster where the service is located, push the version upgrade configuration of the Kubernetes software of the service to the Kubernetes manager, and request the Kubernetes manager to upgrade the version of the Kubernetes software of the service;
[0042] S1033: If the upgrade category is to upgrade the version of the resources deployed on Kubernetes, generate a version upgrade configuration for the resources deployed on Kubernetes according to the given information about the upgrade of the resources deployed on Kubernetes and the information of the Kubernetes resources deployed on Kubernetes, push the version upgrade configuration of the resources deployed on Kubernetes to the Kubernetes cluster, and request the Kubernetes cluster to upgrade the version of the resources deployed on Kubernetes;
[0043] S1034: If the upgrade category is to upgrade the version of the Kubernetes ecosystem software, generate a version upgrade configuration for the Kubernetes ecosystem software according to the given information about the upgrade of the Kubernetes ecosystem software and the information of the Kubernetes ecosystem software, push the version upgrade configuration of the Kubernetes ecosystem software to the Kubernetes cluster, and request the Kubernetes cluster to upgrade the version of the Kubernetes ecosystem software.
[0044] Preferably, Step 103 specifically includes:
[0045] S1035: The kubernetes manager receives a request to upgrade the version of the kubernetes software for the upgrade service, identifies the current kubernetes version in the kubernetes cluster's own information where the service is located from the upgrade configuration, and identifies the version to which the kubernetes software is to be upgraded in the given information about the kubernetes cluster upgrade from the upgrade configuration; when the version to be upgraded is higher than the current kubernetes version, stop the operation of the kubernetes cluster, and complete the upgrade of the kubernetes software version of the service by modifying the versions of each kubernetes component according to the data difference between the version to be upgraded and the current version in the upgrade configuration.
[0046] S1036: The kubernetes cluster receives a request to upgrade the resources deployed on kubernetes, identifies the current version of the resources in the information of the kubernetes resources deployed on kubernetes from the upgrade configuration, and identifies the version to which the kubernetes resources are to be upgraded in the given information about the kubernetes cluster upgrade from the upgrade configuration; when the version to be upgraded is higher than the current version of the resources, complete the upgrade of the resources deployed on kubernetes by modifying the versions of each kubernetes resource according to the data difference between the version to be upgraded and the current version in the upgrade configuration.
[0047] S1037: The kubernetes cluster receives a request to upgrade the kubernetes ecosystem software upgrade, identifies the current version of the kubernetes ecosystem software in the information of the kubernetes ecosystem software from the upgrade configuration, and identifies the version to which the kubernetes ecosystem software is to be upgraded in the given information about the kubernetes cluster upgrade from the upgrade configuration. When the version to which the kubernetes ecosystem software is to be upgraded is higher than the current version of the kubernetes ecosystem software, upgrade the version of the kubernetes ecosystem software according to the data difference between the version to be upgraded and the current version in the upgrade configuration.
[0048] As Figure 2 shown, in combination with the embodiments of the present invention, a version upgrade system for a kubernetes cluster is provided, including:
[0049] The data export server 21 is used to connect to the kubernetes manager, obtain information about the kubernetes cluster managed by the kubernetes manager; and, when the data export client requests information about the kubernetes cluster, periodically notify the data export client of the information about the kubernetes cluster it has obtained;
[0050] The data export client 22 is used to request information about the kubernetes cluster from the data export server through the link service provided by the data export server;
[0051] The upgrade unit 23 is used to obtain given information about the upgrade of the kubernetes cluster and information about the kubernetes cluster from the data export client, and perform corresponding upgrade operations on the kubernetes cluster according to the given information about the upgrade of the kubernetes cluster and the information about the kubernetes cluster.
[0052] Preferably, it further includes:
[0053] The kubernetes manager is used to manage the kubernetes cluster and write the information about the kubernetes cluster into the specified configuration config of kubectl by using the context function of the tool kubectl;
[0054] The data export server 21 is specifically used to connect to the tool kubectl of the kubernetes manager and obtain the information about the kubernetes cluster managed by the kubernetes manager from the specified configuration config of kubectl.
[0055] Preferably, it further includes:
[0056] The upgrade information setting unit is used to set given information about the upgrade of the kubernetes cluster. The given information about the upgrade of the kubernetes cluster includes at least one of the following: given information about the upgrade of the kubenetes software of the service, given information about the upgrade of the resources deployed on kubernetes, and given information about the upgrade of the kubernetes ecosystem software; The upgrade information setting unit includes:
[0057] The first setting subunit is used to set whether to upgrade the version of the kubenetes software of the service, the version to be upgraded to during the upgrade, and set the data difference between the version to be upgraded and the current version, so as to form the given information about the upgrade of the kubenetes software of the service;
[0058] A second setting subunit, configured to set whether to upgrade the version of the resources deployed on Kubernetes, the version to be upgraded to during the upgrade, and set the data difference between the version to be upgraded and the current version, so as to form given information for upgrading the resources deployed on Kubernetes;
[0059] A third setting subunit, configured to set whether to upgrade the version of the Kubernetes ecosystem software, the version to be upgraded to during the upgrade, and the data difference between the version to be upgraded and the current version, so as to form given information for upgrading the Kubernetes ecosystem software.
[0060] Preferably, the information of the Kubernetes cluster includes: the information of the Kubernetes cluster itself where the service is located, the information of the Kubernetes resources deployed on Kubernetes, and the information of the Kubernetes ecosystem software;
[0061] The upgrade unit includes a design information setting subunit, which is configured to identify the upgrade category according to the given information about the upgrade of the Kubernetes cluster. The upgrade category includes at least one of the following: upgrading the version of the Kubernetes software of the service, upgrading the version of the resources deployed on Kubernetes, and upgrading the version of the Kubernetes ecosystem software;
[0062] If the upgrade category is to upgrade the version of the Kubernetes software of the service, then generate a version upgrade configuration for the Kubernetes software of the service according to the given information for the upgrade of the Kubernetes software of the service and the information of the Kubernetes cluster itself where the service is located, push the version upgrade configuration for the Kubernetes software of the service to the Kubernetes manager, and request the Kubernetes manager to upgrade the version of the Kubernetes software of the service;
[0063] If the upgrade category is to upgrade the version of the resources deployed on Kubernetes, then generate a version upgrade configuration for the resources deployed on Kubernetes according to the given information for the upgrade of the resources deployed on Kubernetes and the information of the Kubernetes resources deployed on Kubernetes, push the version upgrade configuration for the resources deployed on Kubernetes to the Kubernetes cluster, and request the Kubernetes cluster to upgrade the version of the resources deployed on Kubernetes;
[0064] If the upgrade category is to upgrade the version of Kubernetes ecosystem software, a version upgrade configuration for the Kubernetes ecosystem software is generated based on the given information for the Kubernetes ecosystem software upgrade and the information of the Kubernetes ecosystem software. The version upgrade configuration for the Kubernetes ecosystem software is pushed to the Kubernetes cluster, and the Kubernetes cluster is requested to upgrade the version of the Kubernetes ecosystem software.
[0065] Preferably, the upgrade unit 23 further includes:
[0066] A Kubernetes manager, which is used to receive a request to upgrade the version of the Kubernetes software for the upgrade service, identify the current version of Kubernetes in the information of the Kubernetes cluster where the service is located from the upgrade configuration, and identify the version to be upgraded of Kubernetes in the given information about the Kubernetes cluster upgrade from the upgrade configuration; when the version to be upgraded is higher than the current version of Kubernetes, stop the operation of the Kubernetes cluster, and complete the upgrade of the version of the Kubernetes software for the service by modifying the versions of each component of Kubernetes according to the data difference between the version to be upgraded and the current version in the upgrade configuration;
[0067] A Kubernetes cluster, which is used to receive a request to upgrade the resources deployed on Kubernetes, identify the current version of the resources in the information of the Kubernetes resources deployed on Kubernetes from the upgrade configuration, and identify the version to be upgraded of the Kubernetes resources in the given information about the Kubernetes cluster upgrade from the upgrade configuration; when the version to be upgraded is higher than the current version of the resources, complete the upgrade of the resources deployed on Kubernetes by modifying the versions of each Kubernetes resource according to the data difference between the version to be upgraded and the current version in the upgrade configuration;
[0068] The Kubernetes cluster is also used to receive a request to upgrade the Kubernetes ecosystem software upgrade, identify the current version of the Kubernetes ecosystem software in the information of the Kubernetes ecosystem software from the upgrade configuration, and identify the version to be upgraded of the Kubernetes ecosystem software in the given information about the Kubernetes cluster upgrade from the upgrade configuration. When the version to be upgraded of the Kubernetes ecosystem software is higher than the current version of the Kubernetes ecosystem software, upgrade the version of the Kubernetes ecosystem software according to the data difference between the version to be upgraded and the current version in the upgrade configuration.
[0069] The above technical solutions of the embodiments of the present invention will be described in detail below in conjunction with specific application examples. For technical details not introduced during the implementation process, reference can be made to the relevant descriptions in the previous text.
[0070] The technical terms or abbreviations involved in the present invention are as follows:
[0071] Kubernetes: A container orchestration and management tool.
[0072] Kubernetes cluster: It includes all components of the Kubernetes software and the servers running these components.
[0073] Applications on top of Kubernetes: Services deployed using Kubernetes, such as nginx service, mysql service, etc.
[0074] Kubernetes resources: Such as deployment, server, ingress, etc., which are used to deploy services on top of Kubernetes.
[0075] Kubernetes ecosystem software: Such as prometheus monitoring system, alert manager alarm system, helm management tool, etc.
[0076] Container: A container image is a lightweight and independent executable software package of a software, which contains everything required to run it: code, runtime, system tools, system libraries, settings, etc. A container is the running state of the program in the container image.
[0077] The present invention is a method and system for upgrading the version of a Kubernetes cluster. Using this system, the Kubernetes software, applications on top of Kubernetes, and Kubernetes ecosystem software can be upgraded quickly and simply; the process of upgrading Kubernetes is simplified, with simple operation, short upgrade time, and little impact on the business; if the upgrade fails, it can be quickly rolled back to the previous version. Among them, the Kubernetes software itself is a set of software used to manage applications. The applications mentioned here include many software, codes, and configurations. Applications refer to a set of software, codes, and configurations deployed on top of Kubernetes. Ecosystem software refers to software that assists the Kubernetes software for applications deployed on Kubernetes. Ecosystem software is the Kubernetes ecosystem software.
[0078] This system includes multiple components, and each component is responsible for a part of the function.
[0079] Such asFigure 3 As shown below:
[0080] a. Data export agent (data export client):
[0081] As Figure 3 shown in Step 1
[0082] Create a data export agent software, deploy it on a server, link to the data export server, and obtain information such as the name and version of the Kubernetes cluster to be exported, etc.
[0083] b. Data export server (data export server):
[0084] As Figure 3 shown in Step 2
[0085] The role of the data export server is to operate kubectl. Kubectl is a tool for connecting to Kubernetes. After connecting, it can perform operations such as adding, deleting, modifying, and querying Kubernetes.
[0086] This component can control multiple Kubernets. Through the kubectl tool, it links to the Kubernetes manager and obtains information about the Kubernets that can be controlled from the Kubernetes manager.
[0087] Using the context function of kubectl, the apiserver information and cluster name of the Kubernetes cluster can be put into the config configuration required by kubectl. In this way, the kubectl function can be linked to multiple Kubernets. The agent can obtain all the Kubernetes information by only interacting with this component.
[0088] This component provides an HTTP service. The agent requests this HTTP service, which is a long connection service. After connecting, this component notifies the agent of the managed Kubernets. In this way, the agent can passively obtain Kubernetes information. When there are changes in the managed Kubernets, it can notify the agent at regular intervals to synchronize the changes. That is: the data export client requests the information of the Kubernetes cluster from the data export server through the link service provided by the data export server, and the data export server periodically notifies the data export client of the information of the Kubernetes cluster it has obtained.
[0089] c. Kubernetes Manager (belonging to the upgrade unit):
[0090] As shown in step 3 of the figure
[0091] The Kubernetes Manager itself is a Kubernetes plus a manager software. Multiple business Kubernetes are deployed on top of this Kubernetes. This manager creates business Kubernetes and manages its entire life cycle.
[0092] The Kubernetes Manager receives a request to upgrade the version of the Kubernetes software of the business. It identifies the current version of Kubernetes within the self - information of the Kubernetes cluster where the business is located from the upgrade configuration, and identifies the version to which the Kubernetes software is to be upgraded within the given information about the Kubernetes cluster upgrade in the upgrade configuration. When the version to be upgraded is higher than the current version of Kubernetes, it stops the operation of the Kubernetes cluster. Based on the data differences between the version to be upgraded and the current version in the upgrade configuration, it completes the upgrade of the version of the Kubernetes software of the business by modifying the versions of each component of Kubernetes.
[0093] The responsibilities of the manager software are as follows:
[0094] 1. Receive requests from the upgrade and version controller, execute the action of upgrading Kubernetes in the request, and identify which Kubernetes to upgrade and to what version.
[0095] 2. Execute the upgrade operation. The upgrade process is to stop the Kubernetes to be upgraded and modify the versions of Kubernetes components. For example, upgrade the apiserver to 1.20.1 and upgrade etcd to 3.4.5, etc.
[0096] Note: (The upgrade of components such as apiserver and etcd is the upgrade of Kubernetes itself. These components such as apiserver and etcd constitute Kubernetes)
[0097] 3. Return the execution result to the upgrade and version controller so that this component can report the upgrade result to the data storage server and notify the administrator of the upgrade result.
[0098] d. Business Kubernetes (Kubernetes cluster, belonging to the upgrade unit)
[0099] This component is a function provided by the open-source Kubernetes, which can deploy containerized applications and orchestrate and manage the applications. For example, it can deploy an Nginx service to provide a website with an HTTP service for users to access.
[0100] The Kubernetes cluster receives a request to upgrade the resources deployed on Kubernetes, identifies the current version of the resources in the information of the Kubernetes resources deployed on Kubernetes from the upgrade configuration, and identifies the version to which the Kubernetes resources are to be upgraded in the given information about the Kubernetes cluster upgrade from the upgrade configuration; when the version to be upgraded is higher than the current version of the resources, the upgrade of the resources deployed on Kubernetes is completed by modifying the versions of the various Kubernetes resources according to the data difference between the version to be upgraded and the current version in the upgrade configuration.
[0101] The Kubernetes cluster receives a request to upgrade the Kubernetes ecosystem software upgrade, identifies the current version of the Kubernetes ecosystem software in the information of the Kubernetes ecosystem software from the upgrade configuration, and identifies the version to which the Kubernetes ecosystem software is to be upgraded in the given information about the Kubernetes cluster upgrade from the upgrade configuration. When the version to which the Kubernetes ecosystem software is to be upgraded is higher than the current version of the Kubernetes ecosystem software, the version of the Kubernetes ecosystem software is upgraded according to the data difference between the version to be upgraded and the current version in the upgrade configuration.
[0102] It also includes: a data storage server
[0103] Such as Figure 3 As shown in Step 4, the data export agent obtains the self-information of the Kubernetes cluster (including: the name of the business Kubernetes cluster, version information, and version information of the Kubernetes software) from the data export server, and the information of the Kubernetes resources deployed on the business Kubernetes (including: the Kubernetes resources deployed on the business Kubernetes and the version information of these resources, such as the cluster name of the Kubernetes is the web service Kubernetes cluster, the version is 1.17.3, and the version of the Kubernetes resource deployment is apps / v1, etc.).
[0104] The upgrade unit obtains given information about the upgrade of the Kubernetes cluster and information about the Kubernetes cluster from the data export client, and performs corresponding upgrade operations on the Kubernetes cluster according to the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster.
[0105] e. Upgrade and version manager (belonging to the upgrade unit)
[0106] As Figure 3 Shown in step 5, this component obtains the version information of the Kubernetes cluster from the data storage server and the information to be upgraded given by the administrator (the given information for the upgrade of the business's Kubernetes software, the given information for the upgrade of the resources deployed on Kubernetes, the given information for the upgrade of the Kubernetes ecosystem software), and combines these two pieces of information, as Figure 3 Shown in step 6.
[0107] The upgrade categories include at least one of the following: upgrading the version of the business's Kubernetes software, upgrading the version of the resources deployed on Kubernetes, and upgrading the version of the Kubernetes ecosystem software.
[0108] A part of the data related to the Kubernetes cluster version is pushed to the Kubernetes manager, requesting the Kubernetes manager to upgrade the business's Kubernetes version. If the upgrade category is to upgrade the version of the business's Kubernetes software (Kubernetes cluster version), then a version upgrade configuration for the business's Kubernetes software is generated based on the given information for the upgrade of the business's Kubernetes software and the information of the Kubernetes cluster where the business is located, the version upgrade configuration for the business's Kubernetes software is pushed to the Kubernetes manager, and the Kubernetes manager is requested to upgrade the business's Kubernetes software version.
[0109] Wait for this part to end, as Figure 3As shown in step 7, the business-related content is pushed to the business kubernetes (i.e., the kubernetes cluster), and various resources of the business kubernetes deployed above the business kubernetes are upgraded (that is, the application or business is upgraded because the application or business is composed of various resources). If the upgrade category is to upgrade the version of the resources deployed on kubernetes, then according to the given information of the upgrade of the resources deployed on kubernetes and the information of the kubernetes resources deployed on kubernetes, a version upgrade configuration of the resources deployed on kubernetes is generated, and the version upgrade configuration of the resources deployed on kubernetes is pushed to the kubernetes cluster, requesting the kubernetes cluster to upgrade the version of the resources deployed on kubernetes.
[0110] There is also the version of the business kubernetes ecological software. If the upgrade category is to upgrade the version of the kubernetes ecological software, then according to the given information of the upgrade of the kubernetes ecological software and the information of the kubernetes ecological software, a version upgrade configuration of the kubernetes ecological software is generated, and the version upgrade configuration of the kubernetes ecological software is pushed to the kubernetes cluster, requesting the kubernetes cluster to upgrade the version of the kubernetes ecological software.
[0111] Also, the process of upgrading, how to upgrade, to what version to upgrade, and what software to upgrade are defined by the administrator in the administrator interface. This component only performs the pre-determined upgrade.
[0112] After the upgrade is completed, the upgrade result is reported to the data storage server, and the upgraded status data, such as whether the upgrade is successful and to what version it is upgraded, is bound to the object to be upgraded.
[0113] After the upgrade is completed, the administrator is notified of the upgrade result by sending an email.
[0114] f. Administrator interface (design information setting subunit, belonging to the upgrade unit):
[0115] The administrator interface provides the following functions:
[0116] 1. Set whether to upgrade the version of the resources deployed on kubernetes, the version to be upgraded to during the upgrade, and set the data difference between the version to be upgraded and the current version, forming the given information for the upgrade of the resources deployed on kubernetes. That is, it defines whether the business (also called the application) deployed on the business kubernetes needs to be upgraded and to what version.
[0117] 2. Set the version of the Kubernetes software for whether to upgrade the service, the version to be upgraded to during the upgrade, and set the data difference between the version to be upgraded and the current version, forming the given information for the upgrade of the Kubernetes software of the service. That is, define for the service Kubernetes whether to upgrade the Kubernetes software itself and to what version.
[0118] 3. Set the version of the Kubernetes ecosystem software for whether to upgrade, the version to be upgraded to during the upgrade, and the data difference between the version to be upgraded and the current version, forming the given information for the upgrade of the Kubernetes ecosystem software. That is, define for the service and Kubernetes whether it is necessary to upgrade the Kubernetes ecosystem software, which software needs to be upgraded, and to what version.
[0119] 4. Define the data difference before the Kubernetes version for use by the upgrade and version manager. Through the difference data, the upgrade and version manager modify some current configurations.
[0120] 5. According to the upgrade results of the upgrade and version manager, select to roll back the failed upgrade, and roll back the upgrade of the Kubernetes software, the applications above Kubernetes, and the Kubernetes ecosystem software.
[0121] The Kubernetes software itself is a set of software used to manage applications. The applications mentioned here include many software, codes, and configurations.
[0122] The application refers to a set of software, codes, and configurations deployed on Kubernetes.
[0123] The Kubernetes ecosystem software refers to the software that assists the Kubernetes software for the applications deployed on Kubernetes.
[0124] The beneficial effects achieved by the present invention are as follows:
[0125] 1. Upgrade the Kubernetes software, the services deployed on Kubernetes, and the Kubernetes ecosystem software together
[0126] 2. Simplify the process of upgrading Kubernetes, with simple operations, short upgrade time, and little impact on the service.
[0127] 3. Simple operation and convenient use, and you can choose any version for upgrade.
[0128] 4. If the upgrade fails, it can quickly roll back to the previous version.
[0129] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of the present disclosure. The appended method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy recited.
[0130] In the above detailed description, various features are combined in a single embodiment to simplify the present disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are expressly recited in each claim. On the contrary, as reflected in the appended claims, the invention lies in less than all of the features of a single disclosed embodiment. Accordingly, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing alone as a separate preferred embodiment of the invention.
[0131] The above-described embodiments have been described so as to enable any person skilled in the art to make or use the present invention. For those skilled in the art, various modifications to these embodiments will be readily apparent, and the general principles defined herein may be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments given herein, but is consistent with the broadest scope of the principles and novel features disclosed in this application.
[0132] The above description includes examples of one or more embodiments. Of course, it is not possible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but those of ordinary skill in the art should recognize that the various embodiments can be further combined and arranged. Accordingly, the embodiments described herein are intended to cover all such changes, modifications, and variations that fall within the scope of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, this term is inclusive in a manner similar to the term "including", as interpreted when "including" is used as a transitional word in the claims. In addition, any use of the term "or" in the claims or specification is intended to mean "non-exclusive or".
[0133] Those skilled in the art can also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention can be implemented by electronic hardware, computer software, or a combination of both. To clearly show the interchangeability of hardware and software, the above-mentioned various illustrative components, units, and steps have been generally described in terms of their functions. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art can use various methods to implement the described functions for each specific application, but such implementation should not be construed as exceeding the scope of protection of the embodiments of the present invention.
[0134] In the embodiments of the present invention, the various illustrative logical blocks or units can be implemented or operated to perform the described functions by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array, or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of the above designs. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller, or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, multiple microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.
[0135] The steps of the methods or algorithms described in the embodiments of the present invention can be directly embedded in hardware, software modules executed by a processor, or a combination of the two. The software modules can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be disposed in an ASIC, and the ASIC can be disposed in a user terminal. Optionally, the processor and the storage medium can also be disposed in different components of the user terminal.
[0136] In one or more exemplary designs, the functions described in embodiments of the present invention may be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, these functions may be stored on a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. A computer-readable medium includes both computer storage media and communication media that facilitate transfer of a computer program from one place to another. The storage media may be any available media that can be accessed by a general-purpose or special-purpose computer. By way of example, and not limitation, such computer-readable media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store program code in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. In addition, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source via a coaxial cable, fiber optic cable, twisted pair, DSL, or wireless means such as infrared, radio, and microwave, it is included in the definition of computer-readable medium. Disk and disc include compact disk, laser disk, optical disk, DVD, floppy disk, and Blu-ray disk, where disks usually reproduce data magnetically, while discs usually reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable medium.
[0137] The specific embodiments described above have further elaborated on the objectives, technical solutions, and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for upgrading the version of a Kubernetes cluster, characterized in that Including: The data export server is linked to the Kubernetes manager to obtain information about the Kubernetes clusters it manages from within the Kubernetes manager; The data export client requests information about the Kubernetes cluster from the data export server through the link service provided by the data export server, and the data export server periodically notifies the data export client of the information about the Kubernetes cluster it has obtained; The upgrade unit obtains given information about the upgrade of the Kubernetes cluster and information about the Kubernetes cluster from the data export client, and performs corresponding upgrade operations on the Kubernetes cluster according to the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster.
2. The method for upgrading the version of a Kubernetes cluster according to claim 1, characterized in that The data export server is linked to the Kubernetes manager to obtain information about the Kubernetes clusters it manages, specifically including: The data export server uses the context function of the tool kubectl to write the information about the Kubernetes cluster into the specified configuration config of kubectl; wherein, the data export server is linked to the Kubernetes manager through the tool kubectl, and the Kubernetes manager is used to manage the Kubernetes cluster; The data export server obtains the information about the Kubernetes clusters managed by the Kubernetes manager from the specified configuration config of kubectl.
3. The method for upgrading the version of a Kubernetes cluster according to claim 1, characterized in that It also includes: Setting given information about the upgrade of the Kubernetes cluster, and the given information about the upgrade of the Kubernetes cluster includes at least one of the following: given information about the upgrade of the Kubernetes software of the service, given information about the upgrade of the resources deployed on Kubernetes, and given information about the upgrade of the Kubernetes ecosystem software; The setting of the given information about the upgrade of the Kubernetes cluster specifically includes: Setting whether to upgrade the version of the Kubernetes software of the service, the version to be upgraded to during the upgrade, and setting the data difference between the version to be upgraded and the current version to form the given information about the upgrade of the Kubernetes software of the service; Setting whether to upgrade the version of the resources deployed on Kubernetes, the version to be upgraded to during the upgrade, and setting the data difference between the version to be upgraded and the current version to form the given information about the upgrade of the resources deployed on Kubernetes; Setting whether to upgrade the version of the Kubernetes ecosystem software, the version to be upgraded to during the upgrade, and the data difference between the version to be upgraded and the current version to form the given information about the upgrade of the Kubernetes ecosystem software.
4. The method for upgrading the version of a Kubernetes cluster according to claim 3, characterized in that The information of the Kubernetes cluster includes: the information of the Kubernetes cluster itself where the service is located, the information of the Kubernetes resources deployed on Kubernetes, and the information of the Kubernetes ecosystem software; Obtaining the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster from the data export client, and performing corresponding upgrade operations on the Kubernetes cluster according to the given information about the upgrade of the Kubernetes cluster and the information of the Kubernetes cluster, specifically including: Identifying the upgrade category according to the given information about the upgrade of the Kubernetes cluster, and the upgrade category includes at least one of the following: upgrading the version of the Kubernetes software of the service, upgrading the version of the resources deployed on Kubernetes, and upgrading the version of the Kubernetes ecosystem software; If the upgrade category is to upgrade the version of the Kubernetes software of the service, then generate a version upgrade configuration for the Kubernetes software of the service according to the given information about the upgrade of the Kubernetes software of the service and the information of the Kubernetes cluster where the service is located, push the version upgrade configuration of the Kubernetes software of the service to the Kubernetes manager, and request the Kubernetes manager to upgrade the version of the Kubernetes software of the service; If the upgrade category is to upgrade the version of the resources deployed on Kubernetes, then generate a version upgrade configuration for the resources deployed on Kubernetes according to the given information about the upgrade of the resources deployed on Kubernetes and the information of the Kubernetes resources deployed on Kubernetes, push the version upgrade configuration of the resources deployed on Kubernetes to the Kubernetes cluster, and request the Kubernetes cluster to upgrade the version of the resources deployed on Kubernetes; If the upgrade category is to upgrade the version of the Kubernetes ecosystem software, then generate a version upgrade configuration for the Kubernetes ecosystem software according to the given information about the upgrade of the Kubernetes ecosystem software and the information of the Kubernetes ecosystem software, push the version upgrade configuration of the Kubernetes ecosystem software to the Kubernetes cluster, and request the Kubernetes cluster to upgrade the version of the Kubernetes ecosystem software.
5. The method for upgrading the version of a Kubernetes cluster according to claim 4, characterized in that Obtaining the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster from the data export client, and performing corresponding upgrade operations on the Kubernetes cluster according to the given information about the upgrade of the Kubernetes cluster and the information of the Kubernetes cluster, specifically including: The Kubernetes manager receives a request to upgrade the version of the Kubernetes software for a service. It identifies the current version of Kubernetes within the self - upgrade configuration in the information of the Kubernetes cluster where the service is located, and identifies the version to which the Kubernetes software is to be upgraded in the given information about the Kubernetes cluster upgrade in the self - upgrade configuration. When the version to be upgraded is higher than the current version of Kubernetes, it stops the operation of the Kubernetes cluster and completes the upgrade of the version of the Kubernetes software for the service by modifying the versions of each component of Kubernetes according to the data differences between the version to be upgraded and the current version in the upgrade configuration. The Kubernetes cluster receives a request to upgrade the resources deployed on Kubernetes. It identifies the current version of the resources within the self - upgrade configuration in the information of the Kubernetes resources deployed on Kubernetes, and identifies the version to which the Kubernetes resources are to be upgraded in the given information about the Kubernetes cluster upgrade in the self - upgrade configuration. When the version to be upgraded is higher than the current version of the resources, it completes the upgrade of the resources deployed on Kubernetes by modifying the versions of each Kubernetes resource according to the data differences between the version to be upgraded and the current version in the upgrade configuration. The Kubernetes cluster receives a request to upgrade the Kubernetes ecosystem software. It identifies the current version of the Kubernetes ecosystem software within the self - upgrade configuration in the information of the Kubernetes ecosystem software, and identifies the version to which the Kubernetes ecosystem software is to be upgraded in the given information about the Kubernetes cluster upgrade in the self - upgrade configuration. When the version to be upgraded of the Kubernetes ecosystem software is higher than the current version, it upgrades the version of the Kubernetes ecosystem software according to the data differences between the version to be upgraded and the current version in the upgrade configuration.
6. A system for upgrading the version of a Kubernetes cluster, characterized in that It includes: A data export server for connecting to the Kubernetes manager to obtain the information of the Kubernetes cluster it manages, and periodically notifying the data export client of the information of the Kubernetes cluster it has obtained when the data export client requests the information of the Kubernetes cluster. A data export client for requesting the information of the Kubernetes cluster from the data export server through the link service provided by the data export server. An upgrade unit, configured to obtain given information about the upgrade of a Kubernetes cluster and information about the Kubernetes cluster from a data export client, and perform corresponding upgrade operations on the Kubernetes cluster according to the given information about the upgrade of the Kubernetes cluster and the information about the Kubernetes cluster.
7. The system for upgrading the version of a Kubernetes cluster according to claim 6, characterized in that It further includes: A Kubernetes manager, configured to manage the Kubernetes cluster; The data export server is specifically configured to write the information about the Kubernetes cluster into the specified configuration config of kubectl by using the context function of the tool kubectl, and obtain the information about the Kubernetes cluster managed by the Kubernetes manager from the specified configuration config of kubectl; wherein, the data export server is linked to the Kubernetes manager through the tool kubectl.
8. The version upgrade system of the kubernetes cluster according to claim 6, wherein, It further includes: An upgrade information setting unit, configured to set given information about the upgrade of the Kubernetes cluster, and the given information about the upgrade of the Kubernetes cluster includes at least one of the following: given information about the upgrade of the kubenetes software of the service, given information about the upgrade of the resources deployed on Kubernetes, and given information about the upgrade of the Kubernetes ecosystem software; The upgrade information setting unit includes: A first setting subunit, configured to set whether to upgrade the version of the kubenetes software of the service, the version to be upgraded to during the upgrade, and set the data difference between the version to be upgraded and the current version, so as to form given information about the upgrade of the kubenetes software of the service; A second setting subunit, configured to set whether to upgrade the version of the resources deployed on Kubernetes, the version to be upgraded to during the upgrade, and set the data difference between the version to be upgraded and the current version, so as to form given information about the upgrade of the resources deployed on Kubernetes; A third setting subunit, configured to set whether to upgrade the version of the Kubernetes ecosystem software, the version to be upgraded to during the upgrade, and the data difference between the version to be upgraded and the current version, so as to form given information about the upgrade of the Kubernetes ecosystem software.
9. The version upgrade system of the kubernetes cluster according to claim 8, wherein, The information about the Kubernetes cluster includes: the information of the Kubernetes cluster where the service is located, the information of the Kubernetes resources deployed on Kubernetes, and the information of the Kubernetes ecosystem software; The upgrade unit includes a design information setting subunit; The design information setting subunit is configured to identify the upgrade category according to the given information about the upgrade of the Kubernetes cluster, and the upgrade category includes at least one of the following: upgrading the version of the Kubernetes software of the service, upgrading the version of the resources deployed on Kubernetes, and upgrading the version of the Kubernetes ecosystem software; If the upgrade category is to upgrade the version of the Kubernetes software for the business, generate the version upgrade configuration for the Kubernetes software of the business based on the given information of the Kubernetes software upgrade for the business and the information of the Kubernetes cluster where the business is located, push the version upgrade configuration of the Kubernetes software of the business to the Kubernetes manager, and request the Kubernetes manager to upgrade the version of the Kubernetes software of the business; If the upgrade category is to upgrade the version of the resources deployed on Kubernetes, generate the version upgrade configuration of the resources deployed on Kubernetes based on the given information of the resource upgrade deployed on Kubernetes and the information of the Kubernetes resources deployed on Kubernetes, push the version upgrade configuration of the resources deployed on Kubernetes to the Kubernetes cluster, and request the Kubernetes cluster to upgrade the version of the resources deployed on Kubernetes; If the upgrade category is to upgrade the version of the Kubernetes ecosystem software, generate the version upgrade configuration of the Kubernetes ecosystem software based on the given information of the Kubernetes ecosystem software upgrade and the information of the Kubernetes ecosystem software, push the version upgrade configuration of the Kubernetes ecosystem software to the Kubernetes cluster, and request the Kubernetes cluster to upgrade the version of the Kubernetes ecosystem software.
10. The version upgrade system of the kubernetes cluster according to claim 9, wherein, The upgrade unit further includes: The Kubernetes manager is used to receive the request to upgrade the version of the Kubernetes software for the business, identify the current version of Kubernetes in the information of the Kubernetes cluster where the business is located from the upgrade configuration, and identify the version to which the Kubernetes software is to be upgraded in the given information about the Kubernetes cluster upgrade from the upgrade configuration; when the version to be upgraded is higher than the current version of Kubernetes, stop the work of the Kubernetes cluster, and complete the upgrade of the version of the Kubernetes software for the business by modifying the versions of the various components of Kubernetes according to the data difference between the version to be upgraded and the current version in the upgrade configuration; A Kubernetes cluster is used to receive requests for upgrading resources deployed on Kubernetes, identify the current version of the resources in the information of the Kubernetes resources deployed on Kubernetes from the self-upgrade configuration, and identify the version to which the Kubernetes resources are to be upgraded in the given information about the Kubernetes cluster upgrade from the self-upgrade configuration; when the version to be upgraded is higher than the current version of the resources, the upgrade of the resources deployed on Kubernetes is completed by modifying the versions of the various Kubernetes resources according to the data difference between the version to be upgraded and the current version in the upgrade configuration. The Kubernetes cluster is also used to receive requests for upgrading the Kubernetes ecosystem software, identify the current version of the Kubernetes ecosystem software in the information of the Kubernetes ecosystem software from the self-upgrade configuration, and identify the version to which the Kubernetes ecosystem software is to be upgraded in the given information about the Kubernetes cluster upgrade from the self-upgrade configuration. When the version to be upgraded of the Kubernetes ecosystem software is higher than the current version of the Kubernetes ecosystem software, the version of the Kubernetes ecosystem software is upgraded according to the data difference between the version to be upgraded and the current version in the upgrade configuration.
Citation Information
Patent Citations
Micro-service cluster deployment method and device, computer equipment and storage medium
CN111666080A
service deployment method and device for multiple Kubernetes clusters
CN113849266A