Operation system upgrading method and device, electronic equipment and storage medium
By obtaining and utilizing operating system upgrade instructions, detecting cluster node status, obtaining system image files, evicting applications, and partition preparation, the problem of low automation of CoreOS operating system upgrades is solved, and upgrade efficiency and business continuity is improved.
Patent Information
- Application Number
- CN202411158206.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-11-29
AI Technical Summary
In the prior art, the degree of automation of the upgrade of CoreOS operating system is limited, and operational errors are prone to occur, resulting in long upgrade time, high risk and low efficiency.
By obtaining operating system upgrade instructions, polling and detecting cluster node status, obtaining system image files, evicting applications, partition preparation, and using target partitions to upgrade the operating system to ensure automation and business continuity of the upgrade process.
It realizes automated pre-preparation and verification of operating system upgrades, improves upgrade efficiency, ensures business continuity and availability, and reduces the risk of manual intervention.
Smart Images

Figure CN119045850A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of system upgrade, and in particular to an operating system upgrade method and device, an electronic device, and a storage medium. Background Art
[0002] Currently, the CoreOS operating system is widely used because it streamlines non-core software (such as graphical user interface, package manager, etc.) and can safely carry large-scale containerized workloads, and the upgrade of the CoreOS operating system has also attracted widespread attention. The application of the CoreOS operating system upgrade is implemented through the EAAS (Enterprise Application Automation Service) platform. Since CoreOS is a container-centric operating system, the powerful container cluster management function that EAAS can provide can provide powerful containerized orchestration management for the CoreOS operating system.
[0003] In the prior art, the CoreOS operating system upgrade is often implemented through the cluster orchestration container Docker Swarm. However, this method has a limited degree of automation and requires manual preparation for the operating system upgrade. During the upgrade preparation process, there may be a risk of operational errors. When errors occur, manual retries are required, which increases the upgrade time and upgrade risks, causing the operating system upgrade to be interrupted, resulting in low efficiency of the operating system upgrade. Therefore, how to improve the efficiency of operating system upgrades has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to provide an operating system upgrade method and device, an electronic device and a storage medium, aiming to improve the efficiency of operating system upgrade.
[0005] To achieve the above object, a first aspect of an embodiment of the present application provides an operating system upgrade method, the method comprising:
[0006] Acquire operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate an upgrade target of the operating system of the cluster node in the cluster;
[0007] Polling and detecting the node upgrade status of each of the cluster nodes according to the operating system upgrade indication information to obtain the cluster nodes to be upgraded;
[0008] Obtaining a system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system;
[0009] Expelling applications from the cluster nodes to be upgraded to obtain empty cluster nodes;
[0010] Obtain the partition corresponding to the drained cluster node to obtain a target partition; the target partition is used to represent the area where the operating system is upgraded, and is not the area where the operating system is running;
[0011] The operating system of the drained cluster node is upgraded in the target partition according to the running content.
[0012] In some embodiments, the operating system upgrade indication information includes an upgrade strategy and an upgrade version;
[0013] The step of polling and detecting the node upgrade status of each cluster node according to the operating system upgrade indication information to obtain the cluster node to be upgraded includes:
[0014] According to the upgrade strategy, using a preset first cluster controller to query the upgrade information change of the cluster nodes to obtain the cluster nodes to be initially upgraded;
[0015] According to the upgrade version, using the first cluster controller to poll the node upgrade version of the cluster node to be initially upgraded to obtain a version detection result; the version detection result is used to indicate whether the node upgrade version is consistent or inconsistent with the target upgrade version;
[0016] If the version detection result is that the versions are inconsistent, the node identifier of the initial cluster to be upgraded with the inconsistent version is updated to a state to be upgraded, so as to obtain the cluster node to be upgraded.
[0017] In some embodiments, the step of expelling the application from the to-be-upgraded cluster node to empty the cluster node includes:
[0018] Using a second cluster controller pre-deployed on the cluster node to be upgraded, detecting the upgrade information change of the cluster node to obtain an evicted node, where the evicted node is a cluster node to be upgraded with an evicted node identifier;
[0019] In response to the eviction instruction, the eviction node identifier is updated to a call-forbidden state, and the application on the eviction node is evicted to obtain the drained cluster node.
[0020] In some embodiments, the step of upgrading the operating system of the drained cluster node in the target partition according to the running content includes:
[0021] Acquire an initial operating system file and an operating system file tree; the initial operating system file is used to represent the original system content of the operating system; the operating system file tree is used to represent all system content that needs to be upgraded in the operating system;
[0022] Mounting the running content to the target partition to obtain a snapshot of the image file;
[0023] In response to the upgrade instruction, the initial operating system files of the drained cluster nodes are replaced with the operating system file tree in the target partition according to the image file snapshot.
[0024] In some embodiments, after replacing the initial operating system file of the emptied cluster node with the operating system file tree in the target partition according to the image file snapshot, the method further includes:
[0025] Obtaining an operating system upgrade result; the operating system upgrade result is used to indicate whether the upgrade is successful or failed;
[0026] If the upgrade result is an upgrade failure, obtaining the operating system running partition; the operating system running partition is used to indicate the area where the operating system is running;
[0027] Rolling back the operating system file tree through the operating system running partition, and updating the operating system file tree to obtain an updated system file tree;
[0028] The initial operating system file is replaced by the updated system file tree in the target partition to obtain an update and upgrade result, and when the update and upgrade result is that the upgrade is successful, it is confirmed that the operating system upgrade is completed.
[0029] In some embodiments, after replacing the initial operating system file of the emptied cluster node with the operating system file tree in the target partition according to the image file snapshot, the method further includes:
[0030] Obtaining the operating system version of the operating system file tree, and obtaining the target upgrade version of the operating system;
[0031] Using the second cluster controller to perform version consistency detection on the operating system version and the target operating system upgrade version to obtain a version consistency detection result; the version consistency detection result is used to indicate whether the operating system version is consistent with the target operating system upgrade version or inconsistent with the version;
[0032] According to the version consistency detection result, the to-be-upgraded state of the to-be-upgraded cluster node identifier is deleted, and the to-be-upgraded cluster node identifier is updated to a callable state.
[0033] In some embodiments, obtaining operating system upgrade instruction information includes:
[0034] Create custom resource definitions on the preset interface;
[0035] Creating a custom resource corresponding to the custom resource definition; wherein the custom resource includes an upgrade version resource parameter and an upgrade strategy resource parameter;
[0036] In response to a resource acquisition command, the operating system upgrade indication information is acquired from the upgrade version resource parameter and the upgrade strategy resource parameter.
[0037] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides an operating system upgrade device, the device comprising:
[0038] An upgrade indication information acquisition module, used to acquire operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate an upgrade target of the operating system of the cluster node in the cluster;
[0039] A polling detection module, used for polling and detecting the node upgrade status of each cluster node according to the operating system upgrade indication information, and obtaining the cluster node to be upgraded;
[0040] A system image file acquisition module, used to acquire the system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system;
[0041] An eviction module, used to evict applications in the cluster nodes to be upgraded, thereby obtaining empty cluster nodes;
[0042] A partition acquisition module, used to acquire the partition corresponding to the drained cluster node to obtain a target partition; the target partition is used to represent the area where the operating system is upgraded, and is not the area where the operating system is running;
[0043] An operating system upgrade module is used to upgrade the operating system of the drained cluster node in the target partition according to the running content.
[0044] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0045] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0046] The operating system upgrade method and device, electronic device and storage medium proposed in the present application obtain operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate the upgrade target of the operating system of the cluster node in the cluster; poll and detect the node upgrade status of each cluster node according to the operating system upgrade indication information to obtain the cluster node to be upgraded; obtain the system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system; evict the application in the cluster node to be upgraded to obtain the empty cluster node; obtain the partition corresponding to the empty cluster node to obtain the target partition; the target partition is used to indicate the area where the operating system is upgraded, and is not the area where the operating system is running; and the operating system of the empty cluster node is upgraded in the target partition according to the running content. By performing polling detection on cluster nodes, the present application can preliminarily screen out cluster nodes to be upgraded, and further evict single cluster nodes, so as to more finely control cluster nodes, and automatically complete pre-preparation and verification work before operating system upgrade without manual intervention, thereby improving the efficiency of operating system upgrade. The operating system is upgraded in combination with the target partition and running content, so that the operating system can be upgraded on one partition without affecting the normal operation of another partition of the operating system, thereby ensuring business continuity and availability during the system upgrade process, and further improving the efficiency of the operating system upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is the first optional flowchart of the operating system upgrade method provided in the embodiment of the present application;
[0048] Figure 2 is an application example diagram of the operating system upgrade method provided in an embodiment of the present application;
[0049] Figure 3 yes Figure 1 Flow chart of step S101 in FIG.
[0050] Figure 4 yes Figure 1 Flow chart of step S102 in FIG.
[0051] Figure 5 yes Figure 1 Flow chart of step S104 in FIG.
[0052] Figure 6 yes Figure 1 Flow chart of step S106 in FIG.
[0053] Figure 7 This is a second optional flowchart of the operating system upgrade method provided in the embodiment of the present application;
[0054] Figure 8 This is a third optional flowchart of the operating system upgrade method provided in the embodiment of the present application;
[0055] Fig. 9 is a schematic diagram of the structure of an operating system upgrade device provided in an embodiment of the present application;
[0056] Fig.10 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0058] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0060] First, some nouns involved in this application are analyzed:
[0061] EAAS (Enterprise Application Automation Service): aims to optimize, manage and operate various enterprise applications and services through automation technology and processes. It is an important part of cloud computing and enterprise digital transformation. EAAS integrates knowledge from multiple fields such as IT operation and maintenance, software development, and business process management. Through an integrated platform or service, it realizes the automated management of the entire life cycle of enterprise application deployment, configuration, monitoring, troubleshooting, performance optimization, etc.
[0062] Kubernetes Operator is an operator that runs on Kubernetes (an open source container orchestration platform) and is specifically designed to automate the lifecycle management of complex applications and their components in a Kubernetes cluster. It does this by defining custom resources and associated controllers that extend the API of the Kubernetes cluster, allowing developers to declaratively define and manage the state of applications. Kubernetes Operator is not only responsible for deploying and configuring applications, but also for monitoring their operating status and automatically performing tasks such as scaling, fault recovery, and software updates, thereby ensuring that applications run efficiently and reliably in a Kubernetes cluster.
[0063] CR (Custom Resource): is an extension mechanism of the Kubernetes API that allows users to define and manage new resource types beyond the scope of built-in resources in the Kubernetes cluster. These custom resources can represent and manage application-specific configurations, states, or data, thereby achieving more detailed and flexible control over complex applications in the Kubernetes cluster. CR is usually used in conjunction with Custom Resource Definition (CRD). CRD defines the structure and metadata of CR, while CR instances store specific resource data. Through the declarative configuration and controller mode of the Kubernetes cluster, CR can achieve automatic synchronization and management of resource states, simplifying the operation and management process of complex applications.
[0064] Kubernetes Upgrade Operator: is a tool or component specifically designed to automate the management and execution of Kubernetes cluster upgrade processes. It is part of the Kubernetes cluster ecosystem and is designed to simplify the complexity and risk of upgrading a cluster from one version to another. Kubernetes UpgradeOperator combines the concepts of custom resources and controllers in Kubernetes to achieve seamless upgrades by defining the desired state of the upgrade process and automatically executing the necessary steps.
[0065] Kubernetes Upgrade DaemonSet: It is a special DaemonSet resource in Kubernetes that automates cluster node upgrade tasks. DaemonSet is a mechanism in the Kubernetes cluster to ensure that an application runs on all (or some) nodes, and Upgrade DaemonSet is specifically designed to perform upgrade operations on each node in the cluster in sequence or in parallel. It uses the node affinity feature of DaemonSet to ensure that the upgrade task can cover every node in the cluster, and can control the order and speed of the upgrade according to policies (such as rolling upgrades). Upgrade DaemonSet implements an automated upgrade process by defining application templates for the upgrade process, including the required container images, commands, and parameters.
[0066] Pod: It is the smallest deployable unit in a Kubernetes cluster and can also be regarded as an application in the cluster. It is not a process running directly on the host machine, but a collection of one or more closely related containers (such as Docker containers). The containers in a Pod share the same network namespace, IPC namespace, and storage volume, allowing them to work together like a single application instance.
[0067] Based on this, the embodiments of the present application provide an operating system upgrade method and device, an electronic device, and a storage medium, aiming to improve the efficiency of operating system upgrades.
[0068] The operating system upgrade method and device, electronic device and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the operating system upgrade method in the embodiments of the present application is described.
[0069] The operating system upgrade method provided in the embodiment of the present application relates to the field of upgrade technology. The operating system upgrade method provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or it can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the operating system upgrade method, etc., but is not limited to the above forms.
[0070] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0071] See also Figure 1 , Figure 1 is a first optional flowchart of the operating system upgrade method provided in an embodiment of the present application, Figure 1 The method may include but is not limited to steps S101 to S106.
[0072] Step S101, obtaining operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate an upgrade target of the operating system of a cluster node in the cluster.
[0073] Step S102: poll and detect the node upgrade status of each cluster node according to the operating system upgrade indication information to obtain the cluster node to be upgraded.
[0074] Step S103, obtaining a system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system.
[0075] Step S104: evict applications from the cluster nodes to be upgraded, thereby draining the cluster nodes.
[0076] Step S105, obtaining the partition corresponding to the empty cluster node to obtain the target partition; the target partition is used to represent the area where the operating system is upgraded, and is not the area where the operating system is running.
[0077] Step S106: upgrading the operating system of the emptied cluster node in the target partition according to the running content.
[0078] Steps S101 to S106 shown in the embodiment of the present application are performed by obtaining operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate the upgrade target of the operating system of the cluster nodes in the cluster; polling and detecting the node upgrade status of each cluster node according to the operating system upgrade indication information to obtain the cluster nodes to be upgraded; obtaining the system image file corresponding to the cluster nodes to be upgraded; wherein the system image file is used to store the running content of the operating system; expelling the applications in the cluster nodes to be upgraded to obtain the drained cluster nodes; obtaining the partitions corresponding to the drained cluster nodes to obtain the target partitions; the target partitions are used to indicate the area where the operating system is to be upgraded, and are not the area where the operating system is to be run; and upgrading the operating system of the drained cluster nodes in the target partitions according to the running content. By performing polling detection on cluster nodes, the present application can preliminarily screen out cluster nodes to be upgraded, and further evict single cluster nodes, so as to more finely control cluster nodes, and automatically complete pre-preparation and verification work before operating system upgrade without manual intervention, thereby improving the efficiency of operating system upgrade. The operating system is upgraded in combination with the target partition and running content, so that the operating system can be upgraded on one partition without affecting the normal operation of another partition of the operating system, thereby ensuring business continuity and availability during the system upgrade process, and further improving the efficiency of the operating system upgrade.
[0079] In step S101 of some embodiments, the operating system upgrade indication information is used to indicate the upgrade target of the operating system of the cluster nodes in the cluster, and the operating system upgrade indication information includes an upgrade strategy and an upgrade version; wherein the upgrade strategy includes but is not limited to the maximum unavailable number of upgrade nodes, a forced eviction flag, and a warehouse address for downloading images, etc.; the upgrade version refers to the version of the operating system to be upgraded.
[0080] Reference Figure 2In one application scenario, taking the CoreOS operating system upgrade as an example, the CR resources of the CoreOS operating system are released through the EAAS platform, and the Kubernetes Operator extension mechanism is used to interact with the Kubernetes cluster through the API provided by the Kubernetes API server (such as kube-api server) to monitor the CR changes of cluster nodes in the Kubernetes cluster; specifically, when the first cluster controller (such as Kubernetes Upgrade Operator) monitors the change of CR, the change is sent to the second cluster controller (such as Kubernetes upgradedaemonset), and the Kubernetes upgrade daemonset is used to evict the Pod of a single cluster node (such as coreos node1, coreos node2, etc.) with CR changes. After the eviction is completed, the system image file of the CoreOS operating system is downloaded from the content mirror server, and the system image file is mounted to the rootB passive partition, and the CoreOS operating system in coreos node1 or coreos node2 is upgraded in rootB according to boot (boot), and during the upgrade process, the CoreOS operating system is also run normally through the rootA active partition.
[0081] See also Figure 3 In some embodiments, step S101 may include but is not limited to steps S301 to S303:
[0082] Step S301, creating a custom resource definition on a preset interface.
[0083] Step S302, creating a custom resource corresponding to the custom resource definition; wherein the custom resource includes an upgrade version resource parameter and an upgrade strategy resource parameter.
[0084] Step S303: in response to the resource acquisition command, the operating system upgrade indication information is acquired from the upgrade version resource parameter and the upgrade strategy resource parameter.
[0085] In step S301 of some embodiments, the custom resource definition is CRD (Custom Resource Definition), and CRD can define the structure and metadata of CR, including but not limited to the name, field, validation rules (such as type validation, format validation and dependency validation) of the custom resource.
[0086] Specifically, the preset interface may be a user interface or an API interface provided by the EAAS system, and the CRD may be created and managed through the user interface or the API interface.
[0087] In step S302 of some embodiments, specifically, the custom resource is CR (Custom Resource), which can be defined based on the characteristics and requirements of the CoreOS operating system.
[0088] Specifically, a CR instance can be created according to CRD and a Kubernetes command line tool (such as the kubectl command line), and the CR instance includes an upgrade version resource parameter and an upgrade policy resource parameter, wherein the upgrade version resource parameter includes the upgrade version information of the operating system, and the upgrade policy resource parameter includes the upgrade policy information of the operating system.
[0089] Among them, the upgrade policy resource parameters are defined through different policy fields.
[0090] For example, the MaxUnavai l ab le field is used to indicate the upgrade strategy of the maximum unavailable number of upgrade nodes; the EvictPodForce field is used to indicate the upgrade strategy of the forced eviction flag, and so on.
[0091] In this embodiment, by creating custom resources corresponding to custom resource definitions, it is possible to facilitate the subsequent release of custom resources through the EAAS system, and can trigger operating system upgrade operations in a highly customized and automated manner, reducing the risk of human error.
[0092] In step S203 of some embodiments, specifically, the resource acquisition command can be determined by a Kubernetes command line tool (such as a kubectl command line), and the EAAS system responds to the kubectl command line request to obtain the operating system upgrade indication information from the upgrade version resource parameters and the upgrade strategy resource parameters.
[0093] See also Figure 4 In some embodiments, step S102 may include but is not limited to steps S401 to S403:
[0094] Step S401 : According to the upgrade strategy, a preset first cluster controller is used to query the upgrade information change of the cluster nodes to obtain the cluster nodes to be initially upgraded.
[0095] Step S402: According to the upgrade version, the first cluster controller is used to poll the node upgrade version of the cluster node to be initially upgraded to obtain a version detection result; the version detection result is used to indicate whether the node upgrade version is consistent or inconsistent with the target upgrade version.
[0096] Step S403: if the version detection result is that the versions are inconsistent, the node identifier of the initial cluster to be upgraded with inconsistent versions is updated to a state to be upgraded, thereby obtaining a cluster node to be upgraded.
[0097] In step S401 of some embodiments, the preset first cluster controller refers to Kubernetes UpgradeOperator, which can serve as a version manager of the CoreOS operating system of the global cluster node to continuously monitor the changes of upgrade information in the CR within the cluster, including controlling the number of cluster nodes upgraded simultaneously and marking the cluster nodes ready for upgrade.
[0098] Specifically, the cluster nodes to be initially upgraded refer to cluster nodes that can be upgraded among the available cluster nodes.
[0099] Specifically, the first cluster controller determines the number of nodes that can continue to be upgraded in the cluster according to the maximum unavailable number of upgraded nodes in the upgrade policy, and queries the cluster nodes to be initially upgraded in the cluster according to the number of nodes.
[0100] For example, based on the MaxUnavai l ab le field in CR, the Kubernetes UpgradeOperator can calculate the l imit (number of nodes) that the cluster can continue to upgrade, and query the cluster nodes to be initially upgraded based on the l imit number.
[0101] In this embodiment, by using a preset first cluster controller to query the upgrade information changes of the cluster nodes, the cluster nodes to be initially upgraded are obtained, so that the upgrade operation is distributed to multiple nodes and a sufficient number of available nodes are maintained during the upgrade process to ensure that the maximum number of unavailable nodes is not exceeded when executing the cluster node upgrade operation. This can significantly reduce the risk of system interruption caused by a single cluster node failure or unexpected problems during the upgrade process, and ensure that during the upgrade of the operating system, the remaining nodes can still operate the operating system normally, thereby improving the system stability of the operating system upgrade.
[0102] In step S402 of some embodiments, the node upgrade version refers to the operating system version of the cluster node; the target upgrade version refers to the upgrade version of the operating system that needs to be upgraded.
[0103] Specifically, the first cluster controller performs polling detection on the node upgrade version of each cluster node to be initially upgraded to obtain a version detection result, which is used to indicate whether the node upgrade version is consistent or inconsistent with the target upgrade version.
[0104] Specifically, after obtaining the version detection result, the first cluster controller continues to poll and verify the upgrade progress of the cluster nodes to be initially upgraded until the verification of the last cluster node to be initially upgraded is completed, that is, the upgrade polling verification is completed.
[0105] Specifically, if the version detection result is that the versions are consistent, it means that the cluster node to be initially upgraded is not a cluster node that needs to be upgraded, and there is no need to perform an upgrade mark on the cluster node to be initially upgraded.
[0106] For example, the Kubernetes Upgrade Operator continuously monitors the detection results between the operating system version of each cluster node to be initially upgraded and the target upgrade version, that is, continuously monitors the changes in the type field value of the CR. If the type field value does not change, it means that the version detection result is consistent. Until the type field value of the CR is "idle", it means that the verification of the last cluster node to be initially upgraded is completed, that is, the upgrade polling verification is completed.
[0107] In this embodiment, by using the first cluster controller to poll the node upgrade version of the initial upgraded cluster node according to the upgrade version, the version detection result is obtained, which can automatically poll each cluster node to ensure that all nodes that need to be upgraded are identified and processed without human intervention. This helps to avoid cluster node version detection errors or omissions caused by negligence in manual operation, and improves the efficiency and reliability of operating system upgrades.
[0108] In step S403 of some embodiments, the cluster node to be upgraded refers to a cluster node whose node upgrade version of the operating system is lower than the target upgrade version and needs to be upgraded.
[0109] Specifically, if the version detection result is that the versions are inconsistent, the node identifier of the initial to-be-upgraded cluster with inconsistent versions is updated to a to-be-upgraded state.
[0110] For example, the Kubernetes Upgrade Operator monitors the change in the type field value of the cluster node CR to be initially upgraded, that is, the version detection result is inconsistent, then the node table identifier is updated to "system=upgrade", that is, the type field value of CR is "upgrade", and the cluster node to be initially upgraded is determined to be the cluster node to be upgraded.
[0111] In this embodiment, by updating the node identification of the initial to-be-upgraded cluster with inconsistent versions to the to-be-upgraded state, the upgrade state of the cluster node can be clearly identified, and repeated upgrades of the same cluster node can be avoided, which helps to improve the upgrade efficiency of the operating system.
[0112] In step S103 of some embodiments, the system image file is used to store the running content of the operating system, wherein the running content includes but is not limited to the kernel of the operating system, the boot loader, all system files (such as library files, configuration files and service scripts, etc.) and pre-installed applications, etc.
[0113] Among them, the kernel and boot loader of the operating system are responsible for loading the operating system when the system starts; all system files together constitute the core part of the operating system; when the pre-installed application is run in the container, it is used to run and manage containerized applications on the CoreOS system.
[0114] Specifically, the system image file can be obtained by the second cluster controller obtaining the warehouse address of the downloaded image from the CR, and obtaining the system image file of the corresponding version based on the address.
[0115] For example, use Kubernetes Upgrade DaemonSet to download the corresponding version of the system image file from the upgrade_configs upgrade configuration field in CR.
[0116] See also Figure 5 In some embodiments, step S104 may also include but is not limited to steps S501 to S502:
[0117] Step S501 : using a second cluster controller pre-deployed on the cluster node to be upgraded to detect the upgrade information change of the cluster node, and obtain an evicted node, where the evicted node is a cluster node to be upgraded with an evicted node identifier.
[0118] Step S502: in response to the eviction instruction, the eviction node identifier is updated to a call-forbidden state, and the application on the eviction node is evicted to obtain an empty cluster node.
[0119] In step S501 of some embodiments, the second cluster controller refers to Kubernetes UpgradeDaemonSet, which can serve as a version manager of the CoreOS operating system of a single cluster node to continuously monitor changes in upgrade information within the single cluster node.
[0120] Specifically, the evicted node refers to a cluster node to be upgraded that has an evicted node identifier.
[0121] Specifically, the node version in the cluster node to be upgraded and the operating system version released by the CR resource are detected by the second cluster controller. If the versions are inconsistent, it means that the cluster node to be upgraded needs to be upgraded, and it is further identified whether there is an eviction node identifier for the cluster node to be upgraded. If there is an eviction node identifier, it is determined that the cluster node to be upgraded is an eviction node.
[0122] For example, when the cluster node to be upgraded is marked with "system=upgrade", the OSImage version in the NodeInfo of the current cluster node to be upgraded is compared with the operating system version released by CR through KubernetesUpgrade DaemonSet. If the versions are inconsistent, it means that an upgrade is required. Then, according to the field status of the forced eviction flag (EvictPodForce) in CR, if the EvictPodForce field status is true, it means that the cluster node to be upgraded is an evicted node; if the EvictPodForce field status is false, it means that the cluster node to be upgraded is not an evicted node.
[0123] In step S502 of some embodiments, draining the cluster nodes refers to the cluster nodes after the service pods in the nodes are expelled.
[0124] Specifically, you can use the kubect l cordon command to update the eviction node flag to the prohibited call state to prevent new business Pods from being scheduled to the eviction node, and use the kubect l drain command to evict the business Pods on the eviction node. This eviction process includes deleting the business Pod and waiting for the scheduler to reschedule the business Pod to other nodes.
[0125] In this embodiment, by updating the eviction node identifier to a prohibited call state, the eviction node can be marked as an unschedulable state, ensuring that no new business Pod is assigned to the eviction node, and avoiding the interruption of the operating system upgrade or data inconsistency caused by the addition of new business Pods, thereby ensuring the efficiency and reliability of the operating system upgrade, and safely eviction of applications on the eviction node, ensuring that the evicted business Pod can be restarted on other cluster nodes, ensuring that each business Pod is correctly stopped before being deleted, reducing the risk of data loss, and will not affect the service continuity of the operating system, further improving the reliability of the operating system upgrade.
[0126] In step S105 of some embodiments, the target partition refers to an area used for upgrading the operating system.
[0127] Specifically, the CoreOS operating system adopts a dual-partition design, in which the active partition is used for the operation of the CoreOS operating system, and the passive partition is used for the upgrade of the CoreOS operating system. During the operation of the CoreOS operating system, the active partition of CoreOS is in a read-only state to improve the stability and security of the CoreOS operating system.
[0128] Specifically, since each cluster node in the cluster carries both active partitions and passive partitions, when it is determined that the drained cluster needs to be upgraded, the passive partition carried by the drained cluster node is used as the target partition to upgrade the operating system of the cluster node.
[0129] In this embodiment, the partition corresponding to the emptied cluster node is obtained to obtain the target partition, which enables the subsequent operating system upgrade operation on one partition without affecting the normal operation of another partition, thereby improving business continuity and availability during the operating system upgrade process.
[0130] See also Figure 6 In some embodiments, step S106 includes but is not limited to steps S601 to S603:
[0131] Step S601, obtaining an initial operating system file and an operating system file tree; the initial operating system file is used to represent the original system content of the operating system; the operating system file tree is used to represent all system content that needs to be upgraded in the operating system.
[0132] Step S602, mounting the running content to the target partition to obtain a snapshot of the image file.
[0133] Step S603 , in response to the upgrade instruction, the initial operating system files of the emptied cluster nodes are replaced with the operating system file tree in the target partition according to the image file snapshot.
[0134] In step S601 of some embodiments, the initial operating system files are used to represent the original system content of the operating system, including but not limited to the original operating system kernel, original operating system libraries, original operating system tools (such as file management tools, network configuration tools, etc.), original operating system user space applications (such as Web servers, databases, etc.), and original operating system configuration files (such as network configuration, service startup settings, etc.).
[0135] Specifically, the operating system file tree is used to represent all system contents that need to be upgraded in the operating system, and the operating system file tree refers to the operating system files and directories in the operating system being organized into a tree structure, and in the tree structure, each tree node represents an operating system file or a directory, and the connection between the tree nodes represents the hierarchical relationship between the operating system files or directories, wherein the operating system files are stored under the directory and accessed through the directory.
[0136] Specifically, the difference between the operating system files and the initial operating system files is that the operating system files are used to represent the system content of the operating system that needs to be upgraded, including the operating system kernel that needs to be upgraded, the operating system libraries that need to be upgraded, the operating system tools that need to be upgraded (such as file management tools, network configuration tools, etc.), the user space applications of the operating system that need to be upgraded (such as Web servers, databases, etc.), and the configuration files of the operating system that need to be upgraded (such as network configuration, service startup settings, etc.).
[0137] In step S602 of some embodiments, the image file snapshot includes a complete operating system structure and operating system content copy in the system image file, including all operating system files, operating system symbolic links, snapshot version identifiers and metadata, etc.
[0138] Specifically, the running content is mounted to the target partition, and the corresponding system image file can be downloaded to the passive partition according to the application architecture (such as X86, ARM architecture) of the operating system of the empty cluster node.
[0139] In an optional embodiment of the present application, the system image file under the mounted target partition can be pulled to the local system through a mount command (such as ostree pull-loca l), thereby ensuring the consistency of the operating system during the upgrade process.
[0140] In this embodiment, by mounting the running content to the target partition, a snapshot of the image file is obtained, which enables management of different versions of the operating system, facilitates tracking and rollback during the operating system upgrade process, and improves the efficiency of the operating system upgrade.
[0141] In step S603 of some embodiments, specifically, the CoreOS operating system uses a hybrid package management system (such as rpm-ostree) to manage the operating system version, and also combines RPM (Red Hat Package Manager) and OSTree warehouse to achieve operating system upgrades.
[0142] Furthermore, in this embodiment, the OSTree warehouse provides an atomic way to update the operating system, which can realize switching between multiple operating system versions, and does not affect the operation of the current operating system when rolling back the operating system, ensuring the consistency of the operating system upgrade and business continuity.
[0143] Specifically, by responding to upgrade instructions (such as rpm-ostree rebase instructions), the image version of the system image file is switched to the latest pulled image version from the image file snapshot, and the operating system file tree replaces the existing initial operating system file according to the latest image version, thereby realizing the upgrade of the operating system of the emptied cluster nodes.
[0144] In this embodiment, by replacing the initial operating system files of the emptied cluster nodes with the operating system file tree in the target partition according to the image file snapshot, the entire operating system can be updated as a whole instead of updating a certain software package separately, avoiding the version split and inconsistency problems that may be caused by the operation upgrade, and ensuring that the operating system is always in a consistent and available state.
[0145] See also Figure 7 In some embodiments, step S106 may include but is not limited to steps S701 to S704:
[0146] Step S701, obtaining the operating system upgrade result; the upgrade result is used to indicate whether the upgrade is successful or failed.
[0147] Step S702: if the upgrade result is an upgrade failure, obtain the operating system running partition; the operating system running partition is used to indicate the area where the operating system is running.
[0148] Step S703: rolling back the operating system file tree through the operating system running partition, and updating the operating system file tree to obtain an updated system file tree.
[0149] Step S704, replacing the initial operating system file with the updated system file tree in the target partition to obtain an update and upgrade result, until the update and upgrade result is that the upgrade is successful, confirming that the operating system upgrade is completed.
[0150] In step S701 of some embodiments, the operating system upgrade result is used to indicate whether the upgrade is successful or failed.
[0151] Specifically, if the operating system upgrade result is successful, the default boot item can be set to the upgraded operating system version through GRUB configuration to convert the target partition into an active partition to run the operating system.
[0152] In step S702 of some embodiments, if the upgrade result is an upgrade failure, in order not to affect the upgrade of the operating system, the operating system running partition is obtained, and the operating system file tree is subsequently rolled back through the running partition.
[0153] The operating system running partition is used to indicate the area where the operating system is running.
[0154] In step S703 of some embodiments, specifically, first obtain the image file snapshot corresponding to the operating system file tree of the running partition, obtain the image version information from the image file snapshot, and determine the operating system version before the upgrade based on the image version information; secondly, roll back the number of operating system files using the operating system running partition based on the operating system version before the upgrade to determine the number of operating system files; and after the rollback is stable, find the reason for the failure of the operating system upgrade, update the operating system file tree based on the reason for the failure of the operating system upgrade, and obtain an updated system file tree.
[0155] In this embodiment, the operating system file tree is rolled back through the operating system running partition, and the operating system file tree is updated to obtain an updated system file tree. When there is a problem with the new operating system version, the operating system can automatically roll back to the previous stable version, reducing the risk of business interruption due to system failure, allowing the operating system to quickly recover to a stable state when the upgrade fails, ensuring the continuity and availability of the operating system service, and improving the efficiency of the operating system upgrade.
[0156] In step S704 of some embodiments, specifically, the update system file tree is copied or moved to the target partition to replace the initial operating system file, the operating system is restarted, and it is checked whether the update system file tree can run successfully. If the update system file tree can start normally and run stably, the update and upgrade result of the operating system is confirmed to be a successful update; if the update and upgrade result is a failure, the operating system file tree is repeatedly rolled back through the operating system running partition, and the operating system file tree is updated to obtain an updated system file tree; and the step of replacing the initial operating system file with the update system file tree in the target partition is repeated until the update and upgrade result is a successful upgrade, confirming that the operating system upgrade is complete.
[0157] See also Figure 8 In some embodiments, step S106 may include but is not limited to steps S801 to S803:
[0158] Step S801, obtaining the operating system version of the operating system file tree, and obtaining the target upgrade version of the operating system.
[0159] Step S802: Use the second cluster controller to perform version consistency detection on the operating system version and the operating system target upgrade version to obtain a version consistency detection result; the version consistency detection result is used to indicate whether the operating system version and the operating system target upgrade version are consistent or inconsistent.
[0160] Step S803: according to the version consistency detection result, the to-be-upgraded state of the to-be-upgraded cluster node identifier is deleted, and the to-be-upgraded cluster node identifier is updated to a callable state.
[0161] In step S801 of some embodiments, the operating system version refers to the version of the system file tree;
[0162] Specifically, the target upgrade version of the operating system is the upgrade version of the operating system that needs to be upgraded.
[0163] Specifically, the operating system version can be obtained from the image file snapshot; the target upgrade version of the operating system can be released through CR or by the administrator, which is determined based on the actual business situation.
[0164] In step S802 of some embodiments, specifically, the second cluster controller continuously monitors the system version information of the drained cluster node when executing the upgrade operation. When the operating system upgrade is successfully executed and the drained cluster node is restarted, the operating system version of the drained cluster node is checked for version consistency with the target upgrade version of the operating system, and a result is obtained that the operating system version is consistent with the target upgrade version of the operating system or the version is inconsistent; if the versions are consistent, the operating system upgrade is completed; if the versions are inconsistent, it indicates that the operating system upgrade has failed, and the cause of the operating system failure is further searched until the operating system upgrade is successful.
[0165] For example, Kubernetes Upgrade DaemonSet continuously monitors the CoreOS operating system version information of the draining cluster node when performing the upgrade operation. When the operating system upgrade is successful and the OSImage node operation version in the NodeI nfo information of the draining cluster node is restarted, the OSImage node operation version is updated to the operating system target upgrade version released by CR. At this time, the operating system target upgrade version released by CR will be consistent with the OSImage node operation version in the NodeI nfo information, and the draining cluster node operating system upgrade is completed.
[0166] In an embodiment of the present application, by using a second cluster controller to perform version consistency detection on the operating system version and the target operating system upgrade version, it can be ensured that all cluster nodes in the cluster run the same version of the operating system, further ensuring consistency during the operating system upgrade process, thereby improving the reliability of the operating system upgrade.
[0167] In step S803 of some embodiments, after the upgrade of the operating system of the draining cluster node is completed, the upgrade status "upgrate" of the current cluster draining node identifier is deleted, and the node identifier of the current cluster draining node is updated to a callable state through the kubectl cordon command.
[0168] In this embodiment, based on the version consistency detection results, the to-be-upgraded status of the cluster node identifier to be upgraded is deleted and the to-be-upgraded cluster node identifier is updated to a callable status, so that the cluster nodes in the cluster can re-receive and run new operating system tasks or workloads, thereby improving resource utilization within the cluster.
[0169] The embodiment of the present application obtains operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate the upgrade target of the operating system of the cluster node in the cluster; polls and detects the node upgrade status of each cluster node according to the operating system upgrade indication information to obtain the cluster node to be upgraded; obtains the system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system; expels the application in the cluster node to be upgraded to obtain the empty cluster node; obtains the partition corresponding to the empty cluster node to obtain the target partition; the target partition is used to indicate the area where the operating system is upgraded, and is not the area where the operating system is running; and upgrades the operating system of the empty cluster node in the target partition according to the running content. The present application can preliminarily screen out the cluster nodes to be upgraded by polling the cluster nodes, and further expels the single cluster node, so as to control the cluster nodes more finely, realize the automatic completion of the pre-preparation and verification work before the operating system upgrade, without manual intervention, improve the efficiency of the operating system upgrade, and upgrade the operating system in combination with the target partition and the running content, so as to realize the upgrade operation of the operating system on one partition without affecting the normal operation of another partition of the operating system, ensure the business continuity and availability during the system upgrade process, and further improve the efficiency of the operating system upgrade.
[0170] See also Fig. 9 The embodiment of the present application also provides an operating system upgrade device, which can implement the above operating system upgrade method, and the device includes:
[0171] An upgrade indication information acquisition module, used to acquire operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate an upgrade target of the operating system of the cluster node in the cluster;
[0172] A polling detection module is used to poll and detect the node upgrade status of each cluster node according to the operating system upgrade indication information to obtain the cluster node to be upgraded;
[0173] The system image file acquisition module is used to acquire the system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system;
[0174] The eviction module is used to evict applications from the cluster nodes to be upgraded, thereby draining the cluster nodes;
[0175] The partition acquisition module is used to acquire the partition corresponding to the empty cluster node and obtain the target partition; the target partition is used to indicate the area where the operating system is upgraded, and is not the area where the operating system is running;
[0176] The operating system upgrade module is used to upgrade the operating system of the drained cluster node in the target partition according to the running content.
[0177] The specific implementation of the operating system upgrade device is basically the same as the specific implementation of the operating system upgrade method described above, and will not be repeated here.
[0178] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above operating system upgrade method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0179] See also Fig.10 , Fig.10 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0180] The processor 1001 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0181] The memory 1002 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store an operating system and other applications. When the technical solution provided in the embodiments of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1002, and the processor 1001 calls and executes the operating system upgrade method of the embodiment of the present application;
[0182] Input / output interface 1003, used to implement information input and output;
[0183] The communication interface 1004 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WI FI, Bluetooth, etc.);
[0184] A bus 1005 , which transmits information between various components of the device (e.g., the processor 1001 , the memory 1002 , the input / output interface 1003 , and the communication interface 1004 );
[0185] The processor 1001 , the memory 1002 , the input / output interface 1003 and the communication interface 1004 are connected to each other in communication within the device via the bus 1005 .
[0186] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned operating system upgrade method is implemented.
[0187] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0188] The operating system upgrade method, operating system upgrade device, electronic device and storage medium provided by the embodiments of the present application obtain operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate the upgrade target of the operating system of the cluster node in the cluster; polling and detecting the node upgrade status of each cluster node according to the operating system upgrade indication information to obtain the cluster node to be upgraded; obtaining the system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system; expelling the application in the cluster node to be upgraded to obtain the empty cluster node; obtaining the partition corresponding to the empty cluster node to obtain the target partition; the target partition is used to indicate the area where the operating system is to be upgraded, and is not the area where the operating system is to be run; and upgrading the operating system of the empty cluster node in the target partition according to the running content. By performing polling detection on cluster nodes, the present application can preliminarily screen out cluster nodes to be upgraded, and further evict single cluster nodes, so as to more finely control cluster nodes, and automatically complete pre-preparation and verification work before operating system upgrade without manual intervention, thereby improving the efficiency of operating system upgrade. The operating system is upgraded in combination with the target partition and running content, so that the operating system can be upgraded on one partition without affecting the normal operation of another partition of the operating system, thereby ensuring business continuity and availability during the system upgrade process, and further improving the efficiency of the operating system upgrade.
[0189] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0190] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0191] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0192] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0193] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0194] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0195] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0196] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0197] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0198] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0199] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for upgrading an operating system, characterized in that: The method comprises: Acquire operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate an upgrade target of the operating system of the cluster node in the cluster; Polling and detecting the node upgrade status of each of the cluster nodes according to the operating system upgrade indication information to obtain the cluster nodes to be upgraded; Obtaining a system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system; Expelling applications from the cluster nodes to be upgraded to obtain empty cluster nodes; Obtain the partition corresponding to the drained cluster node to obtain a target partition; the target partition is used to represent the area where the operating system is upgraded, and is not the area where the operating system is running; The operating system of the drained cluster node is upgraded in the target partition according to the running content.
2. The method according to claim 1, characterized in that The operating system upgrade instruction information includes an upgrade strategy and an upgrade version; The step of polling and detecting the node upgrade status of each cluster node according to the operating system upgrade indication information to obtain the cluster node to be upgraded includes: According to the upgrade strategy, using a preset first cluster controller to query the upgrade information change of the cluster nodes to obtain the cluster nodes to be initially upgraded; According to the upgrade version, the first cluster controller is used to poll the node upgrade version of the cluster node to be initially upgraded to obtain a version detection result; the version detection result is used to indicate whether the node upgrade version is consistent or inconsistent with the target upgrade version; If the version detection result is that the versions are inconsistent, the node identifier of the initial cluster to be upgraded with the inconsistent version is updated to a state to be upgraded, so as to obtain the cluster node to be upgraded.
3. The method according to claim 1, characterized in that The step of expelling the application from the cluster node to be upgraded to obtain an empty cluster node includes: Using a second cluster controller pre-deployed on the cluster node to be upgraded, detecting the upgrade information change of the cluster node to obtain an evicted node, where the evicted node is a cluster node to be upgraded with an evicted node identifier; In response to the eviction instruction, the eviction node identifier is updated to a call-forbidden state, and the application on the eviction node is evicted to obtain the drained cluster node.
4. The method according to claim 1, characterized in that The step of upgrading the operating system of the drained cluster node in the target partition according to the running content includes: Acquire an initial operating system file and an operating system file tree; the initial operating system file is used to represent the original system content of the operating system; the operating system file tree is used to represent all system content that needs to be upgraded in the operating system; Mounting the running content to the target partition to obtain a snapshot of the image file; In response to the upgrade instruction, the initial operating system files of the drained cluster nodes are replaced with the operating system file tree in the target partition according to the image file snapshot.
5. The method according to claim 4, characterized in that After replacing the initial operating system file of the emptied cluster node with the operating system file tree in the target partition according to the image file snapshot, the method further includes: Obtaining an operating system upgrade result; the operating system upgrade result is used to indicate whether the upgrade is successful or failed; If the upgrade result is an upgrade failure, obtaining the operating system running partition; the operating system running partition is used to indicate the area where the operating system is running; Rolling back the operating system file tree through the operating system running partition, and updating the operating system file tree to obtain an updated system file tree; The initial operating system file is replaced by the updated system file tree in the target partition to obtain an update and upgrade result, and when the update and upgrade result is that the upgrade is successful, it is confirmed that the operating system upgrade is completed.
6. The method according to claim 4, characterized in that After replacing the initial operating system file of the emptied cluster node with the operating system file tree in the target partition according to the image file snapshot, the method further includes: Obtaining the operating system version of the operating system file tree, and obtaining the target upgrade version of the operating system; Using the second cluster controller to perform version consistency detection on the operating system version and the target operating system upgrade version to obtain a version consistency detection result; the version consistency detection result is used to indicate whether the operating system version is consistent with the target operating system upgrade version or inconsistent with the version; According to the version consistency detection result, the to-be-upgraded state of the to-be-upgraded cluster node identifier is deleted, and the to-be-upgraded cluster node identifier is updated to a callable state.
7. The method according to any one of claims 1 to 4, characterized in that: The obtaining of operating system upgrade instruction information includes: Create custom resource definitions on the preset interface; Creating a custom resource corresponding to the custom resource definition; wherein the custom resource includes an upgrade version resource parameter and an upgrade strategy resource parameter; In response to a resource acquisition command, the operating system upgrade indication information is acquired from the upgrade version resource parameter and the upgrade strategy resource parameter.
8. An operating system upgrade device, characterized in that: The device comprises: An upgrade indication information acquisition module, used to acquire operating system upgrade indication information; wherein the operating system upgrade indication information is used to indicate an upgrade target of the operating system of the cluster node in the cluster; A polling detection module, used for polling and detecting the node upgrade status of each cluster node according to the operating system upgrade indication information, and obtaining the cluster node to be upgraded; A system image file acquisition module, used to acquire the system image file corresponding to the cluster node to be upgraded; wherein the system image file is used to store the running content of the operating system; An eviction module, used to evict applications in the cluster nodes to be upgraded, thereby obtaining empty cluster nodes; A partition acquisition module, used to acquire the partition corresponding to the drained cluster node to obtain a target partition; the target partition is used to represent the area where the operating system is upgraded, and is not the area where the operating system is running; An operating system upgrade module is used to upgrade the operating system of the drained cluster node in the target partition according to the running content.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the operating system upgrade method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the operating system upgrading method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
File client batch upgrading system
CN120803499A
File client bulk upgrade system
CN120803499B
Upgrading method of storage cluster system and electronic equipment
CN120892069A
Switch management method and device applied to kubernetes GPU cluster, electronic equipment, storage medium and computer program product
CN121151353A
Chip firmware upgrading method used in server cluster
CN121704878A
