Cluster network communication detection method and apparatus, and computing device
By deploying network detection software in Kubernetes clusters to detect communication between network resources, the problem of abnormal network resource communication when the cluster is large is solved, and the load and performance of the cluster are improved.
Patent Information
- Application Number
- CN202411392043.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In Kubernetes cluster, when the cluster size is too large, due to the excessive CPU resources occupied by updating and synchronization of network resources, communication between network resources may be abnormal and communication cannot be carried out normally.
Provide a cluster network communication detection method, which runs on a computing device through network detection software, determines the type of network resource to be detected, obtains the IP address of the target network resource, and sends a network detection message to each IP address to determine the response situation to determine communication exceptions.
This method can effectively judge the communication between network resources, reduce unnecessary CPU resource occupation, improve the load and performance of the cluster, and ensure normal communication between network resources.
Smart Images

Figure CN119420682A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of server clusters, and in particular to a cluster network communication detection method, device and computing equipment. Background Art
[0002] A Kubernetes cluster is a group of computers used to run containerized applications, which can be composed of network-connected nodes.
[0003] When the Kubernetes cluster is too large, the cluster may need to occupy more CPU resources due to some reasons. For example, one of the reasons why the cluster needs to occupy more CPU resources may be that when the network resources (such as Node, PDO or Service) are restarted or newly enabled, the address of each network resource and the corresponding network policy and routing information need to be updated in the Calicodatastore database of the API server, and the API server will also synchronize the address of the updated network resource to the Felix component of each Node in the cluster. In addition, the network resource will broadcast the newly configured routing information to other Nodes in the cluster through the BGP protocol. When the cluster is large, that is, when the number of network resources such as Node, PDO or Service is large, there may be more addresses of network resources that need to be synchronized, network policies, and routing information that need to be broadcast, that is, more data needs to be synchronized and broadcasted. A large amount of data synchronization and data broadcasting require more CPU resources. As the occupied CPU resources increase, it will bring huge challenges to the load and performance of the entire cluster, which may cause the network to be disconnected between some network resources such as Node, POD or Service, that is, unable to communicate.
[0004] Therefore, how to determine the communication status between network resources is a technical problem that urgently needs to be solved in this field. Summary of the invention
[0005] Embodiments of the present application provide a cluster network communication detection method, apparatus, and computing device to detect the communication status between network resources in the cluster.
[0006] In a first aspect, an embodiment of the present application provides a cluster network communication detection method, which is applied to a computing device in the cluster. The computing device may include network detection software. When the network detection software is running, the cluster network communication detection method includes:
[0007] Determine the type of network resources to be detected, wherein the configured type of network resources to be detected can be one or more of POD network resource information (i.e., detecting the IP address of the POD network), Node network resource information (i.e., detecting the IP address of the Node network), and Service network resource information (i.e., detecting the IP address of the Service network).
[0008] Then, the IP address of the target network resource can be determined according to the type of network resource to be detected, and a network detection message can be sent to each IP address respectively. If it is determined that the response message returned by the target network resource is not received or the delay in receiving the response message is greater than or equal to the delay threshold, then the network resource corresponding to the IP address may not have received the network detection message, and it can be determined that the communication with the target network resource corresponding to the IP address is abnormal.
[0009] Specifically, when the type of the object to be detected is POD network resource information and / or Service network resource information, the computing device can obtain the operating status of each network resource to be detected that carries a detection tag according to the type of the network resource to be detected, wherein the detection tag indicates that the network resource to be detected is a newly started network resource to be detected or a network resource to be detected related to the target service. Then, the network resource to be detected whose operating status is an available status (also called a running status) is determined as the target network resource, thereby determining the IP address of the target network resource. A network detection message is only sent to the IP address corresponding to the target network resource. In this way, the IP address information of the network detection message can be made more accurate and the number of network detection messages sent can be reduced, thereby saving resources.
[0010] In some possible implementations, a cluster may include multiple computing devices, and a network detection software is deployed in each computing device, so that each computing device can detect the communication status between network resources related to the computing device, thereby improving the efficiency of detecting the communication status between network resources in the cluster.
[0011] In some possible implementations, the computing device may include a first computing device and a second computing device. The current network detection software is deployed in a network detection container of the first computing device. After determining that the communication with the target network resource corresponding to the IP address is abnormal, the network detector can be dispatched from the first computing device to the second computing device.
[0012] In some possible implementations, the IP address of the network resource to be detected whose running status is unavailable can also be deleted from the data structure of the cluster, where the data structure is used to store the IP addresses of the network resources in the cluster, and the unavailable status can include the non-running status (also called the not running status, which means that the network resource is not running normally) and other status (the other status here can be, for example, the succeeded status and the failed status, etc.).
[0013] The succeeded state means that the task in the network resource has been completed and terminated, and will not be restarted if no restart command is received. The failed state means that the network resource has terminated due to some error.
[0014] In some possible implementations, the Prometheus tool may be used to display the detection results, where the detection results include: the IP address of each target network resource and whether the communication with each target network resource is abnormal.
[0015] In some possible implementations, the type of the network resource to be detected may be determined as follows:
[0016] Obtain configuration instructions, and determine the type of network resources to be detected according to the configuration instructions.
[0017] The operating status of each network resource to be detected that carries a detection tag is obtained according to the type of the network resource to be detected. Specifically, the corresponding type and number of network resources to be detected can be started according to the number of network resources to be started carried in the configuration instruction. For example, the type of the configured network resource to be detected is POD network resource information, and the configuration instruction indicates that 5000 POD resources need to be started. Then the controller can start 5000 POD resources according to the type of the network resource to be detected and the configuration instruction (that is, create 5000 PODs and assign a corresponding IP address to each POD). Then, a detection tag can be configured for each started network resource to be detected, and the operating status of each network resource to be detected that carries a detection tag can be obtained.
[0018] In a second aspect, the present application provides a cluster network communication detection device, including: an interface configuration module (also called a configuration server), a controller, and a network detection timer;
[0019] The interface configuration is used to receive configuration instructions and determine the type of network resources to be detected according to the configuration instructions.
[0020] The controller is used to determine the IP address of the target network resource according to the type of the network resource to be detected, wherein:
[0021] The network detection timer is used to send a network detection message to each IP address.
[0022] If it is determined that the response message returned by the target network resource is not received or the delay in receiving the response message is greater than or equal to the delay threshold, it is determined that the communication with the target network resource corresponding to the IP address is abnormal.
[0023] In some possible implementations, the device may further include:
[0024] The exporter is used to display the detection results using the Prometheus tool, where the detection results include: the IP address of each target network resource and whether the communication with each target network resource is abnormal.
[0025] In a third aspect, an embodiment of the present application provides a computing device, including: a memory and a processor;
[0026] The memory is coupled to the processor; the memory stores program instructions, and when the program instructions are executed by the processor, the computing device executes any implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A structural diagram of a Kubernetes cluster for communicating with Calico components based on a CNI network provided in an embodiment of the present application;
[0028] Figure 2 A framework diagram of a cluster network communication detection system provided in an embodiment of the present application;
[0029] Figure 3 A flow chart of a cluster network communication detection method provided in an embodiment of the present application;
[0030] Figure 4 A flow chart of another cluster network communication detection method provided in an embodiment of the present application;
[0031] Figure 5 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0034] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0035] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0036] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0037] A Kubernetes cluster is a group of computers used to run containerized applications. It can be composed of network-connected nodes, which can be virtual machines or physical machines. They work together to provide distributed services. The main goal of a Kubernetes cluster is to provide a platform that makes the deployment, expansion, and management of containerized applications simpler and more automated. A Kubernetes cluster can automatically handle node failures, container failures, and automatic expansion of applications.
[0038] A Kubernetes cluster can include network resources such as Node, POD, and Service. POD and Service can communicate through the container network interface (CNI). For example, Figure 1 As shown, Figure 1 A structural diagram of a Kubernetes cluster for Calico component communication based on a CNI network provided in an embodiment of the present application. The cluster may include:
[0039] API server 100 and Linux Host 101, where API server 100 is one of the core components of the Kubernetes control plane. API server provides the Kubernetes API interface, allowing users and internal components to interact with the cluster and perform operations such as deploying, scaling, and upgrading applications. API server is also used to update and store resource information such as the IP address of the node and the IP address of the POD in the node.
[0040] The API server 100 may specifically store Kubernetes Objects information and Calico datastore information;
[0041] Kubernetes Objects information is a series of records used to describe the state of the Kubernetes cluster. Each object is a persistent entity that can be created, queried, updated, and deleted through the API provided by the API server.
[0042] Calico datastore information includes network policies and network configuration information. Calico's Felix component communicates with the datastore regularly to obtain the latest network policies and network configuration information (including IP address allocation, routing information, network interface configuration, etc.).
[0043] The Linux host 101 may be a physical server or a virtual machine, where a Linux host may be a node, which may be used to run containerized applications.
[0044] In some possible implementations, the node Node can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), as well as big databases and artificial intelligence platforms.
[0045] It should be noted that a Kubernetes cluster may include a single node, that is, it is composed of a single node, or may include multiple nodes, that is, it is composed of multiple nodes. When a Kubernetes cluster includes multiple nodes, each physical server or virtual machine may correspond to a node, each node is configured with a unique IP address, and each node can communicate with each other based on the IP address.
[0046] Furthermore, each node can also include one or more PODs, each of which is configured with a unique IP address, so that different PODs can communicate through the CNI plug-in regardless of whether they are located on the same node. That is, different PODs on the same node or different PODs across nodes can communicate directly through the CNI plug-in, where POD is the smallest deployment unit in the Kubernetes cluster, and a POD can contain one or more containers.
[0047] In some possible implementations, the node may also include a Felix component, which is responsible for maintaining network policies and routing rules. The Felix component can add or delete corresponding routing rules based on the creation, deletion, and update of PODs. Felix also configures iptables rules based on network policies, and these iptables rules can control the flow of data packets.
[0048] Felix components can also include a routing table, which is used to store information about the path to a specific network destination. The routing table contains a series of routing entries, each of which specifies how a data packet is routed from a source address to a destination.
[0049] In some possible implementations, the Node may also include the BGP Internet routing daemon BIRD, which is used to transmit routing information between routers, listen to the routing information injected by Felix on the Linux Host, and then broadcast it to other Linux Host nodes through the BGP protocol, thereby achieving network interoperability.
[0050] In some possible implementations, Figure 1 The Kubernetes cluster shown may also include a Typha interface 103. Typha, as a proxy, can communicate with the Felix node on each node, thereby synchronizing information such as storage network resources and network policies in the API server to the Felix on each node. It can also be used to pass BGP routing information to BIRD.
[0051] exist Figure 1 In the cluster of the architecture shown, when the cluster size is too large, the cluster may require more CPU resources due to some reasons.
[0052] For example, one of the reasons why the cluster needs to occupy more CPU resources may be that when a network resource (such as a Node, PDO or Service) is restarted or newly enabled, on the one hand, the address of each network resource and the corresponding network policy and routing information need to be updated in the Calico datastore database of the API server, and the API server will also synchronize the updated address of the network resource to the Felix component of each Node in the cluster. On the other hand, when the network resource is restarted or newly enabled, the routing information carried by the network resource itself will also be reconfigured, and then the network resource will be broadcast to other Nodes in the cluster through the BGP protocol to achieve communication. When the cluster is large, that is, when the number of network resources such as Node, PDO or Service is large, there may be a large number of network resource addresses, network policies and routing information that need to be synchronized, that is, a large amount of data needs to be synchronized and broadcasted. Large amounts of data synchronization and data broadcasting may require more CPU resources. As the CPU resources occupied increase, it will bring huge challenges to the load and performance of the entire cluster, which may cause network disconnection between certain Nodes, PODs, or Services, that is, they cannot communicate. Therefore, how to judge the communication status between network resources is a technical problem that needs to be solved urgently in this field.
[0053] In view of this, a cluster network communication detection method is provided in an embodiment of the present application, including: the type of network resources to be detected can be configured according to the received configuration instructions, for example, one or more of the POD network resource information to be detected (i.e., detecting the address of the POD network), the Node network resource information to be detected (i.e., detecting the address of the Node network), and the Service network resource information to be detected (i.e., detecting the address of the Service network), and then the computing device can obtain the IP address information of the corresponding network resource according to the configured type of network resource to be detected, and then send a network detection message to the obtained IP address. For example, taking the detection of POD network resources as an example, the IP addresses corresponding to the 5000 started PODs are obtained, and then the computing device can send a network detection message every preset time. Suppose that a network detection message is sent to each IP address information at a certain time, and then based on the network detection message sent to the IP address, determine whether the network resource corresponding to the IP address can communicate. That is, after the computing device sends a network detection message to the IP address, it can determine whether the network resource corresponding to the IP address returns a response message. If it is determined that the network resource does not return a response message or the delay in receiving the response message is greater than or equal to the delay threshold, the network resource corresponding to the IP address may not have received the network detection message, and it can be determined that the network resource cannot communicate. If it is determined that the network resource returns a response message within the delay threshold, it means that the network resource corresponding to the IP address can receive the network detection message and can communicate normally. In this way, the communication status between the started network resources can be determined.
[0054] The following is a detailed introduction to the network communication detection method for the cluster provided in the embodiment of the present application. Before introducing the method, the framework of the network communication detection system for the cluster provided in the present application can be introduced first. The cluster here is introduced by taking the Kubernetes cluster as an example. Figure 2 As shown, including:
[0055] API server 200, network detector Net Detector 210 and node Node 220;
[0056] The network detector Net Detector210 is used to configure the type of network resources to be detected, and obtain the network resource information of the corresponding k8s cluster from the API server according to the configured type of network resources to be detected. For example, if the configured type of network resources to be detected is POD network resource information, the network detector can obtain the recorded POD IP address information from the API server. For another example, if the configured type of network resources to be detected is Node network resource information, the network detector can obtain the recorded Node IP address information from the API server.
[0057] In some possible implementations, the network detector can also configure the type of network resources to be detected as multiple network resources (also called network resources to be detected), that is, it can detect the communication conditions of multiple network resources at the same time. For example, the network resources include Node, POD and Service.
[0058] For example, if the types of network resources to be detected are configured as POD network resource information and Node network resource information, the network detector can obtain the recorded Node IP address information and POD network resource information from the API server.
[0059] The network detector 210 is also used to send a detection message to each acquired IP address after acquiring the network resource information, and record the response delay, so as to determine whether the IP address is a valid address.
[0060] Specifically, the network detector 210 may include: a configuration server 2001 , a controller 2002 , a network detection timer 2003 , and an exporter 2004 .
[0061] Specifically, the configuration server config server2001 can be a hypertext transfer protocol server httpserver, which is used to provide relevant configuration interfaces to configure the type of network resources to be detected. For example, the type of network resources to be detected can be one of POD network resource information (i.e., detecting the address of the POD network), Node network resource information (i.e., detecting the address of the Node network), and detecting Service network resource information (i.e., detecting the address of the Service network), wherein Service provides a unified access interface and a fixed IP address (ClusterIP) for a group of Pods with the same functions.
[0062] The controller 2002 is used to obtain corresponding network resource information from the API server according to the type of the configured network resource to be detected.
[0063] When the type of network resource to be detected is POD network resource information, the controller can be a POD controller, and the POD controller can be used to obtain the recorded POD IP address information from the API server. In addition, the POD controller can also be used to create, start, update or delete POD and detect the status of each POD. For example, the status of the POD here can include an available state (also called a running state) and an unavailable state, wherein the unavailable state can include a non-running state (also called a not running state, which means that the network resource is not running normally) and other states (the other states here can be, for example, a succeeded state and a failed state, etc.).
[0064] The succeeded state means that the task in the network resource has been completed and terminated, and will not be restarted if no restart command is received. The failed state means that the network resource has terminated due to some error.
[0065] When the type of network resource to be detected is Node network resource information, the controller may be a Node controller, which may be used to obtain the recorded Node IP address information from the API server. In addition, the Node controller may also be used to create, start, update or delete Nodes and detect the status of each Node.
[0066] When the type of network resource to be detected is to detect Service network resource information, the controller can be a Service controller, which can be used to obtain the recorded Service IP address information from the API server. In addition, the Service controller can also be used to create, start, update or delete Services and detect the status of each Service.
[0067] The network detection timer 2003 is used to send detection messages to the acquired IP address at regular intervals. For example, if the controller is a POD controller, and the POD controller obtains the recorded POD IP address information from the API server, the network detection timer 2003 can send detection messages to the acquired POD IP address at regular intervals (for example, every 5 seconds) to detect whether the IP address is available. In addition, the network detector 2103 can also be used to record network delay information to evaluate the network delay.
[0068] Exporter 2004 is used to transmit the acquired IP addresses, network delay information and the communication status of the network resources corresponding to each detected IP address to Prometheus in the form of storage indicators at regular intervals to achieve visualization for relevant personnel to view. Among them, Prometheus can be used to record real-time time series data.
[0069] For ease of understanding, the following is an exemplary introduction to the network communication detection method of the cluster provided by the embodiment of the present application in conjunction with the accompanying drawings, which may be referred to as Embodiment 1. In Embodiment 1, network detection software may be deployed in the network detection container of the computing device. When the network detection software is running, the method of this embodiment may be specifically as follows: Figure 3 As shown, including:
[0070] S31: Configure the type of network resources to be detected.
[0071] The computing device may be configured with the type of network resources to be detected.
[0072] Exemplarily, the configuration server in the computing device network detector can receive configuration instructions input by the user, and configure the type of network resources to be detected according to the configuration instructions, wherein the configured type of network resources to be detected can be one or more of POD network resource information (i.e., detecting the IP address of the POD network), Node network resource information (i.e., detecting the IP address of the Node network), and Service network resource information (i.e., detecting the IP address of the Service network).
[0073] S32: Acquire IP address information of the network resource according to the configured type of the network resource to be detected.
[0074] The computing device can obtain the IP address information of each network resource carrying a detection tag (the network resource here can be called the network resource to be detected) from the data structure storing the IP addresses of the network resources of the API server according to the type of the configured network to be detected, wherein the network resource carrying the detection tag can indicate that the network resource is a newly started network resource or a network resource related to the target business. The network resource carrying the detection tag is the network resource that needs to be detected. For example, taking POD as an example, the data structure stores the IP addresses of 5,000 PODs, of which 500 PODs carry detection tags, and the IP address information of these 500 PODs can be obtained.
[0075] Exemplarily, the computing device may start a detection tag for a corresponding network resource configuration according to the configured type of the network resource to be detected.
[0076] First, the controller in the computing device can start the corresponding network resource according to the type of the configured network resource to be detected through the API server.
[0077] When the type of the configured network resource to be detected is POD network resource information, the POD resource can be started. Starting the POD resource here means creating a POD and assigning an IP address to it.
[0078] When the type of the network resource to be detected is configured as Service network resource information, the Service resource can be started. Starting the Service resource here means to assign an IP address to the Service.
[0079] In some possible implementations, the controller may also determine the number of network resources that need to be started based on the configuration instructions. For example, the type of the network resource to be detected is configured as POD network resource information, and the configuration instructions indicate that 5,000 POD resources need to be started. The controller may start 5,000 POD resources (i.e., create 5,000 PODs and assign a corresponding IP address to each POD) based on the type of the network resource to be detected and the configuration instructions. For another example, the type of the network resource to be detected is configured as Service network resource information, and the configuration instructions indicate that 1,000 Service resources need to be started. The controller may start 1,000 Service resources (i.e., create 1,000 Services and assign a corresponding IP address to each Service) based on the type of the network resource to be detected and the configuration instructions. The configuration instruction may be a kubectl scale command. The kubectl scale command may be used to configure the number of replicas of a Deployment, StatefulSet, or ReplicationController to configure the number of PODs that need to be started. Deployment, StatefulSet, and ReplicationController are three different resource objects that are used to manage the declaration cycle of a POD (i.e., the entire process from the creation to the end of a POD).
[0080] After the network resources are started, the API server may store the IP address of each started network resource in a data structure, and the controller may configure a detection tag for the newly started network resource in the data structure storing the IP addresses of the network resources of the API server.
[0081] In some possible implementations, the computing device may also obtain target business information, and then store the data structure of the network resource IP address in the API server as the corresponding network resource based on the configured type of network resource to be detected and the target business information.
[0082] For example, the type of the configured network resource to be detected is POD network resource information, and the target service information is service A. Then, the data structure storing the network resource IP address in the API server is a POD configuration detection tag related to service A.
[0083] In this way, the computing device can obtain the IP address information of each network resource carrying the detection tag according to the configured type of the network resource to be detected.
[0084] S33: Send a network detection message to the IP address corresponding to the acquired IP address information.
[0085] After obtaining the IP address information of the network resource, the controller of the computing device can start the network detection timer, and the network detection timer can send a network detection message to the IP address information. For example, the controller obtains the IP address information corresponding to each POD among the 5000 started PODs from the API server, and then the network detection timer sends a network detection message to each IP address information at a preset time interval, wherein the preset time can be set by a technician in this field according to needs.
[0086] In some possible implementations, the network resources may undergo some state changes. The controller can update the IP address information of the network resources stored in the data structure according to the state changes of the network resources detected by the API server. It should be noted that here we only focus on the state changes of network resources carrying tags. In some possible implementations, the controller can also determine the target network resource from the network resources carrying the detection tag according to the type of the network resource to be detected.
[0087] Specifically, the computing device can obtain the operating status of each network resource carrying a detection tag according to the type of the network resource to be detected, and then determine the network resource to be detected whose operating status is available as the target network resource, thereby only obtaining the IP address of the target network resource.
[0088] Exemplarily, taking the network resources as POD resources, for example, there are 500 PODs carrying detection tags. Due to insufficient resources (CPU or memory), container crash, or failure of the node where the POD is located, some PODs may fail to start, making the current running state of these PODs unavailable, or the current running state of some PODs may change from an available state to an unavailable state, which indicates that the POD cannot operate normally at this time. Therefore, the controller can determine the network resources with an available running state as the target network resources, thereby only obtaining the IP addresses of the target network resources, so as to send network detection messages to the IP addresses of these target network resources subsequently.
[0089] The controller may also delete the IP address information of the POD from the data structure POD_IP_MAP according to the state change of the detected network resources.
[0090] For another example, the current motion state of a POD is an unavailable state (including a non-running state or other state). Since the POD is restarted successfully, the current motion state of the POD may be changed from an unavailable state to an available state, indicating that the POD can operate normally at this time, so that the controller can determine the POD as a target network resource and update the IP address information of the POD in the data structure.
[0091] The network detection timer can only send a network detection message to the IP address corresponding to the target network resource. In this way, the IP address information of the network detection message can be more accurate and the number of network detection messages sent can be reduced, thereby saving resources.
[0092] In some possible implementations, the network detection timer may use a ping command to send a network detection message to the IP address information of the network resource.
[0093] In some possible implementations, since ping relies on the Internet Control Message Protocol (ICMP), and the Kubernetes network may be configured to not allow ICMP traffic by default, sending a network detection message to the IP address information of the network resource through the ping command may fail. Therefore, the computing device may also send a network detection message to the IP address information of the network resource through TCP or HTTP. Those skilled in the art may set the specific method of sending the network detection message to the IP address information of the network resource according to the network policy or firewall rules, which is not limited here.
[0094] S34: Determine whether the network resources corresponding to the IP address can communicate based on the network detection message sent to the IP address.
[0095] The computing device can determine whether the network resource corresponding to the IP address can communicate based on the network detection message sent to the IP address.
[0096] Exemplarily, after the network detection timer of the computing device sends a network detection message to the IP address, it can determine whether the network resource corresponding to the IP address returns a response message. If it is determined that the network resource does not return a response message, it can be determined that the network resource corresponding to the IP address cannot communicate or the communication is abnormal.
[0097] Furthermore, after the network detection timer sends a network detection message to the IP address, it can record the timestamp of sending the network detection message, and then the network detection timer can calculate the return delay of the response message (also called network delay information) from the time corresponding to the timestamp. When the return delay reaches the delay threshold, the network detection timer still has not received the response message fed back by the network resource, then it can be determined that the network resource has not returned a response message, and the network resource corresponding to the IP address cannot communicate. Exemplarily, taking the example of a network detection timer sending a network detection message to a POD, and the delay threshold being 5ms, the time corresponding to the timestamp of sending the network detection message to the POD is, for example, 21 minutes, 30 seconds and 32 milliseconds. Then, the return delay of the response message can be calculated starting from the time corresponding to the timestamp. When the return delay of the response message reaches the delay threshold of 5ms, that is, when the timestamp pair is 21 minutes, 30 seconds and 37 milliseconds, the network detection timer has not received the response message fed back by the network resource. Then, it can be determined that the POD has not returned a response message, and further, it can be determined that the POD corresponding to the IP address cannot communicate. If the network detection timer receives the response message fed back by the POD within the delay threshold starting from 21 minutes, 30 seconds and 32 milliseconds, it can be determined that the POD returns a response message, and further, it can be determined that the POD corresponding to the IP address can communicate.
[0098] In some possible implementations, after the network detection timer sends a network detection message to the IP address, it can record the timestamp of sending the network detection message and the timestamp of receiving the response message fed back by the network resource. If the time difference between the timestamp of the fed back response message and the timestamp of recording the sending of the network detection message is greater than or equal to the delay threshold, it can also be determined that the network resource has not returned a response message, and the network resource corresponding to the IP address cannot communicate or the communication is abnormal.
[0099] S35: Visually display the detection results.
[0100] The exporter in the computing device can obtain the detection results of the network detection timer (for example, it may include IP address, network delay information, and communication status of network resources corresponding to each IP address, etc.) in the form of storage indicators and transmit them to Prometheus at regular intervals for visualization, so that relevant personnel can view and optimize the cluster network. It should be noted that the visualization display can be in the form of tables, broken lines, bar charts, etc., and technical personnel in this field can set it according to actual needs, which is not limited here.
[0101] For example, the displayed detection result may be that the POD network corresponding to IP address 0001 can communicate, and the network delay information is 3ms. For another example, the displayed detection result may be that the POD network corresponding to IP address 0002 cannot communicate, and the network delay information is 6ms, so that relevant personnel can more intuitively understand the communication status of the network resources in the cluster.
[0102] In some possible implementations, after determining that the target network resource with the corresponding IP address cannot communicate or that the communication is abnormal, the scheduler in the cluster can schedule the network detector from the current computing device (also called the first computing device) to other computing devices (also called the second computing device), and the computing device that obtains the network detector can also execute steps S31-S35 to detect the communication status between the network resources related to the computing device.
[0103] In some possible implementations, a cluster may include multiple computing devices, and a network detection container may be deployed in each computing device to execute steps S31-S35, so that each computing device can detect the communication status between network resources related to the computing device, thereby improving the efficiency of detecting the communication status between network resources in the cluster.
[0104] In this embodiment of the present application, the computing device can configure the type of network resources to be detected according to the received configuration instructions, for example, one or more of the POD network resource information (i.e., detecting the address of the POD network), the Node network resource information (i.e., detecting the address of the Node network), and the Service network resource information (i.e., detecting the address of the Service network), and then the computing device can obtain the IP address of the corresponding network resource according to the configured type of network resource to be detected, and then send a network detection message to the obtained IP address. For example, taking the detection of POD network resources as an example, the IP address information corresponding to the 5000 started PODs is obtained, and then the computing device can send a message to each IP address information at a preset time. The computing device sends a network detection message based on the information, and then determines whether the network resource corresponding to the IP address can communicate based on the network detection message sent to the IP address. That is, after the computing device sends a network detection message to the IP address, it can determine whether the network resource corresponding to the IP address returns a response message. If it is determined that the network resource does not return a response message or the delay in receiving the response message is greater than or equal to the delay threshold, it can be determined that the network resource corresponding to the IP address may not have received the network detection message, and it can be determined that the network resource cannot communicate. If it is determined that the network resource returns a response message within the delay threshold, it means that the network resource corresponding to the IP address can receive the network detection message and can communicate normally. In this way, the communication status between the started network resources can be determined.
[0105] The following is an exemplary introduction to the cluster network communication detection method provided by the present application in the form of interaction between modules in conjunction with the accompanying drawings, which may be referred to as Embodiment 2. The method in Embodiment 2 is executed in a computing device as an example for introduction. Figure 4 As shown, including:
[0106] S41. The configuration server configures the type of network resources to be detected.
[0107] This step is similar to step S31 in implementation and principle, and can be referred to the introduction in embodiment 1, and no redundant description is given here.
[0108] S42. The controller configures a detection tag for a newly started network resource or a network resource corresponding to a target service according to the type of the network resource to be detected.
[0109] This step is similar to step S32 in implementation and principle, and can be referred to the introduction in embodiment 1, and no redundant description is given here.
[0110] S43. When the operation status of the network carrying the detection tag of the API server changes from an unavailable state to an available state, the IP address information of the network resource is updated in the data structure.
[0111] S44. When the API server determines that the operation status of the network carrying the detection tag changes from an available state to an unavailable state, the IP address information of the network resource is deleted from the data structure.
[0112] S45. The controller determines the network resource whose running status is available as the target network resource, and obtains the IP address of the target network resource.
[0113] S46. The network detection timer sends a network detection message to the acquired IP address information.
[0114] S47. The network detection timer determines whether the network resource corresponding to the IP address can communicate based on whether the network detection message sent to the IP address returns a response message and the return delay of the response message.
[0115] The implementation method and principle of step S43 to step S47 are similar to those of step S33 to step S34, and can be referred to the introduction in embodiment 1, so no redundant description is given here.
[0116] S48. The exporter obtains the IP address of the target network resource, network latency information, and the communication status of the network resource corresponding to each IP address for visual display.
[0117] This step is similar to step S35 in implementation and principle, and can be referred to the introduction in embodiment 1, and no redundant description is given here.
[0118] The following is an introduction to the hardware structure of the computing device of this application, see Figure 5 , Figure 5 A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application.
[0119] like Figure 5 As shown, the computing device 1000 includes a processor 1010 and a memory 1020; wherein the memory 1020 stores computer instructions, and the processor 1010 is used to execute the computer instructions, so that the server 1000 executes the cluster network communication detection method shown above.
[0120] In some embodiments, the processor 1010 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.
[0121] In some embodiments, the memory 1020 may be a volatile memory or a non-volatile memory, such as a register. Specifically, a volatile memory refers to a memory in which the data stored inside will be lost when the power supply is interrupted. Among them, the volatile memory is mainly a random access memory (RAM), including a static random access memory (SRAM) and a dynamic random access memory (DRAM). A non-volatile memory refers to a memory in which the data stored inside will not be lost even if the power supply is interrupted. Common non-volatile memories include read-only memory (ROM), optical disks, magnetic disks, solid-state hard disks, and various memory cards based on flash memory technology.
[0122] In some embodiments, the memory 1020 has executable codes, and the memory 1010 executes the codes to implement the search for server models.
[0123] The communication interface 1030 is used for communicating with the outside. For example, the communication interface 1030 is used as a first interface to realize communication with a real device.
[0124] The bus can be a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of understanding, Figure 5 It is represented by only one thick line, but it does not mean that there is only one bus or one type of bus.
[0125] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be a software or program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on a computing device, the computing device is caused to execute the network communication detection method of the above-mentioned cluster. The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc. The computer-readable storage medium includes instructions that instruct the computing device to execute the network communication detection method of the above-mentioned cluster.
[0126] In some possible implementations, the computing device may be a server, which is of course only an example and does not constitute any limitation.
[0127] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.
[0128] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A cluster network communication detection method, characterized in that: The computing device is applied to a cluster, the computing device includes network detection software, and when the network detection software is running, the method includes: Determine the type of network resource to be detected; Determine the IP address of the target network resource according to the type and send a network detection message to each IP address; If it is determined that the response message returned by the target network resource is not received or the delay in receiving the response message is greater than or equal to the delay threshold, it is determined that the communication with the target network resource corresponding to the IP address is abnormal.
2. The method according to claim 1, characterized in that When the type of the object to be detected is POD network resource information and / or Service network resource information, determining the IP address of the target network resource according to the type includes: Acquire, according to the type, the operating status of each network resource to be detected that carries a detection tag, wherein the detection tag indicates that the network resource to be detected is a newly started network resource to be detected or a network resource to be detected related to a target service; Determine the network resource to be detected whose running state is available as the target network resource; Determine the IP address of the target network resource.
3. The method according to claim 1, characterized in that The cluster includes multiple computing devices, and one network detection software is deployed in each computing device.
4. The method according to claim 1, characterized in that: The computing device includes a first computing device and a second computing device, the network detection software is deployed in a network detection container of the first computing device, and after determining that the communication with the target network resource corresponding to the IP address is abnormal, the method further includes: The network probe is dispatched from the first computing device to the second computing device.
5. The method according to claim 2, characterized in that: The method further comprises: The IP address of the network resource to be detected whose running state is unavailable is deleted from the data structure of the cluster, and the data structure is used to store the IP addresses of the network resources in the cluster.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The Prometheus tool is used to display the detection results, which include: the IP address of each target network resource and whether the communication with each target network resource is abnormal.
7. The method according to claim 2, characterized in that Determining the type of the network resource to be detected includes: Get configuration instructions; Determine the type of the network resource to be detected according to the configuration instruction; The obtaining, according to the type, the operating status of each to-be-detected network resource carrying a detection tag includes: According to the number of network resources to be started carried in the configuration instruction, starting the corresponding type and number of network resources to be detected; A detection tag is configured for each of the started network resources to be detected, and the running status of each network resource to be detected carrying the detection tag is obtained according to the type.
8. A cluster network communication detection device, characterized in that: include: An interface configuration module, configured to receive a configuration instruction and determine the type of the network resource to be detected according to the configuration instruction; A controller, configured to determine an IP address of a target network resource according to the type; Network detection timer, used to send network detection messages to each IP address; If it is determined that the response message returned by the target network resource is not received or the delay in receiving the response message is greater than or equal to the delay threshold, it is determined that the communication with the target network resource corresponding to the IP address is abnormal.
9. The device according to claim 8, characterized in that The device also includes: The exporter is used to display the detection results using the Prometheus tool, where the detection results include: the IP address of each target network resource and whether the communication with each target network resource is abnormal.
10. A computing device, characterized in that including memory and processor; The memory is coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the computing device executes the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Monitoring method of Kubernetes component and server
CN114884838A
Kubernetes Pod network error checking system and method
CN116896499A