Kubernetes cluster version automatic upgrading method and system

By creating version update resources and configuring controllers in the Kubernetes cluster, the version upgrade task is automatically executed, which solves the problem of lack of automated upgrade in the existing technology, realizes safe and automated upgrade of the cluster version, and reduces the risk of failure and waste of resources. Improved upgrade reliability and consistency.

CN118708207APending Publication Date: 2024-09-27LINYI YUPING NETWORK TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410858258.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

The existing Kubernetes cluster version upgrade process lacks automation, resulting in system administrators needing to manually perform complex upgrade steps. There is a problem that manual intervention is required when the upgrade fails, and the replacement upgrade method takes up additional resources and wastes resources.

Method used

By creating version update resources and configuring version update controllers in the Kubernetes cluster, listening for update events, and automatically performing version upgrade tasks, including version image replacement, node restart, functional verification and recovery operations, the automated upgrade process is implemented and based on the upgrade plan and The number of nodes performs mirror replacement operations regularly or in parallel.

Benefits of technology

It realizes safe, automatic and controllable upgrade of Kubernetes cluster version, reduces the risk of manual operation errors, improves the reliability and consistency of the upgrade, reduces the risk of failure and waste of resources, and ensures the stability and availability of the cluster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118708207A
    Figure CN118708207A
Patent Text Reader

Abstract

The invention relates to the technical field of Kubernetes clusters, and discloses a Kubernetes cluster version automatic upgrading method and system.The method comprises the steps that version updating resources are created in a CRD form in a Kubernetes cluster, and a version updating controller is configured for the version updating resources; monitoring a cluster updating event by using a version updating controller, and acquiring version updating data from the version updating resource under the condition that the version updating controller monitors the cluster updating event; and according to the version updating data, executing a version updating task of the cluster and feeding back a version updating state. By introducing the self-defined resources and the task controller and automatically upgrading the cluster version, the risk of errors caused by manual operation is reduced, so that the cost of managing the cluster is reduced, in addition, it is ensured that upgrading is carried out according to the same step and standard each time, the reliability and consistency of upgrading are improved, and the upgrading efficiency is improved. And unforeseen circumstances and fault risks are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Kubernetes clusters, and in particular to a method and system for automatically upgrading Kubernetes cluster versions. Background Art

[0002] Kubernetes is an open source system for automatically deploying, scaling, and managing containerized applications. The Kubernetes open source community updates versions several times a year, bringing new features, improvements, and fixes. Kubernetes follows the "N-2" support policy, which means that the three most recent minor versions receive security and bug fixes, and a version is usually supported for about 14 months. Therefore, as a Kubernetes user, system administrators usually need to upgrade their version every once in a while.

[0003] In a Kubernetes cluster, version upgrade is an important task, which may involve multiple complex steps, including backing up data, evicting nodes, replacing component images, verifying service availability, etc. Currently, Kubernetes version upgrades are usually done manually by system administrators, and there are two solutions according to the upgrade method:

[0004] 1. In-place upgrade: This method is performed manually by the system administrator on the original cluster based on cluster management tools or scripts. Common cluster management tools include juju, kubeadm, kops, kubespray, etc. For example, the invention patent CN113312063B, a method for rapid deployment and upgrade of software systems based on Kubernetes, describes this upgrade method.

[0005] 2. Replacement upgrade: Different from in-place upgrade, this method directly builds a new version of Kubernetes cluster, migrates the applications on the original cluster to the new cluster, and then switches the traffic between the old and new clusters. The new cluster provides services to the outside world, and the old cluster is abandoned.

[0006] The first solution of the above-mentioned scheme is to upgrade in place. Although it does not occupy additional resources, it usually cannot solve the problem of upgrade automation, that is, the system administrator usually needs to rely on tools or scripts to manually perform the upgrade steps, such as: system backup, new version image file distribution, service restart, and post-upgrade verification. For example, the Kubernetes-based software system rapid deployment upgrade method disclosed in the invention patent CN113312063B only describes the version update part of the upgrade process, and cannot complete the automation of the entire process. If the upgrade process fails, it often relies on the administrator's manual intervention to perform a rollback operation.

[0007] The second solution in the above scheme is replacement and upgrade. Although the upgrade risk is lower than that of in-place upgrade, it requires additional resources to build a new cluster. After the upgrade and replacement, the old cluster is abandoned. When the business scale is large, the waste of resources caused by this solution is usually not negligible.

[0008] Therefore, how to provide a method and system for completing Kubernetes cluster version upgrades in a safe, automatic and controllable manner is an urgent problem to be solved. Summary of the invention

[0009] The present invention provides a Kubernetes cluster version automatic upgrade method and system to solve the above technical problems in the prior art.

[0010] According to a first aspect of the present invention, a method for automatically upgrading a Kubernetes cluster version is provided.

[0011] The Kubernetes cluster version automatic upgrade method includes:

[0012] Create a version update resource in the form of a CRD in the Kubernetes cluster, and configure a version update controller for the version update resource;

[0013] Using the version update controller to monitor Kubernetes cluster update events, and when the version update controller monitors the Kubernetes cluster update events, obtaining version update data from the version update resource;

[0014] According to the version update data, the version upgrade task of the Kubernetes cluster is executed and the version upgrade status is fed back.

[0015] Among them, the version update resources include: upgrade task name, namespace to which the upgrade task belongs, upgrade task image, upgrade task specification and upgrade task status; wherein, the upgrade task specification includes: upgrade task plan, upgrade task steps and target version information; the upgrade task status includes: current progress of the upgrade, amount of data of successful nodes and number of failed nodes.

[0016] Among them, according to the version update data, executing the version upgrade task of the Kubernetes cluster includes: replacing the version image of the current Kubernetes cluster node according to the upgrade specifications and upgrade task image in the version update data; and restarting the current Kubernetes cluster node if the replacement is successful.

[0017] In addition, according to the version update data, executing the version upgrade task of the Kubernetes cluster also includes:

[0018] After the current Kubernetes cluster node is successfully restarted, the Pod status and / or control plane component status of the current Kubernetes cluster node is obtained; if all Pod status and / or all control plane component status of the current Kubernetes cluster node are started, it is determined that the current Kubernetes cluster node version upgrade is successful; otherwise, it is determined that the current Kubernetes cluster node version upgrade has failed, and the pre-backup data is searched in the Kubernetes cluster host node directory to perform the recovery operation;

[0019] After the current Kubernetes cluster node is successfully restarted, a test service is deployed in the current Kubernetes cluster node, and the Kubernetes cluster node is tested using the test service. If the test result shows that all functions of the current Kubernetes cluster node can be started or run normally, the current Kubernetes cluster node version upgrade is determined to be successful; otherwise, the current Kubernetes cluster node version upgrade is determined to have failed, and the pre-backed-up data is searched in the Kubernetes cluster host node directory to perform a recovery operation.

[0020] Among them, when the version image of the current Kubernetes cluster node is replaced according to the upgrade specifications and upgrade task images in the version update data, the version image replacement operation of the Kubernetes cluster node is executed periodically or the version image replacement operations of multiple Kubernetes cluster nodes are executed in parallel according to the planned time or number of nodes in the upgrade task plan.

[0021] According to a second aspect of the present invention, a Kubernetes cluster version automatic upgrade system is provided.

[0022] The Kubernetes cluster version automatic upgrade system includes:

[0023] A custom deployment module, used to create version update resources in the form of CRD in the Kubernetes cluster and configure a version update controller for the version update resources;

[0024] A task monitoring module, used to monitor Kubernetes cluster update events using the version update controller, and obtain version update data from the version update resource when the version update controller monitors the Kubernetes cluster update event;

[0025] The version upgrade module is used to execute the version upgrade task of the Kubernetes cluster according to the version update data and feedback the version upgrade status.

[0026] Among them, the version update resources include: upgrade task name, namespace to which the upgrade task belongs, upgrade task image, upgrade task specification and upgrade task status; wherein, the upgrade task specification includes: upgrade task plan, upgrade task steps and target version information; the upgrade task status includes: current progress of the upgrade, amount of data of successful nodes and number of failed nodes.

[0027] Among them, when the version upgrade module executes the version upgrade task of the Kubernetes cluster according to the version update data, it replaces the version image of the current Kubernetes cluster node according to the upgrade specifications and upgrade task image in the version update data; and restarts the current Kubernetes cluster node if the replacement is successful.

[0028] In addition, when the version upgrade module executes the version upgrade task of the Kubernetes cluster according to the version update data, after the current Kubernetes cluster node is restarted successfully, the Pod status and / or control plane component status of the current Kubernetes cluster node is obtained; when all Pod statuses and / or all control plane component statuses of the current Kubernetes cluster node are started, it is determined that the current Kubernetes cluster node version upgrade is successful; otherwise, it is determined that the current Kubernetes cluster node version upgrade has failed, and the pre-backup data is searched in the Kubernetes cluster host node directory to perform a recovery operation; after the current Kubernetes cluster node is restarted successfully, a test service is deployed in the current Kubernetes cluster node, and the Kubernetes cluster node is tested using the test service. When the test result shows that all functions of the current Kubernetes cluster node can be started or run normally, it is determined that the current Kubernetes cluster node version upgrade is successful; otherwise, it is determined that the current Kubernetes cluster node version upgrade has failed, and the pre-backup data is searched in the Kubernetes cluster host node directory to perform a recovery operation.

[0029] Among them, when the version upgrade module replaces the version image of the current Kubernetes cluster node according to the upgrade specifications and upgrade task image in the version update data, it periodically executes the version image replacement operation of the Kubernetes cluster node or executes the version image replacement operation of multiple Kubernetes cluster nodes in parallel according to the planned time or number of nodes in the upgrade task plan.

[0030] The technical solution provided by the present invention may include the following beneficial effects:

[0031] The present invention introduces custom resources and task controllers to automate the various steps of cluster version upgrades, reducing the risk of manual operation errors, thereby reducing the cost of managing the cluster. In addition, through a standardized and automated upgrade process, it is ensured that each upgrade is performed in accordance with the same steps and standards, thereby improving the reliability and consistency of the upgrade and reducing the risk of unexpected situations and failures.

[0032] In addition, since the present invention is based on custom resources, it allows users to customize upgrade plans and processes according to their own needs and environment, and can flexibly configure upgrade steps and strategies to meet specific business needs and security standards. Through automated upgrade, verification, and recovery steps, it is ensured that the impact of the upgrade process on the cluster is minimized, and the stability and availability of the cluster are maintained. Even if problems occur during the upgrade process, they can be quickly restored to the previous state, reducing the impact on the business.

[0033] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0035] Figure 1 This is a flow chart of a method for automatically upgrading a Kubernetes cluster version according to an exemplary embodiment;

[0036] Figure 2 It is a structural block diagram of a Kubernetes cluster version automatic upgrade system according to an exemplary embodiment;

[0037] Figure 3 The figure is a schematic diagram showing the structure of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION

[0038] The following description and accompanying drawings fully illustrate the specific embodiments of this article so that those skilled in the art can practice them. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The scope of the embodiments of this article includes the entire scope of the claims, as well as all available equivalents of the claims. Herein, the terms "first", "second", etc. are only used to distinguish one element from another, without requiring or implying any actual relationship or order between these elements. In fact, the first element can also be called the second element, and vice versa. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the structure, device or equipment including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such structure, device or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the structure, device or equipment including the elements. Each embodiment is described in a progressive manner herein, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other.

[0039] The terms "longitudinal", "lateral", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. in this document indicate the orientation or position relationship based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing this document and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In the description of this document, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a mechanical connection or an electrical connection, it can also be the internal communication of two elements, it can be a direct connection, or it can be an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0040] As used herein, the term "plurality" means two or more than two, unless otherwise specified.

[0041] In this document, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B means: A or B.

[0042] In this article, the term "and / or" is a description of the association relationship between objects, indicating that three relationships may exist. For example, A and / or B means: A or B, or, A and B.

[0043] It should be understood that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0044] Each module in the device or system of the present application can be implemented in whole or in part by software, hardware, or a combination thereof. The above modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above modules.

[0045] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0046] Figure 1 An embodiment of a Kubernetes cluster version automatic upgrade method of the present invention is shown.

[0047] In this optional embodiment, the Kubernetes cluster version automatic upgrade method includes:

[0048] Step S101, creating a version update resource in the form of a CRD in the Kubernetes cluster, and configuring a version update controller for the version update resource;

[0049] Step S103, using the version update controller to monitor Kubernetes cluster update events, and when the version update controller monitors the Kubernetes cluster update events, obtaining version update data from the version update resource;

[0050] Step S105: execute the version upgrade task of the Kubernetes cluster according to the version update data and feedback the version upgrade status.

[0051] Figure 2 An embodiment of a Kubernetes cluster version automatic upgrade system of the present invention is shown.

[0052] In this optional embodiment, the Kubernetes cluster version automatic upgrade system includes:

[0053] A custom deployment module 201 is used to create a version update resource in the form of a CRD in the Kubernetes cluster and configure a version update controller for the version update resource;

[0054] The task monitoring module 203 is used to monitor the Kubernetes cluster update event by using the version update controller, and obtain the version update data from the version update resource when the version update controller monitors the Kubernetes cluster update event;

[0055] The version upgrade module 205 is used to execute the version upgrade task of the Kubernetes cluster according to the version update data and feedback the version upgrade status.

[0056] In specific applications, the version update resources include: upgrade task name, namespace to which the upgrade task belongs, upgrade task image, upgrade task specification and upgrade task status; wherein, the upgrade task specification includes: upgrade task plan, upgrade task steps and target version information; the upgrade task status includes: current progress of the upgrade, amount of data of successful nodes and number of failed nodes.

[0057] When executing the version upgrade task of the Kubernetes cluster according to the version update data, the version image of the current Kubernetes cluster node can be replaced according to the upgrade specifications and upgrade task images in the version update data; and if the replacement is successful, restart the current Kubernetes cluster node; after the current Kubernetes cluster node is successfully restarted, obtain the Pod status and / or control plane component status of the current Kubernetes cluster node; if all Pod statuses and / or all control plane component statuses of the current Kubernetes cluster node are started, determine that the current Kubernetes cluster node version upgrade is successful; otherwise, determine that the current Kubernetes cluster node version upgrade has failed, and search for pre-backup data in the Kubernetes cluster host node directory to perform a recovery operation; and / or after the current Kubernetes cluster node is successfully restarted, deploy a test service in the current Kubernetes cluster node, and use the test service to test the Kubernetes cluster node. If the test result shows that all functions of the current Kubernetes cluster node can be started or run normally, determine that the current Kubernetes cluster node version upgrade is successful; otherwise, determine that the current Kubernetes cluster node version upgrade has failed, and search for pre-backup data in the Kubernetes cluster host node directory to perform a recovery operation.

[0058] In addition, in specific applications, in order to achieve automated upgrades, when the version image of the current Kubernetes cluster node is replaced according to the upgrade specifications and upgrade task image in the version update data, the version image replacement operation of the Kubernetes cluster node can be executed periodically or the version image replacement operation of multiple Kubernetes cluster nodes can be executed in parallel according to the planned time or number of nodes in the upgrade task plan.

[0059] In order to facilitate understanding of the above technical solutions of the present invention, the above technical solutions of the present invention are further illustrated below through specific examples.

[0060] Assume that a Kubernetes cluster consists of 3 control plane nodes and 10 worker nodes. Now the cluster needs to be upgraded from Kubernetes version 1.21 to version 1.22, and the above-mentioned automated upgrade method is used for the upgrade. The specific implementation method is as follows:

[0061] The administrator uses kubectl or other Kubernetes API clients to create a custom resource type named UpdateJob in the cluster. The definition of UpdateJob includes the planning information of the upgrade task, such as the upgrade start time, the target version of the upgrade, the number of nodes to be upgraded, etc.

[0062] Deploy the task controller UpdateJobController in the cluster. UpdateJobController will automatically connect to the Kubernetes API Server, listen to the creation events of UpdateJob resources, and execute the upgrade tasks according to the defined upgrade plan.

[0063] Create an UpdateJob resource instance in the cluster by defining a YAML file and using the kubectl apply command. In this instance, specify the upgrade task schedule information to upgrade the cluster from version 1.21 to version 1.22, with the upgrade start time set at 3 a.m. tomorrow, and specify the number of concurrent upgrade nodes as 3.

[0064] The task controller UpdateJobController listens to the creation event of UpdateJob in the embodiment, and UpdateJobController performs specific upgrade operations by each control unit in UpdateJobController according to the upgrade plan and steps defined in UpdateJob.

[0065] The functions of each control unit in the upgrade are as follows:

[0066] Scheduled task control unit: Read the task execution time defined by UpdateJob in the embodiment as 3:00 a.m. tomorrow, then the scheduled task control unit will create an asynchronous task in the cluster, which will sleep until the system time reaches 3:00 a.m. tomorrow, and then the asynchronous task will end its sleep and continue to execute subsequent operations.

[0067] Concurrency control unit: reads the number of concurrent upgrade nodes defined in UpdateJob in the embodiment as 3, and the concurrency control unit is responsible for starting multiple nodes to perform upgrade tasks at the same time until the number of nodes executing upgrades at the same time in the cluster reaches 3.

[0068] Node backup unit: Before the official upgrade, the node backup unit performs the backup task to back up key data and configurations (such as etcd data, configuration files, certificates, and keys, etc.) to the specified directory so that it can be quickly restored to the previous state if problems occur during the upgrade process.

[0069] Node Rollback Unit: If a failure or glitches occur during the upgrade process, the node rollback unit restores data and configurations from the backup directory to ensure that the cluster can be restored to normal operation as quickly as possible.

[0070] Image pre-download unit: Before the upgrade begins, the image download unit pulls the Kubernetes 1.22 image from the version management repository and saves it on the node, thereby reducing the time taken for the overall upgrade and avoiding image pull failures due to network problems.

[0071] Node eviction unit: Before upgrading a node, the node eviction unit reschedules the Pod on the node to other nodes to ensure that the upgrade process does not affect business applications.

[0072] Upgrade unit: The upgrade unit will perform specific upgrade operations, including replacing old version images, restarting components, verifying Pod status, etc., to ensure that the upgrade of all components on the current node is successfully completed.

[0073] Service Verification Unit: After each node upgrade is completed, the service verification unit verifies the availability of the cluster, including verifying the control plane components, node status, and deploying test services to ensure that the upgrade does not affect the normal operation of the cluster and service availability.

[0074] During the upgrade process, UpdateJobController will continuously update the status of UpdateJob resources. Administrators can check the status of UpdateJob resources at any time to understand the progress and results of the upgrade.

[0075] If an exception occurs during the upgrade process, such as an upgrade failure on a node or a service verification failure, UpdateJobController will automatically roll back, update the status of the UpdateJob resource accordingly, and send a notification to the administrator, who can take further action based on the notification. Once all upgrade tasks are successfully completed and passed the verification, UpdateJobController will update the status of the UpdateJob resource to indicate that the upgrade task has been completed. The administrator can confirm that the upgrade has been successful and continue with other operations.

[0076] Figure 3 An embodiment of a computer device of the present invention is shown. The computer device may be a server, and the computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store static information and dynamic information data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the steps in the above method embodiment are implemented.

[0077] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0078] In addition, the present invention also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiment when executing the computer program.

[0079] In addition, the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0080] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0081] The present invention is not limited to the structures which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A method for automatically upgrading a Kubernetes cluster version, characterized in that: include: Create a version update resource in the form of a CRD in the Kubernetes cluster, and configure a version update controller for the version update resource; Using the version update controller to monitor Kubernetes cluster update events, and when the version update controller monitors the Kubernetes cluster update events, obtaining version update data from the version update resource; According to the version update data, the version upgrade task of the Kubernetes cluster is executed and the version upgrade status is fed back.

2. The Kubernetes cluster version automatic upgrade method according to claim 1 is characterized in that: The version update resources include: upgrade task name, namespace to which the upgrade task belongs, upgrade task image, upgrade task specification and upgrade task status; wherein, the upgrade task specification includes: upgrade task plan, upgrade task steps and target version information; the upgrade task status includes: current progress of the upgrade, amount of data of successful nodes and number of failed nodes.

3. The Kubernetes cluster version automatic upgrade method according to claim 2 is characterized in that: According to the version update data, the version upgrade task of the Kubernetes cluster includes: According to the upgrade specifications and upgrade task images in the version update data, the version image of the current Kubernetes cluster node is replaced; and if the replacement is successful, the current Kubernetes cluster node is restarted.

4. The Kubernetes cluster version automatic upgrade method according to claim 3 is characterized in that: According to the version update data, executing the version upgrade task of the Kubernetes cluster also includes: After the current Kubernetes cluster node is successfully restarted, the Pod status and / or control plane component status of the current Kubernetes cluster node is obtained; if all Pod status and / or all control plane component status of the current Kubernetes cluster node are started, it is determined that the current Kubernetes cluster node version upgrade is successful; otherwise, it is determined that the current Kubernetes cluster node version upgrade has failed, and the pre-backup data is searched in the Kubernetes cluster host node directory to perform the recovery operation; After the current Kubernetes cluster node is successfully restarted, a test service is deployed in the current Kubernetes cluster node, and the Kubernetes cluster node is tested using the test service. If the test result shows that all functions of the current Kubernetes cluster node can be started or run normally, the current Kubernetes cluster node version upgrade is determined to be successful; otherwise, the current Kubernetes cluster node version upgrade is determined to have failed, and the pre-backed-up data is searched in the Kubernetes cluster host node directory to perform a recovery operation.

5. The method for automatically upgrading the Kubernetes cluster version according to claim 4, characterized in that: When the version image of the current Kubernetes cluster node is replaced according to the upgrade specifications and upgrade task images in the version update data, the version image replacement operation of the Kubernetes cluster node is executed regularly or the version image replacement operations of multiple Kubernetes cluster nodes are executed in parallel according to the planned time or the number of nodes in the upgrade task plan.

6. A Kubernetes cluster version automatic upgrade system, characterized in that: include: A custom deployment module, used to create version update resources in the form of CRD in the Kubernetes cluster and configure a version update controller for the version update resources; A task monitoring module, used to monitor Kubernetes cluster update events using the version update controller, and obtain version update data from the version update resource when the version update controller monitors the Kubernetes cluster update event; The version upgrade module is used to execute the version upgrade task of the Kubernetes cluster according to the version update data and feedback the version upgrade status.

7. The Kubernetes cluster version automatic upgrade system according to claim 6 is characterized in that: The version update resources include: upgrade task name, namespace to which the upgrade task belongs, upgrade task image, upgrade task specification and upgrade task status; wherein, the upgrade task specification includes: upgrade task plan, upgrade task steps and target version information; the upgrade task status includes: current progress of the upgrade, amount of data of successful nodes and number of failed nodes.

8. The Kubernetes cluster version automatic upgrade system according to claim 7, characterized in that: When the version upgrade module executes the version upgrade task of the Kubernetes cluster according to the version update data, the version image of the current Kubernetes cluster node is replaced according to the upgrade specification and upgrade task image in the version update data; and if the replacement is successful, the current Kubernetes cluster node is restarted.

9. The Kubernetes cluster version automatic upgrade system according to claim 8, characterized in that: When the version upgrade module executes the version upgrade task of the Kubernetes cluster according to the version update data, After the current Kubernetes cluster node is successfully restarted, the Pod status and / or control plane component status of the current Kubernetes cluster node is obtained; when all Pod statuses and / or all control plane component statuses of the current Kubernetes cluster node are started, it is determined that the current Kubernetes cluster node version upgrade is successful; If not, determine that the current Kubernetes cluster node version upgrade has failed, search for pre-backed data in the Kubernetes cluster host node directory, and perform recovery operations; After the current Kubernetes cluster node is successfully restarted, a test service is deployed in the current Kubernetes cluster node, and the Kubernetes cluster node is tested using the test service. If the test result shows that all functions of the current Kubernetes cluster node can be started or run normally, it is determined that the current Kubernetes cluster node version upgrade is successful; Otherwise, it is determined that the current Kubernetes cluster node version upgrade has failed, and the pre-backed-up data is searched in the Kubernetes cluster host node directory to perform the recovery operation.

10. The Kubernetes cluster version automatic upgrade system according to claim 9, characterized in that: When the version upgrade module replaces the version image of the current Kubernetes cluster node according to the upgrade specifications and upgrade task images in the version update data, it periodically executes the version image replacement operation of the Kubernetes cluster node or executes the version image replacement operation of multiple Kubernetes cluster nodes in parallel according to the planned time or number of nodes in the upgrade task plan.

Citation Information

Patent Citations

  • Methods for rapid deployment and upgrade of Kubernetes-based software systems

    CN113312063B