Container group migration method, electronic device and storage medium

By periodically checking the connection relationship between container group and storage in Kubernetes and migrating pods in case of exceptions, the pod restart problem caused by connection exceptions is solved to ensure business continuity.

CN114816656BActive Publication Date: 2025-08-22NEW H3C BIG DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210244410.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-11
Publication Date
2025-08-22
Estimated Expiration
2042-03-11

AI Technical Summary

Technical Problem

In the prior art, when the worker node connects to external storage abnormally, the health check fails, causing the pod to be restarted continuously, and thus causing the business to be unavailable.

Method used

The working node periodically sends read requests to the memory, obtains response information, determines whether the communication connection relationship is abnormal, and sends a notification message to the preset controller when the abnormality is abnormal, completing the migration of the pod.

Benefits of technology

Timely discover and resolve connection abnormalities between pods and memory, avoid pods being restarted continuously, ensure the normal processing of business data, and avoid business unavailability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114816656B_ABST
    Figure CN114816656B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention relates to a container group migration method, an electronic device and a storage medium, the method comprising: periodically sending a read request to at least one memory; obtaining response information corresponding to the read request; when it is determined based on data results that the first communication connection relationship between the first memory and one or more pods that establish a communication connection with the first memory is abnormal, sending a first notification message to a preset controller, wherein the preset controller completes the migration of one or more pods based on the first notification message. In this way, it is possible to promptly discover whether an abnormality has occurred in the connection relationship between the pod and the memory. And when an abnormality occurs, the pod is migrated to other working nodes to work, so as not to delay the normal processing of business data. Moreover, this method can also avoid the situation where K8s automatically restarts the pod due to an abnormal connection between the pod and the memory, causing a vicious cycle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a container group migration method, electronic device, and storage medium. Background Art

[0002] Container groups (Pods) in Kubernetes (K8s) come with native health checks. They configure pods of stateful applications with survival health checks (to confirm whether the application is alive and can continue to provide services) and availability health checks (to check whether the application is ready to accept HTTP requests. If the check passes, traffic is introduced).

[0003] Pods are located on worker nodes. Existing health checks presuppose a smooth connection between the worker node and external storage. If the connection between the worker node and external storage fails, the existing health check will fail. In this case, Kubernetes will automatically restart the pod. After the restart, services may continue to be dispatched to the failed node, causing the pod to repeatedly restart due to connection anomalies, resulting in service unavailability. Summary of the Invention

[0004] The present application provides a container group migration method, electronic device, and storage medium to solve the above-mentioned technical problems in the prior art.

[0005] In a first aspect, the present application provides a container group migration method, which is executed by a worker node, the worker node including at least one container group pod, and the method includes:

[0006] Periodically sending a read request to at least one storage, wherein each of the at least one storage establishes a communication connection with one or more pods of the at least one pod;

[0007] Obtaining response information corresponding to the read request, wherein the response information includes a data result read from a first memory, where the first memory is any one of the at least one memory;

[0008] When it is determined based on the data results that a first communication connection relationship between the first storage and one or more pods that establish a communication connection with the first storage is abnormal, a first notification message is sent to the preset controller, wherein the first notification message is used to instruct the preset controller to complete the migration of the one or more pods.

[0009] In one possible implementation, determining whether an abnormality occurs in a first communication connection relationship between the first storage and one or more pods that establish a communication connection with the first storage based on the data result read from the first storage specifically includes:

[0010] Compare the current read data results with the historical data results;

[0011] If the data result read currently is the same as the historical data results read n times previously, it is determined that the first communication connection relationship is abnormal, where n is a positive integer.

[0012] In a possible implementation, if the data result read currently is different from the historical data result read previously, it is determined that the first communication connection relationship is normal.

[0013] In a possible implementation, if the data result read currently is the data result read for the first time, it is directly determined that the first communication connection relationship is normal.

[0014] In a possible implementation, after periodically sending a read request to at least one memory, the method further includes:

[0015] When no response information corresponding to the read request is obtained within a preset time period, it is determined that the connection relationship between the working node and the first storage is abnormal.

[0016] In a possible implementation, when it is determined based on the data result that a first communication connection relationship between the first storage and one or more pods that establish a communication connection with the first storage is abnormal, the method further includes:

[0017] The working node is marked to indicate that the preset controller no longer selects the working node as a scheduling option.

[0018] In one possible implementation, when a communication connection relationship between a preset number of storage devices and pods communicating with the storage devices in the working node fails, the method further includes:

[0019] Expand the worker node so that the preset controller migrates the pods that establish communication connections with the preset number of storages to the expanded worker node.

[0020] Optionally, each of the one or more pods that establish a communication connection with the first storage device includes a heartbeat container and at least one business container;

[0021] The heartbeat container and at least one service container respectively establish communication connections with the first storage;

[0022] A heartbeat container, used for periodically writing timestamp data to the first memory;

[0023] After the working node sends a read request to the first storage, the working node reads the timestamp data from the first storage as a data result, and determines whether an abnormality occurs in the first communication connection relationship between the pod and the first storage according to the data result;

[0024] The service container is used to process the allocated service data and store the processing results in the first memory.

[0025] In a second aspect, the present application provides a container group migration device, the device comprising:

[0026] a sending module, configured to periodically send a read request to at least one storage, wherein each of the at least one storage establishes a communication connection with one or more pods in the at least one container group pod;

[0027] an acquisition module, configured to acquire response information corresponding to the read request, wherein the response information includes a data result read from a first memory, where the first memory is any one of the at least one memory;

[0028] a processing module, configured to determine, based on the data result read from the first memory, whether an abnormality occurs in a first communication connection relationship between the first memory and one or more pods that establish a communication connection with the first memory;

[0029] The sending module is further used to send a first notification message to the preset controller when the processing module determines that the first communication connection relationship is abnormal based on the data results, wherein the first notification message is used to instruct the preset controller to complete the migration of one or more pods.

[0030] According to a third aspect, an electronic device is provided. The electronic device corresponds to at least one working node, and the working node includes a processor, a communication interface, a memory, and a communication bus. The processor, the communication interface, and the memory communicate with each other via the communication bus.

[0031] Memory for storing computer programs;

[0032] The processor is configured to implement the steps of the container group migration method according to any one of the embodiments of the first aspect when executing a program stored in the memory.

[0033] In 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 container group migration method as described in any embodiment of the first aspect are implemented.

[0034] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0035] The method provided in an embodiment of the present application periodically sends a read request to a storage device, wherein the storage device establishes a communication connection with one or more pods. Response information corresponding to the read request is obtained, wherein the response information includes the result of reading the data. Based on the data result, it is determined whether an abnormality occurs in the first communication connection relationship between the first storage device and the one or more pods that establish a communication connection with the first storage device. When it is determined that an abnormality occurs, a first notification message is sent to the preset controller so that the preset controller completes the migration of one or more pods based on the first notification message. In this process, it is possible to promptly discover whether an abnormality occurs in the connection relationship between the pod and the storage device. And when an abnormality occurs, the pod is migrated to other working nodes to work, so as not to delay the normal processing of business data. Moreover, this method can also avoid the situation where, due to an abnormality in the connection between the pod and the storage device, K8s will automatically restart the pod with stateful application in a continuous cycle when performing a health check on the pod with stateful application, thereby causing the business to be unavailable. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A schematic diagram of a container group migration method according to an embodiment of the present invention;

[0037] Figure 2 A diagram of the system architecture to which the working nodes provided by the present invention belong;

[0038] Figure 3 A schematic diagram of a structure in which pod1 and storage 1 are migrated to working node 2 when a failure occurs in the connection between pod1 and storage 1 provided by the present invention;

[0039] Figure 4 The present invention provides a structural diagram of migrating pod3 and storage 3 on working node 1 to an expansion node;

[0040] Figure 5 The present invention provides a structural diagram in which when a new pod appears, worker node 1 is no longer selected for scheduling;

[0041] Figure 6 A schematic structural diagram of a container group migration device provided by an embodiment of the present invention;

[0042] Figure 7 A schematic structural diagram of an electronic device is provided for an embodiment of the present invention. DETAILED DESCRIPTION

[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0044] To facilitate understanding of the embodiments of the present invention, specific embodiments will be further explained below with reference to the accompanying drawings. The embodiments do not limit the embodiments of the present invention.

[0045] In response to the technical problems mentioned in the background technology, the present application embodiment provides a container group migration method, see Figure 1 As shown, Figure 1 This is a flow chart of a container group migration method provided by an embodiment of the present invention. This method is executed by any working node. Before introducing the steps of this method, we first introduce the system architecture diagram where the working node is located. Figure 2 Specifically, the system architecture diagram includes a pre-configured controller in Kubernetes, which sends control commands to migrate certain pods. It's important to note that the pod migration mentioned here involves not only the pods themselves, but also the storage that establishes a communication connection with the pods. Furthermore, on the new worker node, the communication connection between the pods and the storage is reconfigured to ensure a normal communication connection between the pods and the storage.

[0046] The default controller is the control center of the control node cluster, responsible for issuing migration instructions. The actual execution of the migration is performed by a control node within the cluster. The specific control node to be used for the task is determined based on the actual situation. For example, the control node to be assigned to perform pod migrations can be assigned based on load balancing principles. The specific control node assignment scheme can be implemented using existing technologies and will not be further explained here.

[0047] In a specific example, for example, the system architecture diagram includes multiple working nodes ( Figure 2 (The figure shows two worker nodes.) Each worker node can contain at least one pod. The pods mentioned here are pods with stateful applications.

[0048] A stateful application refers to a stateful service: a running instance of a service needs to store persistent data locally, such as a database or a dependency topology between multiple instances, such as a master-slave relationship or a master-backup relationship. If one of the dependent Pods is stopped, data loss or cluster crash will occur. Applications with unequal relationships between instances and instances that have dependencies on external data are called "stateful applications." In this embodiment, a pod with a stateful application refers to a pod that needs to persist the result data processed by the business container in the corresponding storage.

[0049] For example Figure 2 Worker node 1 includes pod 1 and pod 3. Worker node 2 includes pod 2. Each pod can include a heartbeat container and a business container.

[0050] The heartbeat container periodically sends timestamp information to the storage connected to the pod. This allows subsequent worker nodes to verify whether the communication connection between the pod and the storage is abnormal based on the timestamp information stored in the storage. The business container, on the other hand, executes normal business applications, processes assigned business data, and then stores it in the storage.

[0051] In an optional example, multiple service containers can be configured on the same pod, each of which is used to execute a service, and different service containers execute different services. Accordingly, different service containers on the same pod share the same memory.

[0052] Different pods on different worker nodes require different storage allocations. If different pods are on the same worker node, they can share the same storage while running. However, each pod still has its own heartbeat container configured to perform its corresponding functions.

[0053] See also Figure 2 The figure shows that the working node 1 described above includes two pods, each pod corresponds to a storage device, and each pod is configured with a heartbeat container and a business container.

[0054] Figure 2 Different nodes are also shown (including working nodes and control nodes, which are respectively connected to the management network, storage network, or business network, etc.). The specific connection principle is the existing technology and has little to do with this application, so it will not be elaborated here.

[0055] The method steps in the embodiments of this application are applicable to Figure 2For each working node in the storage, the execution of the steps of the method is mainly achieved by the working node. Specifically, the steps can be achieved by running a storage online inspection program on the working node. The method may include:

[0056] Step 110: Periodically send a read request to at least one memory.

[0057] Specifically, each of the at least one storage establishes a communication connection with one or more pods in the at least one pod.

[0058] See also Figure 2 As shown, Figure 2 The diagram shows a communication connection between a storage and a pod. Take worker node 1 as an example. Worker node 1 includes pod1 and pod3. Pod1 and pod3 each establish a communication connection with a storage. Figure 2 The figure shows that pod1 establishes a communication connection with storage 1 (volume 1), and pod3 establishes a communication connection with storage 3 (volume 3). Therefore, worker node 1 needs to periodically send read requests to storage 1 and storage 3 respectively. Figure 2 As shown, Figure 2 For simplicity, only the diagram of worker node 1 sending a read request to the storage is shown. Figure 2 The communication connection relationship between the working node 1 and the storage 1 is shown in FIG. For the sake of simplicity, the communication connection relationship between the remaining working nodes and the storage is simplified and not shown in FIG. Figure 1 It is reflected in.

[0059] Step 120: Obtain response information corresponding to the read request.

[0060] Specifically, the response information includes data results read from the first memory, where the first memory is any one of the at least one memory.

[0061] In an optional example, as described above, each pod includes a heartbeat container and at least one business container. Among the one or more pods that establish a communication connection with the first storage, each pod includes a heartbeat container and at least one business container;

[0062] The heartbeat container and at least one service container respectively establish communication connections with the first storage;

[0063] A heartbeat container, used for periodically writing timestamp data to the first memory;

[0064] After the working node sends a read request to the first storage, the working node reads the timestamp data from the first storage as a data result, and determines whether an abnormality occurs in the first communication connection relationship between the pod and the first storage according to the data result;

[0065] The service container is used to process the allocated service data and store the processing results in the first memory.

[0066] In the following, the storage 1 is taken as the first storage and the communication connection relationship established between the pod 1 and the storage 1 is taken as the first communication connection relationship as an example.

[0067] In an optional example, the read data result includes the timestamp information mentioned above, that is, the timestamp of the heartbeat information received recorded in the memory after the heartbeat container in pod1 sends the heartbeat information to memory 1.

[0068] Step 130 : When it is determined based on the data result that a first communication connection relationship between the first storage and one or more pods communicating with the first storage is abnormal, a first notification message is sent to a preset controller.

[0069] The purpose of sending the first notification message to the preset controller is to facilitate the preset controller to complete the migration of one or more pods according to the first notification message, so as to avoid delaying business processing and causing inevitable impact on users.

[0070] In an optional specific example, determining whether the first communication connection relationship between the first storage and one or more pods that establish communication connections with the first storage is abnormal based on the data results may include the following situations.

[0071] In order to better explain how to determine whether an abnormality occurs in the first communication connection relationship in different situations, the following contents are first explained:

[0072] After the heartbeat container is created, the timestamp is initialized in the storage. For example, the initial configuration is the timestamp after the heartbeat container is created. Or, the timestamp written after the first heartbeat message is sent. Based on this, you can better understand the following content.

[0073] The first case is:

[0074] When the data result currently read by the working node is the "initialization" timestamp configured in the memory of the heartbeat container, the first communication connection relationship is defaulted to be in a normal state, that is, it is determined that the first communication connection relationship is normal.

[0075] The second case is:

[0076] When the data result read this time is not the first data result, and the data result read by the working node this time is different from the data result read the previous time, it means that the first communication connection relationship is normal, and it can still be determined that there is no abnormality in the first communication connection relationship between the first storage and one or more pods that establish communication connections with the first storage.

[0077] In a third case, if the data result read currently is the same as the results read n times previously, it is determined that the first communication connection relationship is abnormal, where n is a positive integer.

[0078] For example, if the data result read currently is the same as the data result read previously, then it can be determined that an abnormality has occurred in the first communication connection relationship.

[0079] However, for more rigorous considerations and to avoid data reading anomalies due to certain special circumstances, the data can be read several times. That is, after the current reading, the data results can be read several times to determine whether the data results are exactly the same. If they are exactly the same, it is determined that an anomaly has occurred in the first communication connection relationship.

[0080] What needs to be explained here is that when it is determined that the data result of the current read is different from the data result of the previous read, there is no need to read the data result multiple times to verify that the first communication connection relationship is normal. This is because the heartbeat container will periodically send heartbeat information to the memory. As long as the memory can receive the heartbeat information, it will update the timestamp information at any time as time changes. This is not to verify whether the received timestamp information is accurate, but as long as it can be determined that the timestamp information has changed, it can be determined that the first communication connection relationship is normal. Therefore, there is no need to verify multiple times. The reason why it is necessary to compare several times when determining that the data result of the current read is the same as the data result of the previous read is also introduced above, so I will not explain it in detail here.

[0081] It should also be noted that, although each pod includes a heartbeat container and at least one business container. Then, according to the content introduced above, it means that as long as the timestamp information in the memory does not change, or does not change for many times, it means that the connection relationship between the pod and the memory is abnormal. This is because the heartbeat container only performs the write data operation in the memory, and if a write failure occurs (the previous and next time, or even the next few times, the data is the same), it is sufficient to prove that the network connection relationship between the pod and the memory is abnormal, or the memory itself fails (the probability of the heartbeat container failing is so small that it can be almost ignored and is no longer within the scope of consideration of this application). Therefore, even if the business container writes data to the memory, it will fail, which will inevitably lead to the subsequent inability of the business to operate normally. Therefore, it can be directly assumed that the communication connection relationship between the pod and the memory is abnormal, and all pods that need to complete the communication connection with the memory are migrated to other working nodes.

[0082] Further optionally, determining that an abnormality occurs in the connection relationship between one or more pods and the storage based on the above situations can actually further indicate that an abnormality occurs in the connection relationship between the working node and the storage.

[0083] However, in addition to the aforementioned situation indicating an abnormal connection between the working node and the storage, another special situation may also indicate an abnormal connection between the working node and the storage. Once an abnormal connection occurs between the working node and the storage, it is impossible to determine whether an abnormal connection has occurred in the first communication connection between the pod and the storage. Once an abnormal connection occurs between the pod and the storage, the first notification message cannot be sent to the preset controller in a timely manner.

[0084] Therefore, in an embodiment of the present application, the connection relationship between the working node and the memory is further verified. The specific verification process does not require any additional operations, but directly determines whether a response information corresponding to the read request is received within a preset time period after periodically sending a read request to at least one memory.

[0085] If no response information corresponding to the read request is obtained within a preset time period, it can be determined that the connection relationship between the working node and the storage is abnormal.

[0086] At this time, it is necessary to send a second notification message to the preset controller, wherein the second notification message is used to instruct the preset controller to complete the migration of one or more pods, that is, to complete the migration of one or more pods that establish a communication connection with the first storage.

[0087] Specifically, how the preset controller completes the migration of one or more pods has been described in detail in the beginning of the specific implementation method. Please refer to the above for details and will not be repeated here.

[0088] Figure 3 FIG2 shows a schematic diagram of migrating pod1 and storage 1 to working node 2 when a connection failure occurs between pod1 and storage 1. ...

[0089] The specific migration work will not be described in detail here.

[0090] It should be noted that when the preset controller assigns pod1 to other worker nodes, it can first determine the current resource usage of different worker nodes, such as CPU usage. Based on the resource usage, it selects the least idle worker node to take over pod1.

[0091] Further optionally, when it is determined that the first communication connection relationship is abnormal, in addition to sending the first notification message to the preset controller, the method may further include:

[0092] The working node is marked to indicate that the preset controller no longer selects the working node for scheduling.

[0093] For example, a "maintenance" flag may be marked on a worker node where an abnormality has occurred, so that the controller is pre-set to no longer send service data to the worker node where an abnormality in the communication connection between the pod and the storage has occurred.

[0094] Further optionally, when the communication connection relationships between the pods to which the preset number of storage devices have established communication connections in the working node all fail, the method further includes:

[0095] Expand the worker node so that the preset controller migrates the pods that establish communication connections with the preset number of storages to the expanded worker node.

[0096] Specifically, as described above, the same storage may be configured with one or more pods to establish communication connections with it. Therefore, the number of pods is no longer used as the criterion for whether to expand worker nodes. Instead, the number of storage devices is used as the criterion for expanding worker nodes.

[0097] See Figure 4As shown in the figure, for example, worker node 1 includes pod1 and pod3, which correspond to storage 1 and storage 3 respectively. When the communication connection between pod1 and storage 1 fails and it is transferred to worker node 2, the communication connection between pod3 and storage 3 also fails. Worker node 1 is directly in a "downtime" state and cannot undertake new business. Then, it is necessary to migrate pod3 and storage 3 currently configured on worker node 1 to the expansion node so that pod3 can complete the corresponding business on the expansion node. Figure 4 For the sake of simplicity, only the communication connection relationship between the working node 3 and the memory 3 is shown. For the sake of simplicity, the communication connection relationship between other working nodes and the memory is not shown. Figure 4 It is reflected in. Figure 5 Similar, will not be repeated below.

[0098] Of course, in the above example, because worker node 1 only includes pod 1 and pod 3, if an anomaly also occurs between pod 3 and storage 3, the node must be expanded. In actual applications, however, expanding the node isn't necessary until all storage devices on a worker node fail to communicate with the pods connected to them. Instead, expanding the worker node is necessary only when it is determined that a predetermined number of storage devices have failed to communicate with the pods connected to them.

[0099] This operation is not only to ensure timely completion of tasks, but also to balance the load of different worker nodes. This avoids directly migrating the pods of the failed worker node to the existing worker node without expanding the node capacity, which causes other worker nodes to be overloaded and further cause other worker nodes to fail, resulting in a vicious cycle.

[0100] Of course, in an optional method, if other worker nodes are not overloaded and can still take on other pods, capacity expansion can be avoided. Instead, the pods on the failed worker node can be migrated to idle worker nodes. The specific operation is not limited here.

[0101] Optional, Figure 5 As shown in the figure, when a new business is created, pod 4 and the corresponding storage 4 need to be built. At this time, worker node 1 will not be selected for scheduling, but pod 4 and storage 4 will be configured on expansion node 3.

[0102] The container group migration method provided by an embodiment of the present invention periodically sends a read request to a storage device, wherein the storage device establishes a communication connection with one or more pods. Response information corresponding to the read request is obtained, wherein the response information includes the result of reading the data. Based on the data result, it is determined whether an abnormality occurs in the first communication connection relationship between the first storage device and the one or more pods that establish a communication connection with the first storage device. When it is determined that an abnormality occurs, a first notification message is sent to a preset controller so that the preset controller completes the migration of one or more pods based on the first notification message. In this process, it is possible to promptly discover whether an abnormality occurs in the connection relationship between the pod and the storage device. When an abnormality occurs, the pod is migrated to other working nodes to work, so as not to delay the normal processing of business data. Moreover, this method can also avoid the situation where, due to an abnormality in the connection between the pod and the storage device, K8s will automatically restart the pod with stateful application in a continuous cycle when performing a health check on the pod with stateful application, thereby causing the business to be unavailable.

[0103] The above are several embodiments of the pod migration method provided by this application. The following describes other embodiments of the pod migration provided by this application. Please refer to the following for details.

[0104] Figure 6 An embodiment of the present invention provides a container group migration device, which includes: a sending module 601 , an acquiring module 602 , and a processing module 603 .

[0105] A sending module 601 is configured to periodically send a read request to at least one storage, wherein each of the at least one storage establishes a communication connection with one or more pods in the at least one pod;

[0106] An acquisition module 602 is configured to acquire response information corresponding to the read request, wherein the response information includes a data result read from a first memory, where the first memory is any one of the at least one memory;

[0107] The processing module 603 is configured to determine, based on the data result read from the first storage, whether an abnormality occurs in a first communication connection relationship between the first storage and one or more pods that establish communication connections with the first storage;

[0108] The sending module 601 is further configured to send a first notification message to the preset controller when the processing module 603 determines that the first communication connection relationship is abnormal based on the data result, wherein the first notification message is used to instruct the preset controller to complete the migration of one or more pods.

[0109] Optionally, the processing module 603 is specifically configured to:

[0110] Compare the current read data results with the historical data results;

[0111] If the data result read currently is the same as the historical data results read n times previously, it is determined that the first communication connection relationship is abnormal, where n is a positive integer.

[0112] Optionally, the processing module 603 is further configured to determine that the first communication connection relationship is normal if the data result read currently is different from the historical data result read previously.

[0113] Optionally, the processing module 603 is further configured to directly determine that the first communication connection relationship is normal if it is determined that the data result currently read is the data result read for the first time.

[0114] Optionally, the processing module 603 is further configured to determine that the connection relationship between the working node and the first storage is abnormal when no response information corresponding to the read request is obtained within a preset time period;

[0115] The sending module 601 is further configured to send a second notification message to the preset controller, where the second notification message is used to instruct the preset controller to complete the migration of one or more pods.

[0116] Optionally, the apparatus further includes: a marking module 604;

[0117] The marking module 604 is used to mark the working node, and the mark is used to instruct the preset controller to no longer use the working node as a scheduling option.

[0118] Optionally, the processing module 603 is further configured to expand a working node so that the preset controller migrates the pods that have established communication connections with a preset number of storages to the expanded working node.

[0119] Optionally, each of the one or more pods that establish a communication connection with the first storage device includes a heartbeat container and at least one business container;

[0120] The heartbeat container and at least one service container respectively establish communication connections with the first storage;

[0121] A heartbeat container is used to periodically write timestamp data to the first storage; after the sending module 601 sends a read request to the first storage, the acquisition module 602 reads the timestamp data from the first storage as a data result; and the processing module 603 determines whether an abnormality occurs in the first communication connection relationship between the pod and the first storage based on the data result;

[0122] The service container is used to process the allocated service data and store the processing results in the first memory.

[0123] The functions performed by the various components in the container group migration device provided by the embodiment of the present invention have been described in detail in any of the above method embodiments, and therefore will not be repeated here.

[0124] A container group migration device provided by an embodiment of the present invention periodically sends a read request to a storage device, wherein the storage device establishes a communication connection with one or more pods. Response information corresponding to the read request is obtained, wherein the response information includes the result of the read data. Based on the data result, it is determined whether an abnormality occurs in the first communication connection relationship between the first storage device and the one or more pods that establish a communication connection with the first storage device. When it is determined that an abnormality occurs, a first notification message is sent to a preset controller so that the preset controller completes the migration of the one or more pods based on the first notification message. In this process, it is possible to promptly discover whether an abnormality occurs in the connection relationship between the pod and the storage device. When an abnormality occurs, the pod is migrated to other working nodes to work, so as not to delay the normal processing of business data. Moreover, this method can also avoid the situation where, due to an abnormality in the connection between the pod and the storage device, K8s will automatically restart the pod with stateful application in a continuous cycle when performing a health check on the pod with stateful application, thereby causing business unavailability.

[0125] like Figure 7 As shown, an embodiment of the present application provides an electronic device, including at least one working node, each working node including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0126] Memory 113, for storing computer programs;

[0127] In one embodiment of the present application, the processor 111 is configured to execute a program stored in the memory 113 to implement the container group migration method provided by any of the aforementioned method embodiments, including:

[0128] Periodically sending a read request to at least one storage, wherein each of the at least one storage establishes a communication connection with one or more pods of the at least one pod;

[0129] Obtaining response information corresponding to the read request, wherein the response information includes a data result read from a first memory, where the first memory is any one of the at least one memory;

[0130] When it is determined based on the data results that a first communication connection relationship between the first storage and one or more pods that establish a communication connection with the first storage is abnormal, a first notification message is sent to the preset controller, wherein the first notification message is used to instruct the preset controller to complete the migration of the one or more pods.

[0131] Optionally, determining whether an abnormality occurs in a first communication connection relationship between the first storage and one or more pods that establish a communication connection with the first storage based on the data result read from the first storage specifically includes:

[0132] Compare the current read data results with the historical data results;

[0133] If the data result read currently is the same as the historical data results read n times previously, it is determined that the first communication connection relationship is abnormal, where n is a positive integer.

[0134] Optionally, the method further includes: if the data result read currently is different from the historical data result read previously, determining that the first communication connection relationship is normal.

[0135] Optionally, if the data result read currently is the data result read for the first time, it is directly determined that the first communication connection relationship is normal.

[0136] Optionally, after periodically sending a read request to at least one memory, the method further includes:

[0137] When no response information corresponding to the read request is obtained within a preset time period, determining that the connection relationship between the working node and the first storage is abnormal;

[0138] A second notification message is sent to the preset controller, where the second notification message is used to instruct the preset controller to complete the migration of one or more pods.

[0139] Optionally, when it is determined according to the data result that the first communication connection relationship between the first storage and one or more pods that establish communication connections with the first storage is abnormal, the method further includes:

[0140] The working node is marked to indicate that the preset controller no longer selects the working node as a scheduling option.

[0141] Optionally, when a communication connection relationship between a preset number of storage devices and pods communicating with the storage devices in the working node fails, the method further includes:

[0142] Expand the worker node so that the preset controller migrates the pods that establish communication connections with the preset number of storages to the expanded worker node.

[0143] Optionally, the heartbeat container and at least one service container respectively establish communication connections with the first storage;

[0144] A heartbeat container, used for periodically writing timestamp data to the first memory;

[0145] After the working node sends a read request to the first storage, the working node reads the timestamp data from the first storage as a data result, and determines whether an abnormality occurs in the first communication connection relationship between the pod and the first storage according to the data result;

[0146] The service container is used to process the allocated service data and store the processing results in the first memory.

[0147] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the container group migration method provided in any of the aforementioned method embodiments are implemented.

[0148] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device that includes the element.

[0149] The foregoing is merely a detailed description of the present invention, intended to enable those skilled in the art to understand and implement the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein, but is to be construed in the widest manner consistent with the principles and novel features claimed herein.

Claims

1. A container group migration method, characterized in that: The method is executed by a worker node, the worker node including at least one container group pod, and the method includes: Periodically sending a read request to at least one storage, wherein each of the at least one storage establishes a communication connection with one or more pods of the at least one pod; Obtaining response information corresponding to the read request, wherein the response information includes a data result read from a first memory, where the first memory is any one of the at least one memory; Compare the current read data results with the historical data results; If the data result read currently is the same as the historical data result read n times previously, it is determined that the first communication connection relationship is abnormal, where n is a positive integer; When it is determined that a first communication connection relationship between the first storage and one or more pods that establish a communication connection with the first storage is abnormal, a first notification message is sent to a preset controller, wherein the first notification message is used to instruct the preset controller to complete the migration of the one or more pods.

2. The method according to claim 1, characterized in that The method further includes: if the data result read currently is different from the historical data result read previously, determining that the first communication connection relationship is normal.

3. The method according to claim 1 or 2, characterized in that If the data result read currently is the data result read for the first time, it is directly determined that the first communication connection relationship is normal.

4. The method according to claim 1 or 2, characterized in that After periodically sending a read request to at least one memory, the method further includes: When no response information corresponding to the read request is obtained within a preset time period, determining that the connection relationship between the working node and the first storage is abnormal; A second notification message is sent to the preset controller, where the second notification message is used to instruct the preset controller to complete the migration of one or more pods.

5. The method according to claim 1 or 2, characterized in that When it is determined, based on the data result, that a first communication connection relationship between the first storage and one or more pods communicating with the first storage is abnormal, the method further includes: The working node is marked, where the mark is used to instruct a preset controller to no longer select the working node as a scheduling option.

6. The method according to claim 1 or 2, characterized in that When a communication connection relationship between a preset number of storage devices in the working node and the pods that establish communication connections therewith fails, the method further includes: The working node is expanded so that the preset controller migrates the pods that respectively establish communication connections with the preset number of storages to the expanded working node.

7. The method according to claim 1 or 2, characterized in that Among the one or more pods that establish a communication connection with the first storage, each pod includes a heartbeat container and at least one business container; The heartbeat container and at least one of the service containers respectively establish communication connections with the first memory; The heartbeat container is used to periodically write timestamp data to the first memory; After the working node sends a read request to the first storage, the working node reads the timestamp data from the first storage as the data result, and determines whether an abnormality occurs in the first communication connection relationship between the pod and the first storage according to the data result; The service container is used to process the allocated service data and store the processing results in the first memory.

8. An electronic device, characterized in that: The electronic device corresponds to at least one working node, each of the working nodes includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; The processor is configured to implement the steps of the container group migration method according to any one of claims 1 to 7 when executing a program stored in the memory.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the container group migration method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Log collection method and system, node, electronic equipment and readable storage medium

    CN111046011A

  • Network communication control method and device, electronic equipment and readable storage medium

    CN112448858A