A container service fault repair method and device
By generating the association relationship between the virtual IP addresses of the container service and automatically migrating the container service, the problem of untimely recovery function after the container service failure is solved, and rapid repair and user experience guarantee is achieved.
Patent Information
- Application Number
- CN202210375471.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-04-11
AI Technical Summary
In the event of container service failure, it is difficult for the prior art to quickly restore container service functions, resulting in the impact of service quality and user experience.
By obtaining the attribute information of the preconfigured container resources and the virtual IP address, generate the association relationship between the virtual IP addresses corresponding to the container service, listen to container service events, and automatically migrate the container service to other virtual IPs according to the association relationship when a failure occurs. address.
It realizes rapid migration and recovery after container service failure, avoids the negative impact of failure on container service, and ensures users' normal use of container service functions.
Smart Images

Figure CN114756396B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a container service fault repair method and device. Background Art
[0002] In the process of business migration containers, it is often necessary to use kubernetes orchestration tools to deploy container services. In actual applications, there are many kubernetes clusters online, and istio software is deployed in each cluster to support the microservice system. In this way, each cluster composed of kubernetes software plus istio software naturally forms a fault domain. When there are network failures, dependent resource failures, business logic failures, and other problems, the services in this fault domain will be abnormal. Usually, it is necessary to locate the problem through manual judgment, and then perform steps such as expanding the service and migrating the service to restore the service. This process has a certain degree of human subjectivity and takes a certain amount of time, which usually affects the service quality and user experience.
[0003] How to efficiently implement fault repair of container services is the technical problem to be solved by this application. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a container service fault recovery method and device to solve the problem of untimely recovery of container service functions after a container service fault occurs.
[0005] In a first aspect, a container service fault recovery method is provided, which is applied to a multi-cluster service system, including:
[0006] Acquire preconfigured container resources and attribute information of multiple virtual IP addresses for providing container services, wherein the preconfigured container resources are used to deploy the container service;
[0007] Generate an association relationship between the multiple virtual IP addresses corresponding to the container service according to the attribute information of the container resource and the multiple virtual IP addresses, wherein the association relationship is used to indicate the multiple virtual IP addresses that can be migrated by the container service;
[0008] Monitor container service events of multi-cluster service systems;
[0009] If the container service event represents a container service failure, the failed container service is migrated between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service.
[0010] In a second aspect, a container service fault recovery device is provided, including:
[0011] An acquisition module is used to acquire attribute information of a preconfigured container resource and a plurality of virtual IP addresses for providing a container service, wherein the preconfigured container resource is used to deploy the container service;
[0012] A generating module, which generates an association relationship between the multiple virtual IP addresses corresponding to the container service according to the attribute information of the container resource and the multiple virtual IP addresses, wherein the association relationship is used to indicate the multiple virtual IP addresses that can be migrated by the container service;
[0013] The monitoring module monitors container service events of multi-cluster service systems;
[0014] A migration module is configured to migrate the failed container service between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service if the container service event represents a container service failure.
[0015] According to a third aspect, an electronic device is provided. The electronic device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the method according to the first aspect are implemented.
[0016] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method according to the first aspect are implemented.
[0017] In an embodiment of the present application, by obtaining the attribute information of the preconfigured container resources and multiple virtual IP addresses for providing container services; generating the association relationship between the multiple virtual IP addresses corresponding to the container service according to the attribute information of the container resources and the multiple virtual IP addresses; monitoring the service events of the container service of the multi-cluster service system; if the service event represents a container service failure, the failed container service is migrated between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service. This solution is based on the association relationship between the virtual IP addresses corresponding to the container service, and performs migration on the container service in a timely manner after the container service fails, efficiently repairs the container service function, and avoids the negative impact of the failure on the container service. In actual applications, once the virtual IP address providing the container service fails, the container service supported by the virtual IP address will be abnormal. After monitoring the failure of the container service, this solution automatically performs migration on the container service according to the association relationship, so that the above-mentioned container service is provided by other virtual IP addresses instead of the failed virtual IP address, thereby repairing the failure of the container service and ensuring that users can use the container service function normally. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0019] Figure 1 This is one of the flow charts of a container service fault repair method according to an embodiment of the present invention.
[0020] Figure 2 This is a second flow chart of a method for repairing a container service fault according to an embodiment of the present invention.
[0021] Figure 3 This is a third flow chart of a method for repairing a container service fault according to an embodiment of the present invention.
[0022] Figure 4 This is a fourth flow chart of a method for repairing a container service fault according to an embodiment of the present invention.
[0023] Figure 5 This is a fifth flow chart of a method for repairing a container service fault according to an embodiment of the present invention.
[0024] Figure 6 This is the sixth flow chart of a method for repairing a container service fault according to an embodiment of the present invention.
[0025] Figure 7 It is a structural schematic diagram of a container service fault repair device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. The figure numbers in this application are only used to distinguish the various steps in the scheme, and are not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.
[0027] In order to solve the problems existing in the prior art, the embodiment of the present application provides a container service fault repair method. The solution provided by the embodiment of the present application can be applied to a service system including multiple clusters to solve the problem of untimely recovery of container service functions after a container service fails.
[0028] First, the terms involved in the embodiments of the present application are explained:
[0029] Kubernetes: A container orchestration management tool.
[0030] Kubernetes cluster: contains all components of the Kubernetes software and the servers that run these components.
[0031] Applications on Kubernetes: Services deployed using Kubernetes, such as nginx service, mysql service, etc.
[0032] Kubernetes resources: such as deployment, server, ingress, etc., are used to deploy services on Kubernetes.
[0033] Kubernetes ecosystem software: such as prometheus monitoring system, alert manager alarm system, helm management tool, etc., to achieve the required functions.
[0034] Istio ingress gateway: is a seven-layer load balancing component.
[0035] Workload entry: defines VIPs in different areas and is used to register with the service list corresponding to the istio ingress gateway.
[0036] Container: A container image is a lightweight, standalone executable package of software that contains the code, system tools, system libraries, settings, and more needed to run it. A container is the running state of a program in a container image.
[0037] Istio: A software suite for service mesh orchestration, management, traffic proxy, service registration, and more.
[0038] When providing container services based on multiple clusters, network failures, resource failures, business logic failures and other problems may occur. For example, suppose that the multi-cluster service system contains multiple kubernetes clusters, and istio software is deployed in each cluster to support the microservice system. If a failure occurs, internal fault migration can be achieved by separating fault domains within istio or kubernetes. Although this type of fault migration may achieve small-scale fault repair, it is difficult to achieve good fault repair in the face of a large number of faults with complex causes and a wide range of faults, and it is difficult to meet actual business needs.
[0039] In order to solve the problems existing in the prior art, the present application embodiment provides a container service fault repair method, which is applied to a multi-cluster service system. For the sake of convenience, the present application embodiment assumes that the multi-cluster service system contains multiple kubernetes clusters, and istio software is deployed in each cluster to support the microservice system. Figure 1 As shown, the method provided in the embodiment of the present application includes the following steps:
[0040] S11: Acquire preconfigured container resources and attribute information of multiple virtual IP addresses for providing container services, wherein the preconfigured container resources are used to deploy the container service;
[0041] The container resources in this step can be pre-configured by the administrator. For example, the pre-configured container resources can include kubernetes-related resources, such as deployment, service, ingress, etc., and can also include istio-related resources, such as gateway, virtual service, destination rule, workloadentry, etc. The above resources are required to deploy a service using kubernetes and istio. These resources can be used to form a complete Internet application that can provide TCP or HTTP to the outside world. In the subsequent steps, when a failure is identified in a certain area, the container service traffic can be switched to other VIPs to achieve the repair of the container service.
[0042] In a multi-cluster service system, container services are often provided by multiple virtual IP addresses (VIPs). To facilitate the migration of services in subsequent steps, the VIP attribute information obtained in this step may specifically include the VIP's IP address, the VIP's region, the VIP's weight, the VIP's port, and other attribute information.
[0043] S12: Generate an association relationship between the multiple virtual IP addresses corresponding to the container service according to the attribute information of the container resource and the multiple virtual IP addresses, where the association relationship is used to indicate the multiple virtual IP addresses that can be migrated by the container service.
[0044] In this step, the association relationship between multiple VIPs corresponding to the container service can be generated in various forms. For example, based on the corresponding relationship, the attribute information of the VIP obtained in the above step and the pre-configured container resources are filled in the workloadentry of these resources with the attribute information of the VIP, so that the pre-configured container resources and the attribute information of the VIP are combined and stored based on the association relationship.
[0045] Alternatively, the association relationship between multiple VIPs may be stored in the form of a data table, a topology diagram, etc. according to actual needs.
[0046] S13: Monitor container service events of the multi-cluster service system.
[0047] In actual applications, container service events of multiple cluster service systems can be stored and read. Optionally, container service events can be stored in a preset storage area, and the container service events in the storage area can be read according to actual needs to monitor container service events of multiple cluster service systems.
[0048] Among them, the container service events of the multi-cluster service system may specifically include events of the istio software and events of the kubernetes software.
[0049] S14: If the container service event indicates a container service failure, migrate the failed container service between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service.
[0050] In this step, if the container service event indicates a container service failure, the failed container service can be migrated between multiple virtual IP addresses based on the association relationship between multiple VIPs generated in advance. The failed container service is migrated from the failed VIP to a normal VIP that can provide the container service, and the function of the container service is restored first.
[0051] Among them, fault rules can be preset. When a container service event meets the preset fault rules, the faulty container service is migrated between multiple virtual IP addresses according to the association relationship between multiple virtual IP addresses corresponding to the faulty container service.
[0052] In addition, to reduce system load, you can also pre-configure a monitoring period, periodically obtain container service events based on a preset time length, and batch determine whether the obtained container service events represent container service failures.
[0053] Optionally, an alarm message may be generated according to the container service failure represented by the container service event, and the alarm message may be sent to an administrator corresponding to the container service so that manual intervention can be performed to handle the failed VIP.
[0054] Through the solution provided by the embodiment of the present application, it is possible to automatically switch service traffic between fault domains composed of multiple kubernetes clusters and istio, restore services, and give priority to ensuring the quality of container services. Among them, based on the association between virtual IP addresses, the container service is migrated in time after a container service fails, and the container service function is efficiently repaired to avoid the negative impact of the failure on the container service.
[0055] Based on the solution provided in the above embodiment, optionally, the attribute information of the multiple virtual IP addresses includes regional information of the virtual IP addresses and / or weight information of the virtual IP addresses, wherein the regional information of the virtual IP addresses includes the entity IP address information of the virtual IP address or the available zone information to which the virtual IP address belongs.
[0056] The region information of the virtual IP address can represent the availability zone to which the vip belongs. Optionally, if the region information of the virtual IP address includes the physical IP address information of the vip, the availability zone information to which the corresponding vip belongs can be determined based on the physical IP address information. Based on the availability zone information, container service migration across availability zones can be performed after a fault is detected, thereby migrating the container service out of the availability zone where the fault occurs.
[0057] The weight information of the virtual IP address can be determined according to the container service provided by the corresponding VIP to represent the priority of the migration container service. The weight information can be determined according to the function parameters of the VIP.
[0058] Through the solution provided by the embodiment of the present application, an association relationship of multiple virtual IP addresses containing weight information can be generated. Then, when a fault is found and the container service is migrated, a better VIP can be selected as the target VIP for container service migration based on the weight information in the association relationship. The quality of the container service after migration is improved and the negative impact of the fault on the container service is reduced.
[0059] In actual applications, once the virtual IP address that provides the container service fails, the container service supported by the virtual IP address will be abnormal. After monitoring the container service failure, this solution automatically migrates the container service according to the association relationship, so that other virtual IP addresses replace the failed virtual IP address to provide the above container service, thereby repairing the container service failure and ensuring that users can use the container service function normally.
[0060] Based on the solution provided in the above embodiment, optionally, in the case where the attribute information of the multiple virtual IP addresses includes the area information of the virtual IP addresses, such as Figure 2 As shown, the above step S14 includes:
[0061] S21: If the container service event represents a container service failure, migrate the failed container service to a virtual IP address that is different from the availability zone to which the current virtual IP address belongs according to the association relationship between multiple virtual IP addresses corresponding to the failed container service.
[0062] In this step, after the container service failure is discovered, the container service is migrated across availability zones. Among them, the association relationship between the above multiple VIPs may include the availability zone information to which the VIP belongs. In this step, the availability zone to which the faulty VIP belongs can be determined first based on the actual failure of the container service. Then, according to the above association relationship, a VIP different from the availability zone to which the faulty VIP belongs is selected from the multiple VIPs that can be migrated as the target VIP, and then the container service is migrated to a VIP in a different zone, thereby migrating the container service out of the faulty availability zone and realizing cross-availability zone migration.
[0063] Based on the solution provided in the above embodiment, optionally, in the case where the attribute information of the multiple virtual IP addresses includes weight information of the virtual IP addresses, such as Figure 3 As shown, the above step S14 includes:
[0064] S31: If the container service event represents a container service failure, determine at least one migratable virtual IP address according to an association relationship between multiple virtual IP addresses corresponding to the failed container service.
[0065] In some cases, the container service event can characterize the specific cause of the container service failure. In this step, based on the specific cause of the container service failure and the association relationship between multiple virtual IP addresses corresponding to the failed container service, at least one virtual IP address that can avoid the actual container service failure can be determined. The selected at least one virtual IP address can be used as a migratable virtual IP address to perform container service migration to avoid the actual failure.
[0066] S32: Migrate the failed container service to the virtual IP address with the largest weight among the at least one migratable virtual IP address.
[0067] In this step, based on the weight information corresponding to at least one migratable virtual IP address, the virtual IP address with the largest weight is selected as the target VIP to perform the migration of the above-mentioned failed container service.
[0068] Through the solution provided by the embodiment of the present application, at least one virtual IP address that can be migrated can be selected based on the association relationship corresponding to the container service to avoid the actual failure and ensure that the container service can be restored after migration. Furthermore, after selecting at least one virtual IP address that can be migrated, based on the weight information of the at least one virtual IP address that can be migrated, the virtual IP address with the largest weight is selected to migrate the container service of the above failure, further optimizing the quality of the container service after migration and effectively reducing the negative impact of the failure on the above container service.
[0069] Based on the solution provided by the above embodiment, optionally, the container service event includes an HTTP status code. The HTTP status code (HTTP Status Code) is a digital code used to indicate the response status of the hypertext transfer protocol of the web server, which can represent the response status of the container service event.
[0070] like Figure 4 As shown, the above step S13 includes:
[0071] S41: Periodically obtain the HTTP status code of the container service of the multi-cluster service system based on a preset time length.
[0072] The above-mentioned preset time length can be preset according to actual needs, for example, the preset time length is 1 minute. Then, in this step, detection is performed periodically at intervals of 1 minute.
[0073] Wherein, the above step S14 includes:
[0074] S42: If the number of HTTP status codes indicating container service failures obtained continuously is greater than a safety threshold, the failed container service is migrated between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service.
[0075] If HTTP status codes that indicate container service failures are obtained continuously, such as return status codes 502, 503, 504, etc., these statuses are counted to calculate the number of HTTP status codes that indicate container service failures. When the continuous count is greater than the safety threshold, it indicates that the container service status is continuously abnormal and the container service has failed. Subsequently, the container service migration is performed to switch the failed container service to other VIPs, that is, to other regions, and the container service is repaired in time.
[0076] Based on the solution provided in the above embodiment, optionally, Figure 5 As shown, after the above step S14, it also includes:
[0077] S51: Monitor the state of the first virtual IP address where the container service is located before performing the migration.
[0078] After executing the container migration, in this step, the state of the first virtual IP address before the migration is monitored to promptly know whether the first virtual IP address has returned to normal.
[0079] S52: If the state of the first virtual IP address indicates that the first virtual IP address has been repaired, migrate the container service back to the first virtual IP address.
[0080] After monitoring that the first virtual IP address has been repaired, the container service can be migrated back to the first virtual IP address immediately. Through the solution provided by the embodiment of the present application, not only can the container service be restored by migration after a container service failure, but also the migration can be automatically performed after the first virtual IP address of the failure is repaired, avoiding the occupation of other virtual IP addresses and improving the overall stability of the system.
[0081] Based on the solution provided in the above embodiment, optionally, the multi-cluster service system is a kubernetes multi-cluster service system based on istio, and the preconfigured container resources include kubernetes resources and istio resources;
[0082] The kubernetes resource includes at least one of a deployment resource, a service resource, and an ingress resource;
[0083] The istio resource includes at least one of a gateway resource, a virtual service resource, a destination rule resource, and a workloadentry resource.
[0084] The following is an example of the solution provided in the embodiment of the present application. Figure 6 The following is based on Figure 6 Each module shown in FIG. 1 is described below.
[0085] Administrator: Responsible for defining the deployment of services through the management interface. The deployment content includes Kubernetes-related resources, or Istio-related resources, etc. Figure 6 As shown in step 1, the administrator adds the above-mentioned related resources through the operation management interface to achieve pre-configuration.
[0086] Administrator interface: The administrator interface can be a module with interactive display functions, which is responsible for submitting the management input information to the multi-cluster istio and kubernetes coordination system. After the submission is completed, wait for the submission result. If the returned result is successful, it can be displayed to the administrator through prompt information. If it fails, the failure reason is obtained and displayed to the administrator. In the successful state, all VIPs of the current service are obtained from the load balancing system, and the attributes related to the VIP are obtained. The attribute information can specifically include the VIP's IP address, the VIP's area, the VIP's weight, the VIP's port, etc. These attribute information are summarized and submitted, such as Figure 6 As shown in step 2.
[0087] The multi-cluster istio and kubernetes coordination system can be used to implement the following functions:
[0088] (1) Receive VIP-related attribute information, including VIP's IP address, VIP's region, VIP's weight, VIP's port, and other attributes.
[0089] (2) Combine the VIP attributes and the resources added by the administrator through the administrator interface, fill in the VIP information in the workloadentry of these resources, and fill in the VIP weight and area attributes in the workloadentry to identify when a certain area fails and switch the traffic to other VIPs, that is, switch to other areas.
[0090] (3) Configure the thresholds and policies for switching to other areas. For example, you can configure the detection period, such as once every minute, and you can configure the detection results. For example, if the HTTP return status code is 502, 503, 504, etc., these states are counted. When the continuous count reaches a certain value, switch to other VIPs, that is, switch to other areas.
[0091] (4) Configure local error detection, that is, detect whether the container or program in the current area is running normally, and switch to other VIPs, that is, switch to other areas if an abnormality is detected.
[0092] (5) Responsible for submitting the information of VIP and resource combination to Kubernetes and Istio. Through their interfaces, a service that can provide TCP or HTTP protocol is created. Figure 6 As shown in step 6 in . At the same time, the created information will be stored as an event in the event acquisition or storage component for use in subsequent steps.
[0093] (6) This component load synchronizes the operations mentioned in (5) to multiple clusters consisting of Isito and Kubernetes, so that a service can be provided by multiple regions, and each region can automatically switch traffic to other regions according to the administrator's configuration when a failure occurs, and switch traffic back when the failure is restored.
[0094] (7) Responsible for reading events and storing system events. When resources in istio or kubernetes change, and when the changed data is different from the management settings, this component will change the changes to the data configured by the administrator and send notifications to the alarm and notification system, such as Figure 6 as shown in step 7 in .
[0095] The event reading and storage system can be used to provide event storage and event reading functions. It is used to monitor the events of the istio software and the kubernetes software, and store the monitored events for the alarm and notification system to read. Figure 6 As shown in step 8.
[0096] Alarm and notification system: responsible for sending received alarm information to corresponding administrators, such as Figure 6 as shown in step 9 in .
[0097] Internet users: resolve the VIP corresponding to the service domain name through the DNS system, such as Figure 6 as shown in step 3 in .
[0098] DNS system: DNS system is responsible for providing Internet users with the corresponding relationship between VIP and domain name, such as Figure 6 As shown in step 4.
[0099] The four-layer load balancing system sends the user's browsing request to the cluster composed of istio and kubernetes, and sends it to the service composed of resources defined by the administrator. Specifically, it may include the following:
[0100] (1) The istio ingress gateway component in the istio software is responsible for receiving traffic sent by the layer-4 load balancing system.
[0101] (2) The pod in kubernetes is responsible for receiving traffic sent by the istio ingress gateway
[0102] (3) Istio's workloadentry is responsible for receiving traffic sent by the Istio ingress gateway when an abnormality occurs in the pod or business.
[0103] The four-layer load balancing system can ensure that after a failure occurs, the traffic can be automatically transferred to the available area, without the need for administrators to participate in the entire detection and switching process.
[0104] Through the solution provided by the embodiment of the present application, the abnormal state of the service can be flexibly defined to determine the state in which the container service performs migration. This solution can automatically cooperate with the four-layer load balancing to realize automatic configuration of istio and kubernetes, reduce the complexity of the configuration system, and simplify the configuration operation. Moreover, this solution can realize the primary and standby fault domain mode and the transfer of traffic ratio to multiple fault domain modes as needed, and realize the flexible configuration of the transfer mode. This solution can simply and quickly detect faults and quickly recover from faults.
[0105] In order to solve the problems existing in the prior art, such as Figure 7 As shown, the embodiment of the present application further provides a container service fault recovery device 70, including:
[0106] An acquisition module 71 is configured to acquire attribute information of a preconfigured container resource and a plurality of virtual IP addresses for providing a container service, wherein the preconfigured container resource is used to deploy the container service;
[0107] A generating module 72, generating an association relationship between the multiple virtual IP addresses corresponding to the container service according to the attribute information of the container resource and the multiple virtual IP addresses, wherein the association relationship is used to indicate the multiple virtual IP addresses that can be migrated by the container service;
[0108] A monitoring module 73, monitoring container service events of the multi-cluster service system;
[0109] The migration module 74 performs migration of the failed container service between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service if the container service event indicates a container service failure.
[0110] Through the device provided in the embodiment of the present application, the attribute information of the preconfigured container resources and multiple virtual IP addresses used to provide container services is obtained; the association relationship between the multiple virtual IP addresses corresponding to the container service is generated according to the attribute information of the container resources and the multiple virtual IP addresses; the service events of the container service of the multi-cluster service system are monitored; if the service event represents a container service failure, the failed container service is migrated between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service. This solution is based on the association relationship between virtual IP addresses, and promptly migrates the container service after the container service fails, efficiently repairs the container service function, and avoids the negative impact of the failure on the container service.
[0111] In actual applications, once the virtual IP address providing the container service fails, the container service supported by the virtual IP address will be abnormal. After monitoring the container service failure, the device provided by this solution automatically migrates the container service according to the association relationship, so that other virtual IP addresses replace the failed virtual IP address to provide the above container service, thereby repairing the container service failure and ensuring that users can use the container service function normally.
[0112] Among them, the above modules in the device provided by the embodiment of the present application can also implement the method steps provided by the above method embodiment. Alternatively, the device provided by the embodiment of the present application can also include other modules in addition to the above modules to implement the method steps provided by the above method embodiment. And the device provided by the embodiment of the present application can achieve the technical effects that can be achieved by the above method embodiment.
[0113] Preferably, an embodiment of the present invention further provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, each process of the above-mentioned container service fault repair method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0114] The embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned container service fault repair method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0115] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0116] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0117] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0119] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0120] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0121] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0122] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0123] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0124] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A container service fault repair method, characterized in that: Applied to multi-cluster service systems, including: Acquire preconfigured container resources and attribute information of multiple virtual IP addresses for providing container services, wherein the preconfigured container resources are used to deploy the container service; Generate an association relationship between the multiple virtual IP addresses corresponding to the container service according to the attribute information of the container resource and the multiple virtual IP addresses, wherein the association relationship is used to indicate the multiple virtual IP addresses that can be migrated by the container service, and the attribute information of the virtual IP address includes the region information of the virtual IP address and / or the weight information of the virtual IP address, wherein the region information of the virtual IP address includes the entity IP address information where the virtual IP address is located or the available zone information to which the virtual IP address belongs; Monitor container service events of multi-cluster service systems; If the container service event represents a container service failure, the failed container service is migrated between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service.
2. The method according to claim 1, characterized in that In a case where the attribute information of the virtual IP address includes the region information of the virtual IP address, if the container service event represents a container service failure, performing migration of the failed container service between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service, including: If the container service event represents a container service failure, the failed container service is migrated to a virtual IP address that is different from the availability zone to which the current virtual IP address belongs according to the association relationship between multiple virtual IP addresses corresponding to the failed container service.
3. The method according to claim 1, characterized in that In a case where the attribute information of the multiple virtual IP addresses includes weight information of the virtual IP addresses, if the container service event represents a container service failure, performing migration of the failed container service between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service, including: If the container service event represents a container service failure, determining at least one migratable virtual IP address according to an association relationship between multiple virtual IP addresses corresponding to the failed container service; Migrate the failed container service to a virtual IP address with the largest weight among the at least one migratable virtual IP address.
4. The method according to any one of claims 1 to 3, characterized in that The container service event includes an HTTP status code; Among them, monitoring container service events of multi-cluster service systems includes: Periodically obtain the HTTP status code of the container service of the multi-cluster service system based on a preset time length; If the container service event represents a container service failure, migrating the failed container service between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service includes: If the number of HTTP status codes indicating container service failures obtained continuously is greater than a safety threshold, the failed container service is migrated between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service.
5. The method according to any one of claims 1 to 3, characterized in that After performing migration of the failed container service between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service, the method further includes: Monitoring the state of the first virtual IP address of the container service before performing the migration; If the state of the first virtual IP address indicates that the first virtual IP address has been repaired, the container service is migrated back to the first virtual IP address.
6. The method according to any one of claims 1 to 3, characterized in that: The multi-cluster service system is a kubernetes multi-cluster service system based on istio, and the preconfigured container resources include kubernetes resources and istio resources; The kubernetes resource includes at least one of a deployment resource, a service resource, and an ingress resource; The istio resource includes at least one of a gateway resource, a virtual service resource, a destination rule resource, and a workloadentry resource.
7. A container service fault repair device, characterized in that: include: An acquisition module is used to acquire attribute information of a preconfigured container resource and a plurality of virtual IP addresses for providing a container service, wherein the preconfigured container resource is used to deploy the container service; A generation module, which generates an association relationship between the multiple virtual IP addresses corresponding to the container service according to the attribute information of the container resource and the multiple virtual IP addresses, wherein the association relationship is used to indicate the multiple virtual IP addresses that can be migrated by the container service, and the attribute information of the virtual IP address includes the region information of the virtual IP address and / or the weight information of the virtual IP address, wherein the region information of the virtual IP address includes the entity IP address information where the virtual IP address is located or the available zone information to which the virtual IP address belongs; The monitoring module monitors container service events of multi-cluster service systems; A migration module is configured to migrate the failed container service between the multiple virtual IP addresses according to the association relationship between the multiple virtual IP addresses corresponding to the failed container service if the container service event represents a container service failure.
8. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method according to any one of claims 1 to 6 when executed by the processor.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Service resource processing method and system, proxy equipment and request equipment
CN112492060A
Method for realizing high availability of server host
CN112994977A