Kubernetes cluster upgrade method, system, device and storage medium
Through rolling upgrade of Kubernetes cluster components and resource model conversion, the problem of service interruption during cluster upgrade is solved, smooth upgrade and resource utilization optimization is achieved, and the stability of the cluster's external services is ensured.
Patent Information
- Application Number
- CN202111484252.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2041-12-07
AI Technical Summary
The existing Kubernetes cluster upgrade solution requires two sets of physical resources, which leads to the inability to provide services to the outside world during the upgrade process, which is expensive to migrate workloads, and it is easy to cause service interruption during the upgrade process, affecting the user experience.
By rolling up components in Kubernetes cluster, using the new version of Kubernetes cluster component image to gradually replace the old version of components, retain the old version of interface server components, deploy key-value memory and resource model converters, achieve smooth upgrades and avoid overall Shut down to ensure that other components provide services to the outside world.
It realizes smooth upgrades of Kubernetes clusters, reduces service interruptions, ensures that older versions of workloads can continue to provide services to the outside world, reduces resource loss and migration costs, and improves user experience.
Smart Images

Figure CN114172808B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a Kubernetes cluster upgrade method, system, device and storage medium. Background Art
[0002] Kubernetes (K8S for short) cluster is an open source container orchestration management platform for managing containerized applications on multiple hosts in a cloud platform. It provides a mechanism for application deployment planning, updating, and maintenance.
[0003] The traditional Kubernetes cluster upgrade method is to adopt a blue-green release, first deploying a new version of the K8S cluster and workloads on another set of resources, then shutting down the entire cluster to migrate external traffic access to the new version, and then upgrading the components of the old version cluster resources and managing them in the new version cluster. Summary of the invention
[0004] In response to the problems in the prior art, the purpose of the present invention is to provide a Kubernetes cluster upgrade method, system, device and storage medium, which overcomes the difficulties of the prior art and can continue to adapt the old version of the interface server component to provide external services for the old version of the workload that cannot be adapted to the new version of the interface server component, thereby reducing the problem of Kubernetes cluster components being unable to provide external services or interrupting external services.
[0005] An embodiment of the present invention provides a Kubernetes cluster upgrade method, the method comprising:
[0006] Get the new version of Kubernetes cluster component image from the version management repository;
[0007] Use the new version of Kubernetes cluster component image to perform rolling upgrades on the old version of Kubernetes cluster components to the new version of Kubernetes cluster components;
[0008] When the interface server component in the Kubernetes cluster is upgraded from an old version to a new version, the old version of the interface server component is still retained;
[0009] The old version interface server component is used to provide scheduling services for the old version workload resource model.
[0010] Optionally, if a key-value store is deployed in a Kubernetes cluster, a rolling upgrade of the old version of the Kubernetes cluster components is performed using the new version of the Kubernetes cluster component image, including:
[0011] Synchronize the data in the old version of the key-value storage to the new version of the key-value storage.
[0012] Optionally, an index library and a resource model converter are deployed in the Kubernetes cluster, and the index library stores index information of each version keyword of the workload resource model. The method further includes:
[0013] In the case where the old version interface server component issues a resource scheduling request, the resource scheduling request is intercepted by using a resource model converter, and the old version keyword of the workload resource model is obtained from the resource scheduling request;
[0014] Using the old version keyword, searching the index library for the new version keyword corresponding to the old version keyword;
[0015] When the resource model converter finds the new version keyword, the resource model converter writes the new version keyword into the new version key value storage;
[0016] In the case where the new version keyword is not found, the resource model converter adds a field for labeling the workload and its host node with the old version in the resource scheduling request, and writes the old version keyword into the new version key-value storage.
[0017] Optionally, use the new version of Kubernetes cluster component image to perform a rolling upgrade of the old version of Kubernetes cluster components, including:
[0018] Use the new version of Kubernetes cluster component image to perform rolling upgrades on the old version of Kubernetes cluster components in a containerized manner.
[0019] Optionally, obtain the latest version of Kubernetes cluster component images from the version management repository, including:
[0020] Obtain the new version of the control plane component image and the new version of the work plane component image from the version management repository;
[0021] Use the new version of Kubernetes cluster component image to perform rolling upgrades on the old version of Kubernetes cluster components in a containerized manner, including:
[0022] Use the new version of the control plane component image to perform rolling upgrades on the old version of the control plane component in a containerized manner to upgrade to the new version of the control plane component;
[0023] Use the new version of the work surface component image to perform a rolling upgrade of the old version of the work surface component in a containerized manner to upgrade the work surface component to the new version.
[0024] An embodiment of the present invention further provides a Kubernetes cluster upgrade system, the system comprising:
[0025] Get the module and obtain the new version of the Kubernetes cluster component image from the version management repository of the Kubernetes cluster;
[0026] The upgrade module uses cluster component images to perform rolling upgrades on old versions of Kubernetes cluster components, upgrading the Kubernetes cluster from the old version to the new version.
[0027] Retain the module. When the interface server component in the Kubernetes cluster is upgraded from an old version to a new version, the old version of the interface server component is also retained.
[0028] The old version interface server component is used to provide scheduling services for the old version workload resource model.
[0029] Optionally, if a key-value store is deployed in a Kubernetes cluster, the upgrade module is specifically used to:
[0030] Synchronize the data in the old version of the key-value storage to the new version of the key-value storage.
[0031] Optionally, an index library and a resource model converter are deployed in the Kubernetes cluster, the index library stores index information of each version keyword of the workload resource model, and the system further includes:
[0032] The interception module intercepts the resource scheduling request by using the resource model converter when the old version interface server component issues a resource scheduling request, and obtains the old version keyword of the workload resource model from the resource scheduling request;
[0033] A search module uses the old version keyword to search for the new version keyword corresponding to the old version keyword in the index library;
[0034] Write module, specifically used for:
[0035] When the resource model converter finds the new version keyword, the resource model converter writes the new version keyword into the new version key value storage;
[0036] In the case where the new version keyword is not found, the resource model converter adds a field for labeling the workload and its host node with the old version in the resource scheduling request, and writes the old version keyword into the new version key-value storage.
[0037] Optionally, the upgrade module is specifically used for:
[0038] Use cluster component images to perform rolling upgrades on old versions of Kubernetes cluster components in a containerized manner.
[0039] Optionally, the acquisition module is specifically used for:
[0040] Obtain the new version of the control plane component image and the new version of the work plane component image from the version management repository;
[0041] The upgrade module is specifically used for:
[0042] Use the new version of the control plane component image to perform rolling upgrades on the old version of the control plane component in a containerized manner to upgrade to the new version of the control plane component;
[0043] Use the new version of the work surface component image to perform a rolling upgrade of the old version of the work surface component in a containerized manner to upgrade the work surface component to the new version.
[0044] An embodiment of the present invention further provides an electronic device, including:
[0045] processor;
[0046] a memory in which executable instructions for the processor are stored;
[0047] The processor is configured to execute the steps of the above-mentioned Kubernetes cluster upgrade method by executing executable instructions.
[0048] An embodiment of the present invention also provides a computer-readable storage medium for storing a program, which implements the steps of the above-mentioned Kubernetes cluster upgrade method when executed.
[0049] The purpose of the present invention is to provide a Kubernetes cluster upgrade method, system, device and storage medium, by rolling upgrade of components in the Kubernetes cluster, the rolling upgrade avoids the overall shutdown of the Kubernetes cluster, except for the cluster components upgraded at that time, other components can provide services externally. Also in this case, when the interface server component is upgraded, the old version of the interface server component is retained, so that for the old version of the workload that cannot adapt to the new version of the interface server component, the old version of the interface server component can continue to adapt to provide external services, reducing the problem of Kubernetes cluster components being unable to provide external services or interrupting external services. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Other features, objectives and advantages of the present invention will become more apparent from a reading of the detailed description of non-limiting embodiments made with reference to the following accompanying drawings.
[0051] Figure 1This is one of the flow charts of the Kubernetes cluster upgrade method according to an embodiment of the present invention;
[0052] Figure 2 This is the second flowchart of the Kubernetes cluster upgrade method according to an embodiment of the present invention;
[0053] Figure 3 is a schematic diagram of a Kubernetes cluster model according to an embodiment of the present invention;
[0054] Figure 4 This is the third flowchart of the Kubernetes cluster upgrade method according to an embodiment of the present invention;
[0055] Figure 5 is a flowchart of a workload resource model conversion process in a Kubernetes cluster according to an embodiment of the present invention;
[0056] Figure 6 This is a schematic diagram of a workload working mode in which a resource model cannot be converted in a Kubernetes cluster according to an embodiment of the present invention;
[0057] Figure 7 This is one of the structural diagrams of the Kubernetes cluster upgrade system according to an embodiment of the present invention;
[0058] Figure 8 This is the second structural diagram of the Kubernetes cluster upgrade system according to an embodiment of the present invention;
[0059] Fig. 9 It is a schematic diagram of the operation of the Kubernetes cluster upgrade system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0060] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to make the present invention comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art.
[0061] The accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware forwarding modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0062] In addition, the processes shown in the accompanying drawings are only exemplary and do not necessarily include all the steps. For example, some steps can be decomposed, some steps can be combined or partially combined, and the actual execution order may change according to the actual situation. The words "first", "second" and similar words used in the specific description do not indicate any order, quantity or importance, but are only used to distinguish different components. It should be noted that the embodiments of the present invention and the features in different embodiments can be combined with each other without conflict.
[0063] In actual applications, the existing Kubernetes cluster upgrade solution brings the following problems:
[0064] 1. This solution requires two sets of physical resources, and the cluster resources during the upgrade process cannot provide external services;
[0065] 2. The workload migration cost is high. Since the K8S cluster version change usually involves the upgrade of the interface server API-Server component, the old version of the workload may not be able to adapt to the API of the new version of the cluster, making the old version of the workload unable to provide servers to the outside world;
[0066] 3. Service interruption. During the upgrade process, both the new version of K8S cluster and the old version of cluster cannot provide external services during the deployment of the new version of cluster components, resulting in service interruption for online users.
[0067] It can be seen that the above-mentioned K8S cluster upgrade solution has the problem of reduced reliability of services provided by the K8S cluster to the outside world, which brings a poor user experience to users.
[0068] The embodiment of the present invention performs rolling upgrades on the components in the Kubernetes cluster, and the rolling upgrade avoids the overall downtime of the Kubernetes cluster. Except for the cluster components that are upgraded at that time, other components can provide external services. In this case, when the interface server component is upgraded, the old version of the interface server component is retained, so that for the old version of the workload that cannot adapt to the new version of the interface server component, the old version of the interface server component can continue to adapt to provide external services, thereby reducing the problem of Kubernetes cluster components being unable to provide external services or interrupting external services.
[0069] refer to Figure 1 , Figure 1 This is a flow chart of a Kubernetes cluster upgrade method provided in an embodiment of the present invention. The method specifically includes the following steps:
[0070] Step 110: Get the new version of the Kubernetes cluster component image from the version management repository;
[0071] Step 120: Use the new version of Kubernetes cluster component image to perform a rolling upgrade of the old version of Kubernetes cluster components to the new version of Kubernetes cluster components;
[0072] Step 130: When the interface server component in the Kubernetes cluster is upgraded from the old version to the new version, the old version interface server component is retained;
[0073] The old version interface server component is used to provide scheduling services for the old version workload resource model.
[0074] In the embodiment of the present invention, rolling upgrade is a smooth upgrade method, which implements component upgrade by adopting a gradual replacement strategy for Kubernetes cluster components to ensure the stability of the overall system, and can promptly discover and solve problems during the initial upgrade.
[0075] The embodiment of the present invention performs rolling upgrades on the components in the Kubernetes cluster, and the rolling upgrade avoids the overall downtime of the Kubernetes cluster. Except for the cluster components that are upgraded at that time, other components can provide external services. In this case, when the interface server component is upgraded, the old version of the interface server component is retained, so that for the old version workload that cannot adapt to the new version of the interface server component, the old version of the interface server component can continue to adapt to provide external services, thereby reducing the problem of Kubernetes cluster components being unable to provide external services or interrupting external services.
[0076] In an embodiment of the present invention, a rolling upgrade of an old version of Kubernetes cluster components is performed using a new version of Kubernetes cluster component image, specifically including the following steps:
[0077] Use the new version of Kubernetes cluster component image to perform rolling upgrades on the old version of Kubernetes cluster components in a containerized manner.
[0078] In this embodiment, each component in the Kubernetes cluster is deployed in a containerized manner, so that rolling upgrades can be achieved in a containerized manner. Using containerized deployment can reduce resource loss and has stronger scalability.
[0079] In the embodiment of the present invention, reference Figure 2 The specific steps of rolling upgrade include:
[0080] Step 210: Obtain a new version of the control plane component image from the version management repository;
[0081] Step 220: Use the new version control plane component image to perform a rolling upgrade of the old version control plane component in a containerized manner to upgrade to the new version control plane component;
[0082] Step 230: Obtain a new version of the work surface component image from the version management warehouse;
[0083] Step 240: Use the new version of the work surface component image to perform a rolling upgrade of the old version of the work surface component in a containerized manner to upgrade the old version of the work surface component to the new version of the work surface component.
[0084] Control plane components and work plane components are components in the Kubernetes cluster.
[0085] The control plane component is a reconciliation cycle mechanism that transfers the actual cluster state to the desired cluster state by managing a set of basic scheduling units, pods, which include Daemon Set controllers and replication controllers, etc., which can communicate with the API server to create, update, and delete the resources they manage when needed.
[0086] The workplane component provides the deployment and operation capabilities of Pod-based container instances.
[0087] The interface server component belongs to the control plane component and is upgraded during the control plane component upgrade process, while retaining the old version of the interface server component.
[0088] In an embodiment of the present invention, the control plane component can be upgraded first, and then the work plane component can be upgraded. During the control plane component upgrade process, since the old version interface server component is retained, the old version work plane component and workload can use the old version interface server component to provide external services, thereby reducing the problem of Kubernetes cluster service interruption.
[0089] In an embodiment of the present invention, a key-value storage is deployed in a Kubernetes cluster, and a rolling upgrade of an old version of the Kubernetes cluster component is performed using a new version of the Kubernetes cluster component image, which may also include:
[0090] Synchronize the data in the old version of the key-value storage to the new version of the key-value storage.
[0091] The key-value storage system etcd (pronounced et-see-dee) enables normal scheduling of old version workloads. etcd is an open source distributed unified key-value storage system that uses the consistent hashing algorithm (Raft). It is used for shared configuration, service discovery, and scheduling coordination of distributed systems or computer clusters. etcd will replicate this data in each node of the cluster and ensure that the data is always correct.
[0092] refer to Figure 3 The embodiment of the present invention also provides a Kubernetes cluster model, which specifically deploys the following modules:
[0093] Version management repository 31 , index library 32 and resource model converter 33 .
[0094] The version management repository 31 is used to uniformly manage container images of multi-version components of the Kubernetes cluster, and cluster component upgrade versions are downloaded from this module.
[0095] The index library 32 is used to maintain the complete set of resource model keywords for each cluster version of the Kubernetes cluster and its corresponding Kubernetes cluster version information. The version information includes but is not limited to the interface API keyword name, corresponding data model version, new version keyword index, etc. provided by the interface server component, which serves as index information for workload resource model conversion.
[0096] The resource model converter 33 is used to connect to the old version interface server component to adapt it to the new version key-value storage etcd.
[0097] Specifically, the index library 32 and the resource model converter 33 are deployed in the control plane component.
[0098] The index library 32 stores index information of each version keyword of the workload resource model, referring to Figure 4 The embodiment of the present invention provides a Kubernetes cluster upgrade method comprising the following steps:
[0099] Step 410: Obtain the new version of the Kubernetes cluster component image from the version management repository;
[0100] Step 420: Use the new version of Kubernetes cluster component image to perform a rolling upgrade on the old version of Kubernetes cluster components to upgrade to the new version of Kubernetes cluster components;
[0101] Step 430: When the interface server component in the Kubernetes cluster is upgraded from an old version to a new version, the old version interface server component is retained;
[0102] Step 440: when the old version interface server component issues a resource scheduling request, the resource scheduling request is intercepted by using a resource model converter, and the old version keyword of the workload resource model is obtained from the resource scheduling request;
[0103] Step 450: using the old version keyword, searching the index library for the new version keyword corresponding to the old version keyword;
[0104] Step 460: When the new version keyword is found, the resource model converter writes the new version keyword into the new version key value storage;
[0105] Step 470: If the new version keyword is not found, the resource model converter adds a field to the resource scheduling request to label the workload and its host node with the old version, and writes the old version keyword into the new version key-value storage.
[0106] In this case, the resource model converter is used to convert the old version keywords of the workload resource model into the new version keywords, so that it can adapt to the new version data model and store it in the key-value storage device, so that the new version of the key-value storage device component is compatible with the old version of the workload, ensuring the smooth rolling upgrade of the corresponding Kubernetes cluster without affecting the operation of the workload on the cluster.
[0107] Specifically, the keyword conversion process of the old version of the workload resource model is as follows:
[0108] 1) Initialize the index library. Import the full set of old and new version resource model keywords into the index library and write the corresponding version number field. Create new version keyword index values for keywords that already exist in the old version but have changed keyword names in the new version.
[0109] 2) For the reserved keywords of the new version, that is, if the resource model converter finds that the keywords of the new version are consistent with those of the old version, the key-value pairs of the keywords are not converted and are stored in etcd in the new version data structure.
[0110] 3) For the renamed keywords in the new version, that is, the resource model converter finds the name change of the old version keyword in the index library and creates a new version index value, then changes the old version keyword name to the new version keyword name according to the index value and stores it in etcd with the new version data structure.
[0111] 4) For keywords that have been deprecated in the new version, that is, the model converter cannot find the new version keywords in the index library, a tag field is added to the resource scheduling request of the old version keyword, and the workload and its host node are automatically labeled with a low version, so that the workload and its horizontal expansion instances can be scheduled to the corresponding version of the working nodes (these working nodes will retain the old version of kubelet to connect to the old version of API Server), and stored in etcd with the old version data structure.
[0112] In the embodiment of the present invention, when a resource scheduling request sent by a new version interface server component is obtained, the resource model converter releases the resource scheduling request.
[0113] Specifically, refer to Figure 5 , v1 indicates the old version, v2 indicates the new version;
[0114] During the Kubernetes cluster upgrade process, the data in the old version of etcd is synchronously migrated to the new version of etcd;
[0115] API Server v1 sends a resource scheduling request for workload v1. The resource model converter intercepts the resource scheduling request from API Server v1, converts the resource model keywords based on the query results in the index library, and stores them in etcd of the new version v2.
[0116] API Server v2 initiates a resource scheduling request for workload v2. The resource model converter intercepts the resource scheduling request and directly releases it. API Server v2 interacts directly with etcd v2.
[0117] It should also be noted that the old version interface server directly connects to the resource scheduling request based on the old version keyword, so the keyword transmitted in the resource scheduling request is the old version workload resource model keyword, but this is incompatible with the data model defined by the new version etcd, and cannot be directly discovered and scheduled by the cluster. Using an embodiment of the present invention, the resource model converter converts the old version keywords into new version keywords, and can adapt the new version data model to be stored in the new version etcd. Moreover, since the old version workload is assigned the new version keyword, the Kubernetes cluster component can query the old version workload in etcd with the new version keyword, so that the old version workload can be discovered and scheduled.
[0118] In an embodiment of the present invention, for old version keywords that cannot be converted, a new field can be added to the resource scheduling request to label the workload and its host with a low version. Figure 6 The host machine marked with the old version label will retain the old version of Kubelet component (Kubelet v1) to continue to provide services for workloads marked with this version (existing or future horizontal expansion, such as workload A) to connect to the old version of API Server v1, and continue to schedule workload instances that cannot be converted to the new version container to the corresponding version of the working node to ensure that the workload is not interrupted.
[0119] Figure 7 An embodiment of the present invention provides a Kubernetes cluster upgrade system, which may include:
[0120] The acquisition module 710 acquires the new version of the Kubernetes cluster component image from the version management repository of the Kubernetes cluster;
[0121] The upgrade module 720 uses the cluster component image to perform a rolling upgrade on the old version of the Kubernetes cluster component, and the Kubernetes cluster is upgraded from the old version to the new version;
[0122] Retention module 730, when the interface server component in the Kubernetes cluster is upgraded from the old version to the new version, the old version interface server component is also retained;
[0123] The old version interface server component is used to provide scheduling services for the old version workload resource model.
[0124] By using the embodiment of the present invention, the components in the Kubernetes cluster are rolled up and upgraded. The rolling upgrade avoids the overall downtime of the Kubernetes cluster. Except for the cluster components that are upgraded at that time, other components can provide external services. In this case, when the interface server component is upgraded, the old version of the interface server component is retained. In this way, for the old version workload that cannot adapt to the new version of the interface server component, the old version of the interface server component can continue to adapt to provide external services, thereby reducing the problem of the Kubernetes cluster component being unable to provide external services or interrupting external services.
[0125] Optionally, the upgrading module 720 is specifically used for:
[0126] Use cluster component images to perform rolling upgrades on old versions of Kubernetes cluster components in a containerized manner.
[0127] Optionally, the acquisition module 710 is specifically used for:
[0128] Obtain the new version of the control plane component image and the new version of the work plane component image from the version management repository;
[0129] The upgrade module 720 is specifically used for:
[0130] Use the new version of the control plane component image to perform rolling upgrades on the old version of the control plane component in a containerized manner to upgrade to the new version of the control plane component;
[0131] Use the new version of the work surface component image to perform a rolling upgrade of the old version of the work surface component in a containerized manner to upgrade the work surface component to the new version.
[0132] Optionally, a key-value storage is deployed in a Kubernetes cluster, and the upgrade module 620 is specifically used to:
[0133] Synchronize the data in the old version of the key-value storage to the new version of the key-value storage.
[0134] Optionally, refer to Figure 8 ,and Figure 7 compared to, Figure 8 The Kubernetes cluster upgrade system shown also includes:
[0135] The interception module 810 intercepts the resource scheduling request using the resource model converter to obtain the old version keyword of the workload resource model when the old version interface server component issues a resource scheduling request;
[0136] A search module 820 uses the old version keyword to search the index library for the new version keyword corresponding to the old version keyword;
[0137] The writing module 830 is specifically used for:
[0138] When the resource model converter finds the new version keyword, the resource model converter writes the new version keyword into the new version key value storage;
[0139] In the case where the new version keyword is not found, the resource model converter adds a field for labeling the workload and its host node with the old version in the resource scheduling request, and writes the old version keyword into the new version key-value storage.
[0140] For the implementation principles of the above modules, please refer to the relevant introduction in the Kubernetes cluster upgrade method, which will not be repeated here.
[0141] Fig. 9 This is a schematic diagram of the structure of the Kubernetes cluster upgrade device of the present invention. Fig. 9 An electronic device 900 according to this embodiment of the present invention will be described. Fig. 9 The electronic device 900 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0142] like Fig. 9 As shown, the electronic device 900 is in the form of a general computing device. The components of the electronic device 900 may include, but are not limited to: at least one processing unit 910, at least one storage unit 920, a bus 930 connecting different platform components (including the storage unit 920 and the processing unit 910), a display unit 940, etc.
[0143] The storage unit stores program codes, which can be executed by the processing unit 910, so that the processing unit 910 executes the steps of various exemplary embodiments of the present invention described in the electronic prescription circulation processing method section of this specification. For example, the processing unit 910 can execute 1 Figure 2-Figure 4 The steps shown in any one of the embodiments.
[0144] The storage unit 920 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 921 and / or a cache memory unit 922 , and may further include a read-only memory unit (ROM) 923 .
[0145] The storage unit 920 may also include a program / utility 924 having a set (at least one) of program modules 925, such program modules 925 including but not limited to: a processing system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0146] Bus 930 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0147] The electronic device 900 may also communicate with one or more external devices 950 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 900, and / or communicate with any device that enables the electronic device 900 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 960. In addition, the electronic device 900 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 970. The network adapter 970 may communicate with other modules of the electronic device 900 through a bus 930. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.
[0148] The embodiment of the present invention also provides a computer-readable storage medium for storing a program, and the steps of the Kubernetes cluster upgrade method are implemented when the program is executed. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps of various exemplary embodiments of the present invention described in the above Kubernetes cluster upgrade method section of this specification.
[0149] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0150] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0151] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0152] Program code for performing the processes of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0153] In summary, the purpose of the present invention is to provide a Kubernetes cluster upgrade method, system, device and storage medium, by rolling upgrade of components in the Kubernetes cluster, rolling upgrade avoids the overall shutdown of the Kubernetes cluster, except for the cluster components upgraded at that time, other components can provide external services. In this case, when the interface server component is upgraded, the old version of the interface server component is retained, so that for the old version of the workload that cannot adapt to the new version of the interface server component, the old version of the interface server component can continue to adapt to provide external services, reducing the problem of Kubernetes cluster components being unable to provide external services or interrupting external services.
[0154] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A Kubernetes cluster upgrade method, characterized in that: include: Get the new version of Kubernetes cluster component image from the version management repository; Use the new version of Kubernetes cluster component image to perform a rolling upgrade on the old version of Kubernetes cluster component to upgrade to the new version of Kubernetes cluster component; When the interface server component in the Kubernetes cluster is upgraded from an old version to a new version, the old version interface server component is also retained; The old version interface server component is used to provide a scheduling service for the old version workload resource model. A key-value storage is deployed in the Kubernetes cluster, and the old version Kubernetes cluster component is rolled upgraded using the new version Kubernetes cluster component image, including: Synchronize the data in the old version of the key-value storage to the new version of the key-value storage; An index library and a resource model converter are deployed in the Kubernetes cluster, and the index library stores index information of each version keyword of the workload resource model. The method further includes: In the case where the old version interface server component issues a resource scheduling request, the resource model converter is used to intercept the resource scheduling request, and the old version keyword of the workload resource model is obtained from the resource scheduling request; Using the old version keyword, searching the index library for a new version keyword corresponding to the old version keyword; In the case where the resource model converter finds the new version keyword, the resource model converter writes the new version keyword into the new version key-value storage; In the case where the new version keyword is not found, the resource model converter adds a field for labeling the workload and its host node with the old version in the resource scheduling request, and writes the old version keyword into the new version key-value storage.
2. The Kubernetes cluster upgrade method according to claim 1, characterized in that: Using the new version of the Kubernetes cluster component image to perform a rolling upgrade on the old version of the Kubernetes cluster component, including: The old version of Kubernetes cluster components is rolled-upgraded in a containerized manner using the new version of Kubernetes cluster component image.
3. The Kubernetes cluster upgrade method according to claim 2, characterized in that: Get the latest version of Kubernetes cluster component images from the version management repository, including: Obtain the new version of the control plane component image and the new version of the work plane component image from the version management repository; Using the new version of the Kubernetes cluster component image, the old version of the Kubernetes cluster component is rolled up in a containerized manner, including: Using the new version of the control plane component image, rolling upgrade the old version of the control plane component in a containerized manner to upgrade it to the new version of the control plane component; The new version of the work surface component image is used to perform a rolling upgrade on the old version of the work surface component in a containerized manner to upgrade the old version of the work surface component to the new version of the work surface component.
4. A Kubernetes cluster upgrade system, characterized in that: include: Get the module and obtain the new version of the Kubernetes cluster component image from the version management repository of the Kubernetes cluster; An upgrade module, which uses the new version of the Kubernetes cluster component image to perform a rolling upgrade on the old version of the Kubernetes cluster component, and the Kubernetes cluster is upgraded from the old version to the new version; Retain the module. When the interface server component in the Kubernetes cluster is upgraded from an old version to a new version, the old version of the interface server component is also retained. The old version interface server component is used to provide scheduling services for the old version workload resource model, and a key-value storage is deployed in the Kubernetes cluster, and the upgrade module is specifically used to: synchronize data in the old version key-value storage to the new version key-value storage; An index library and a resource model converter are deployed in the Kubernetes cluster, wherein the index library stores index information of each version keyword of the workload resource model, and the system further includes: An interception module, when the old version interface server component issues a resource scheduling request, uses the resource model converter to intercept the resource scheduling request, and obtains the old version keyword of the workload resource model from the resource scheduling request; A search module, using the old version keyword to search the index library for the new version keyword corresponding to the old version keyword; Write module, specifically used for: In the case where the resource model converter finds the new version keyword, the resource model converter writes the new version keyword into the new version key-value storage; In the case where the new version keyword is not found, the resource model converter adds a field for labeling the workload and its host node with the old version in the resource scheduling request, and writes the old version keyword into the new version key-value storage.
5. The Kubernetes cluster upgrade system according to claim 4, characterized in that: The upgrade module is specifically used for: The cluster components of the old version of Kubernetes are rolled-upgraded in a containerized manner using the new version of Kubernetes cluster component image.
6. The Kubernetes cluster upgrade system according to claim 5, characterized in that: The acquisition module is specifically used for: Obtain the new version of the control plane component image and the new version of the work plane component image from the version management repository; The upgrade module is specifically used for: Using the new version of the control plane component image, rolling upgrade the old version of the control plane component in a containerized manner to upgrade it to the new version of the control plane component; The new version of the work surface component image is used to perform a rolling upgrade on the old version of the work surface component in a containerized manner to upgrade the old version of the work surface component to the new version of the work surface component.
7. An electronic device, characterized in that: include: processor; a memory storing executable instructions of the processor; Wherein, the processor is configured to execute the steps of the Kubernetes cluster upgrade method described in any one of claims 1 to 3 by executing the executable instructions.
8. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps of the Kubernetes cluster upgrade method described in any one of claims 1 to 3 are implemented.