Cloud platform network connectivity detection method and related device

By creating a new test resource object in the cloud platform and using it to enter the network namespace of the target resource object for diagnosis, the problem of network inspection interfering with normal tasks in the existing technology is solved, and network connectivity detection is achieved without being noticed.

CN121864643APending Publication Date: 2026-04-14ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG DAHUA TECH CO LTD
Filing Date
2026-01-22
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing technologies for network inspection on cloud platforms consume pod resources, affecting the execution of normal tasks and causing serious interference with normal usage scenarios.

Method used

Create a new test resource object in the cloud platform and use it to enter the network namespace of the target resource object. Send network diagnostic commands as the target resource object to avoid executing diagnostic commands directly on the target resource object, thereby reducing the impact on normal tasks.

Benefits of technology

This ensures that the normal task execution of target resource objects is not affected during network inspection, thus guaranteeing the accuracy and efficiency of network connectivity detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121864643A_ABST
    Figure CN121864643A_ABST
Patent Text Reader

Abstract

The invention discloses a cloud platform network connectivity detection method and a related device, the method is applied to a client, and the method comprises the following steps: newly establishing a test resource object and sending a new establishment instruction to each server in a cluster, so that each server also newly establishes the test resource object after receiving the new establishment instruction; after a test resource object in the client is controlled to enter a network namespace of a target resource object in the client, at least sending a network diagnosis instruction to other target resource objects in the client and the target resource object in the server by using the identity of the target resource object; sending a first instruction to a server; and obtaining a network test result fed back by each test resource object in the client and the server. The method can ensure that the target resource object is not influenced in the inspection process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of cloud computing and container cloud technology, and in particular to a method and apparatus for detecting network connectivity of a cloud platform. Background Technology

[0002] During platform operation, network initialization anomalies may occur due to high node load, or unreasonable kernel parameter limitations may cause pods to experience network issues after initialization, even though the network was normal at the initial point in time. Therefore, it is crucial to ensure that platform network inspections can promptly identify and address as many problems as possible.

[0003] However, in existing technologies, when inspecting the network of pods (pods are the smallest scheduling unit in Kubernetes systems (Kubernetes, also known as K8s, is an open-source system used to automatically deploy, scale, and manage containerized applications), it will consume pod resources and affect the execution of normal pod tasks, thus causing serious interference to normal use cases during the inspection process. Summary of the Invention

[0004] This application provides a cloud platform network connectivity detection method and related device, which can ensure that the target resource object is not affected during the inspection process.

[0005] This application provides a cloud platform network connectivity detection method, applied to a client, comprising: creating a new test resource object and sending a creation instruction to each server in the cluster, so that each server also creates the test resource object after receiving the creation instruction; wherein, both the client and the server include at least one existing target resource object; controlling the test resource object in the client to enter the network namespace of the target resource object in the client, and sending network diagnostic instructions to at least other target resource objects in the client and target resource objects in the server as the target resource object; sending a first instruction to the server, so that after receiving the first instruction, the test resource object in the server enters the network namespace of the target resource object in the server, and sends the network diagnostic instructions to at least other servers and target resource objects in the client as the target resource object in the server; and obtaining network test results fed back by each test resource object in the client and the server.

[0006] In one embodiment, before the step of controlling the test resource object in the client to enter the network namespace of the target resource object in the client, and sending network diagnostic instructions to at least other target resource objects in the client and the target resource object in the server as the target resource object, the method further includes: querying the newly created test resource object, controlling the queried test resource object to send network diagnostic instructions to the target resource object; and sending a second instruction to the server, so that after receiving the second instruction, the server queries the newly created test resource object and controls the queried test resource object to send network diagnostic instructions to the target resource object.

[0007] In one embodiment, before the step of sending network diagnostic commands to at least other target resource objects in the client and the target resource object in the server as the target resource object after controlling the test resource object in the client to enter the network namespace of the target resource object in the client, the method further includes: querying the newly created test resource object, controlling the queried test resource object to send network diagnostic commands to other test resource objects; sending a third command to the server, so that after receiving the third command, the server queries the newly created test resource object, controls the queried test resource object to send network diagnostic commands to other test resource objects; and after controlling the test resource object in the client to enter the network namespace of the target resource object in the client, The step of sending network diagnostic instructions to at least other target resource objects in the client and target resource objects in the server as the target resource object also includes: controlling the test resource object in the client to enter the network namespace of the target resource object in the client, and then sending network diagnostic instructions to the test resource object in the server as the target resource object; the step of sending the first instruction to the server also includes: sending a fourth instruction to the server, so that after receiving the fourth instruction, the test resource object in the server enters the network namespace of the target resource object in the server, and sends the network diagnostic instructions to other test resource objects in the server and the client as the target resource object in the server.

[0008] In one embodiment, before the step of sending network diagnostic instructions to at least other target resource objects in the client and the target resource object in the server as the target resource object after controlling the test resource object in the client to enter the network namespace of the target resource object in the client, the method further includes: outputting a warning log in response to the existence of a target node in the cluster; wherein the target node is the server in the cluster that has insufficient resources and / or cannot be scheduled; and the step of sending a first instruction to the server specifically includes: not sending a first instruction to the server in response to the server being the target node; otherwise, sending a first instruction to the server.

[0009] In one embodiment, after the step of creating a new test resource object and sending a creation instruction to each server in the cluster, the method further includes: creating a new test management object in the cluster; wherein the test management object is used to proxy at least one of the test resource objects, and the cluster also has at least one target management object, which is used to proxy at least one of the target resource objects; after controlling the test resource object in the client to enter the network namespace of the target resource object in the client, and sending network diagnostic instructions as the target resource object to at least other target resource objects in the client and the target resource objects in the server, the method further includes: after controlling the test resource object in the client to enter the network namespace of the target resource object in the client, and sending network diagnostic instructions as the target resource object to at least the test management object and the target management object in the cluster.

[0010] In one embodiment, the network diagnostic commands include at least the ping command and the telnet command.

[0011] In one embodiment, the step of controlling the test resource object in the client to enter the network namespace of the target resource object in the client includes: controlling the test resource object in the client to filter the panse process, obtaining the pause process ID of the target resource object in the client, and entering the network namespace of the target resource object in the client through the nsenter instruction.

[0012] In one embodiment, after obtaining the network test results fed back by each of the test resource objects in the client and the server, the method further includes: deleting all the test resource objects.

[0013] A second aspect of this application provides an electronic device including a memory and a processor interconnected, wherein the memory is used to store a computer program, which, when executed by the processor, is used to implement the method as described in any of the above embodiments.

[0014] A third aspect of this application provides a computer-readable storage medium storing a computer program that can be executed by a processor to implement the steps of the method as described in any of the above embodiments.

[0015] Unlike existing technologies, the beneficial effects of this application are as follows: This application creates a new test resource object in the cluster and uses the test resource object to enter the network namespace of the target resource object in the host machine. It sends network diagnostic commands to other target resource objects in the client and the target resource object in the server as the target resource object. Since the target resource object does not directly execute the network diagnostic command, but the test resource object uses the network layer of the host machine to send the network diagnostic command, it will not affect the normal tasks of the target resource object. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein: Figure 1 This is a flowchart illustrating the cloud platform network connectivity detection method of this application; Figure 2 This is a schematic diagram of one implementation of a cluster in the cloud platform network of this application; Figure 3 yes Figure 1 A flowchart illustrating an embodiment prior to step S200; Figure 4 yes Figure 1 A flowchart illustrating another implementation method prior to step S200; Figure 5 This is a flowchart illustrating one embodiment of step S300; Figure 6 This is a schematic diagram of the structure of one embodiment of the electronic device of this application; Figure 7 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0018] It should be noted that the terms "first" and "second" in this application are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0019] See Figure 1 and Figure 2 , Figure 1 This is a flowchart illustrating the cloud platform network connectivity detection method of this application. Figure 2 This is a schematic diagram of one implementation of a cluster in the cloud platform network of this application. The cluster includes a client C and at least one server S. The number of servers S is not limited. There are communication connections between the client C and the server S, and between the server S and other servers S. This application is based on a Kubernetes system solution.

[0020] The first aspect of this application provides a cloud platform network connectivity detection method, which is applied in a client C, and the method includes: S100: Create a new test resource object 101 and send a creation instruction to each server S in the cluster, so that each server S also creates a new test resource object 101 after receiving the creation instruction; wherein, both the client C and the server S include at least one existing target resource object 102.

[0021] Specifically, before the execution of the method in this application, target resource objects 102 already exist in both client C and server S in the cluster. These existing target resource objects 102 can also be referred to as stock target resource objects 102, meaning they do not need to be created before testing. These stock target resource objects 102 are used as business task applications, primarily for executing tasks on client C and server S. The number of target resource objects 102 in client C and each server S is at least one. In this step, client C creates a new test resource object 101. Generally, only one new test resource object 101 needs to be created in client C. Simultaneously, client C sends a creation command to server S in the cluster. Upon receiving the creation command, server S also creates a new test resource object 101. Generally, only one new test resource object 101 needs to be created in each server S. The test resource object 101 is configured to have PID (Process Identifier) ​​privileges, meaning it has permission to access host machine data. The test resource object 101 created in client C can access data on client C, and the test resource object 101 created in server S can access the corresponding data on server S. The target resource object 102 is used to perform regular tasks and does not have permission to access host machine data. That is, the target resource object 102 in client C cannot access the data of client C, and the target resource object 102 in server S cannot access the corresponding data of server S.

[0022] Preferably, in the Kubernetes system, test resource object 101 is the test pod, target resource object 102 is the target pod, and the daemonset (a workload resource that ensures that a pod must run on all or some nodes, and also adds a pod for each node when it joins the cluster) is deployed on the client to deploy the test pod on each node. The client C will create the test pod, and at the same time, the client C issues a creation command, and the server S will create the test pod according to the creation command.

[0023] S200: After the test resource object 101 in the control client C enters the network namespace of the target resource object 102 in the client C, it sends network diagnostic commands to at least other target resource objects 102 in the client C and the target resource object 102 in the server S as the target resource object 102.

[0024] In addition, a first instruction is sent to the server S so that, upon receiving the first instruction, the test resource object 101 in the server S enters the network namespace of the target resource object 102 in the server S, and sends network diagnostic instructions to at least other target resource objects 102.

[0025] Specifically, based on the Linux kernel's isolation mechanism, since test resource object 101 and target resource object 102, located on the same host machine, share the network stack, and according to step S100, test resource object 101 has permission to access host machine data, meaning that test resource object 101 in client C has permission to access all target resource objects 102 in client C, test resource object 101 can enter the network namespace of target resource object 102 in client C (network namespace is a network resource isolation mechanism provided by the Linux kernel, allowing the creation of multiple independent network environments on the same physical machine). Specifically, the network namespace configures all target resource objects 102 on the host machine in independent network environments. Each target resource object 102 has a different network address, network port, and virtual network card, etc., and they are isolated from each other. In network communication, test resource object 101 has a different network configuration than target resource object 102. However, because test resource object 101 has advanced privileges, it can enter the network namespace of target resource object 102. That is, it can access target resource object 102 through a virtual network. Target resource object 102 cannot access test resource object 101. Then, test resource object 101, through the network namespace of target resource object 102, sends network diagnostic commands to target resource objects 102 other than itself, acting as target resource object 102. In the network namespace, test resource object 101 can execute commands to provide network configuration and network connectivity tests for target resource object 102. It can also provide network connectivity tests across different network namespaces for target resource object 102. Although a virtual network is used, the network test is still real. Network diagnostic commands include at least the ping and telnet commands. The ping command is used to verify ICMP (Internet Control Message Protocol), a protocol used to verify whether the network between the test node and the target node is working properly. The telnet command is used to verify whether the TCP (Transmission Control Protocol) port of the target node is connected. Therefore, sending network diagnostic commands to target resource objects 102 other than itself can be understood as test resource object 101 sending a ping command to the IP address of target resource object 102 other than itself using the IP address of target resource object 102, and test resource object 101 sending a telnet command to the IP address and test port of target resource object 102 other than itself using the IP address of target resource object 102.By sending network diagnostic commands to target resource objects 102 other than itself, the verification results of network connectivity between target resource object 102 on client C and other target resource objects 102 can be obtained.

[0026] S300: Send a first instruction to server S, so that after receiving the first instruction, the test resource object 101 in server S enters the network namespace of the target resource object 102 in server S, and sends network diagnostic instructions to the target resource object 102 in other servers S and clients C as the target resource object 102 in server S.

[0027] Specifically, client C sends a first instruction to server S. After receiving the first instruction, server S performs operations similar to those of client C in step S200. Test resource object 101 in server S can enter the network namespace of target resource object 102 in server S. Then, test resource object 101, through the network namespace of target resource object 102, sends network diagnostic instructions to target resource objects 102 other than itself as target resource object 102. It can obtain the verification results of network connectivity between target resource object 102 on server S and other target resource objects 102 on server S, as well as the verification results of network connectivity between target resource object 102 on client C.

[0028] In specific implementation, steps S200 and S300 can be executed simultaneously without any order, or they can be executed in sequence, and the order is not restricted by this application.

[0029] Optionally, after the test resource object 101 in the control client C enters the network namespace of the target resource object 102 in the client C, it sends network diagnostic commands to at least all target resource objects 102 in the client C and the server S except itself, thereby achieving full inspection.

[0030] Optionally, after the test resource object 101 in the control client C enters the network namespace of the target resource object 102 in the client C, it sends network diagnostic commands to at least some of the target resource objects 102 in the client C and the server S, excluding itself, thereby achieving simplified inspection.

[0031] Full inspection is suitable for scenarios where all nodes in the cluster are very important, or where the inspection frequency is relatively low. Simplified inspection is suitable for scenarios where some nodes in the cluster are of high importance, some nodes are of low importance, or where the inspection frequency is relatively high. Both inspection methods can be selected according to the actual situation and can achieve a comprehensive inspection of the target nodes in the cluster.

[0032] In one application scenario, after a test pod in client C enters the network namespace of a target pod in client C, it sends ping commands to at least the other target pods in client C and the target pod in server S as the target pod. Then, it sends telnet commands to at least the other target pods in client C and the target pod in server S. Simultaneously, based on the first command sent by client C, server S controls its test pod to enter the network namespace of the target pod in server S, and then sends ping commands to at least the other target pods in client C and the target pod in server S as the target pod in server S. Then, it sends telnet commands to at least the other target pods in client C and the target pod in server S.

[0033] The above solution differs from existing technologies. By utilizing a newly created test resource object 101 on the host machine, it can access the network namespace of the target resource object 102 within the host machine. Then, acting as the target resource object 102, it sends network diagnostic commands to other target resource objects 102. This network namespace approach differs from directly executing network diagnostic commands on the target resource object 102. Directly executing commands on the target resource object 102 consumes its container resources, affecting its normal task execution. Ultimately, this causes the inspection process to impact all target resource objects 102, significantly hindering the normal operation of the cluster. In this solution, the test resource object 101 can enter the network namespace of the target resource object 102 without actually logging into the target resource object 102. This allows for the detection of network connectivity between the target resource object 102 and other target resource objects 102. Since the network traffic during the detection process passes through the host machine's network layer, the target resource object 102 will not experience any load. This achieves truly seamless detection for the target resource object 102. Although the test resource object 101 is used, it is only used for testing and does not perform other tasks, thus not affecting the execution of normal tasks. The above method can achieve the detection of network connectivity between target resource objects 102 in the cluster.

[0034] In one embodiment, see Figure 3 , Figure 3 yes Figure 1 A flowchart of an embodiment prior to step S200, which further includes the following before step S200: S101: Query the newly created test resource object 101, and control the queried test resource object 101 to send network diagnostic commands to the target resource object 102 in the client C and the server S.

[0035] Specifically, client C queries the IP of the newly created test resource object 101 through the API server (the API server is the core of the cluster and is responsible for communication between various functional modules of the cluster). Then, it passes the command to the test resource object 101 for execution through the exec interface of the API server, so as to send network diagnostic instructions to the target resource object 102 in client C and server S.

[0036] S102: Send a second instruction to the server S, so that after receiving the second instruction, the server S queries the newly created test resource object 101 and controls the queried test resource object 101 to send a network diagnostic instruction to the target resource object 102 in the client C and the server S.

[0037] Specifically, client C sends a second instruction to server S. After receiving the second instruction, server S queries the API server for the newly created test resource object 101. P Then, through the exec interface of the API server, the command is passed to the test resource object 101 for execution, so as to send network diagnostic instructions to the target resource object 102 in the client C and the server S.

[0038] The above two steps are mainly used to detect the network connectivity between the newly created test resource object 101 and the existing target resource object 102. Since the network connectivity detection between target resource objects 102 requires test resource object 101 to enter the network namespace of the corresponding target resource object 102, while the network connectivity detection initiated by test resource object 101 between test resource object 101 and the existing target resource object 102 does not require the network namespace and can be used to identify network problems between test resource object 101 and target resource object 102, the network connectivity detection between test resource object 101 and the existing target resource object 102 is performed before step S200, which can have a certain auxiliary role in the analysis of the network connectivity detection results between target resource objects 102. Since test resource object 101 directly sends the network diagnostic command, the impact on the load of target resource object 102 is small.

[0039] In specific implementation, steps S101 and S102 can be performed simultaneously or sequentially, and the order is not limited in this application.

[0040] Optionally, the newly created test resource object 101 is queried, and the queried test resource object 101 is controlled to send network diagnostic instructions to all target resource objects 102 in the client C and server S; and a second instruction is sent to the server S, so that after receiving the second instruction, the server S queries the newly created test resource object 101, and controls the queried test resource object 101 to send network diagnostic instructions to all target resource objects 102 in the client C and server S.

[0041] Optionally, the newly created test resource object 101 is queried, and the queried test resource object 101 is controlled to send network diagnostic instructions to some target resource objects 102 in the client C and the server S; and a second instruction is sent to the server S, so that after receiving the second instruction, the server S queries the newly created test resource object 101 and controls the queried test resource object 101 to send network diagnostic instructions to some target resource objects 102 in the client C and the server S.

[0042] In one application scenario, a newly created test pod is queried, and the queried test pod is controlled to send a ping command to a target pod in client C and server S. Then, a telnet command is sent to client C and the target pod in server S. Additionally, a second command is sent to server S, so that after receiving the second command, server S queries the newly created test pod, controls the queried test pod to send a ping command to client C and the target pod in server S, and then sends a telnet command to client C and the target pod in server S.

[0043] In one embodiment, see Figure 4 , Figure 4 yes Figure 1 A flowchart illustrating another embodiment prior to step S200, which further includes the following before step S200: S103: Query the newly created test resource object 101, and control the queried test resource object 101 to send network diagnostic commands to the test resource object 101 in the server S.

[0044] Specifically, the IP address of the newly created test resource object 101 is retrieved through the API server, and then the command is passed to the test resource object 101 for execution through the exec interface of the API server, so as to send network diagnostic instructions to the test resource object 101 in the server S.

[0045] S104: Send a third instruction to server S, so that after receiving the third instruction, server S queries the newly created test resource object 101 and controls the queried test resource object 101 to send network diagnostic instructions to test resource objects 101 in other servers S and clients C.

[0046] Specifically, a third instruction is sent to server S. After receiving the third instruction, server S queries the newly created test resource object 101 through the apiserver. P The command is then passed to the test resource object 101 for execution via the exec interface of the API server, in order to send network diagnostic commands to the test resource object 101 in other servers S and clients C.

[0047] The above two steps are mainly used to detect the network connectivity between test resource objects 101. Since the detection of network connectivity between target resource objects 102 requires test resource objects 101 to enter the network namespace of the corresponding target resource object 102, while the detection of network connectivity between test resource objects 101 does not require the network namespace and can be used to identify network problems between test resource objects 101, performing the network connectivity detection between test resource objects 101 before step S200 can have a certain auxiliary effect on the analysis of the network connectivity detection results between target resource objects 102. Since it is a network diagnosis between test resource objects 101, it has no impact on target resource objects 102.

[0048] In specific implementation, steps S103 and S104 can be performed simultaneously or sequentially, and the order is not limited in this application.

[0049] Optionally, the newly created test resource object 101 is queried, and the queried test resource object 101 is controlled to send network diagnostic instructions to all test resource objects 101 in the server S; and a third instruction is sent to the server S, so that after receiving the third instruction, the server S queries the newly created test resource object 101, and controls the queried test resource object 101 to send network diagnostic instructions to the client C and all other test resource objects 101 in the other servers S.

[0050] Optionally, the newly created test resource object 101 is queried, and the queried test resource object 101 is controlled to send network diagnostic commands to some test resource objects 101 in the server S; and a third command is sent to the server S, so that after receiving the third command, the server S queries the newly created test resource object 101, and controls the queried test resource object 101 to send network diagnostic commands to the client C and some test resource objects 101 in other servers S.

[0051] In one application scenario, a newly created test pod is queried, and the queried test pod sends a ping command to a test pod on server S. Then, it sends a telnet command to the test pod on server S. Finally, a third command is sent to server S, so that upon receiving the third command, server S queries the newly created test pod, and controls the queried test pod to send ping commands to client C and other test pods on server S. Then, it sends telnet commands to client C and other test pods on server S.

[0052] In one embodiment, in addition to the above step S200, the method further includes: After the test resource object 101 in the control client C enters the network namespace of the target resource object 102 in the client C, it sends a network diagnostic command to the test resource object 101 in the server S as the target resource object 102.

[0053] Specifically, test resource object 101 in client C has permission to access all target resource objects 102 in client C. Therefore, test resource object 101 can enter the network namespace of target resource object 102 in client C, and then send network diagnostic commands to test resource object 101 on server S as target resource object 102. By sending network diagnostic commands to other test resource objects 101, the verification result of the network connectivity between target resource object 102 on client C and test resource object 101 on server S can be obtained.

[0054] In one embodiment, in addition to the above step S300, the method further includes: Send a fourth instruction to server S so that after receiving the fourth instruction, test resource object 101 in server S enters the network namespace of target resource object 102 in server S, and sends network diagnostic instructions to test resource objects 101 in other servers S and clients C as the target resource object 102 in server S.

[0055] Specifically, client C sends a fourth instruction to server S. After receiving the fourth instruction, server S controls the test resource object 101 in server S to enter the network namespace of target resource object 102 in server S. Then, as the target resource object 102 in server S, it sends network diagnostic instructions to test resource objects 101 in other servers S and client C. It can obtain the verification results of the network connectivity between target resource object 102 on server S and test resource objects 101 on other servers S, as well as the verification results of the network connectivity between target resource object 102 on server S and test resource object 101 on client C.

[0056] The two implementation methods described above are mainly used for detecting network connectivity between target resource object 102 and test resource object 101. Since the detection of network connectivity between target resource objects 102 requires test resource object 101 to enter the network namespace of the corresponding target resource object 102, and the communication initiated by target resource object 102 with test resource object 101 also requires the use of the network namespace, they can be executed synchronously while steps S200 and S300 are being performed. Therefore, this scheme can play a certain auxiliary role in the analysis of the detection results of network connectivity between target resource objects 102. Since the network diagnosis is performed by test resource object 101 entering the network command space of target resource object 102, it does not require direct execution by target resource object 102 and has no impact on target resource object 102.

[0057] In the above implementation methods, multiple schemes can be combined. The more schemes are executed, the more helpful it is for the analysis of anomalies in the later stage. It should be noted that when combining schemes, the instructions sent by the client to the server do not need to be sent in multiple parts. The specific content of the instructions can be sent together in the same instruction, that is, merged into the first instruction and sent together.

[0058] Furthermore, the step S200 above, which involves controlling the test resource object 101 in client C to enter the network namespace of the target resource object 102 in client C, includes: The test resource object 101 in client C filters the pause process, obtains the pause process ID of the target resource object 102 in client C, and enters the network namespace of the target resource object 102 in client C through the nsenter instruction.

[0059] Specifically, the pause container creates a network namespace and implements network stack sharing. The process IDs of both test resource object 101 and target resource object 102 are visible. Test resource object 101 has PID privileges, so the pause process can be filtered to obtain the pause process ID of target resource object 102 in client C. The nsenter instruction can be used to enter the network namespace of target resource object 102 in client C with this process ID. Subsequently, network diagnostic instructions can be executed in the network namespace of target resource object 102.

[0060] Similarly, the step S300 above, where the test resource object 101 in server S enters the network namespace of the target resource object 102 in server S, includes: Server S controls the test resource object 101 in server S to filter the pause process, obtains the pause process ID of the target resource object 102 in server S, and enters the network namespace of the target resource object 102 in server S through the nsenter command. The specific process is similar and will not be described in detail.

[0061] In one embodiment, see Figure 2 After step S100, the method further includes: Create a new test management object 103 in the cluster; wherein, the test management object 103 is used to proxy at least one test resource object 101, and the cluster also has at least one target management object 104, which is used to proxy at least one target resource object 102.

[0062] Specifically, test management object 103, in addition to acting as a proxy for at least one test resource object 101, is also used for load balancing among test resource objects 101 and provides service discovery. When other resource objects communicate with test resource objects 101, they first need to connect to test management object 103, and then find a suitable test resource object 101 through the proxy forwarding of test management object 103. Similarly, target management object 104, in addition to acting as a proxy for at least one target resource object 102, is also used for load balancing among target resource objects 102 and provides service discovery. When other resource objects communicate with target resource objects 102, they first need to connect to target management object 104, and then find a suitable target resource object 102 through the proxy forwarding of target management object 104. The test resource objects 101 proxied by test management object 103 may or may not be on the same node, and the target resource objects 102 proxied by target management object 104 may or may not be on the same node.

[0063] In one application scenario, test resource object 101 includes a test pod, target resource object 102 includes a target pod, test management object 103 includes a test service, and target management object 104 includes a target service.

[0064] Furthermore, following step S200, the following steps are also included: After the test resource object 101 in the control client C enters the network namespace of the target resource object 102 in the client C, it sends network diagnostic commands to at least the test management object 103 and the target management object 104 in the cluster as the target resource object 102.

[0065] Specifically, test resource object 101 in client C has permission to access all target resource objects 102 in client C. Therefore, test resource object 101 can enter the network namespace of target resource object 102 in client C, and then send network diagnostic commands to test management object 103 and target management object 104 in the cluster as target resource object 102. By sending network diagnostic commands to test management object 103 and target management object 104 in the cluster, the verification results of network connectivity between target resource object 102 on client C and test management object 103 and target management object 104 in the cluster can be obtained. The above process is mainly used to detect the network connectivity between the target resource object 102 on client C and the test management object 103 and target management object 104 in the cluster. This detection ensures that the target resource object 102 can find the corresponding test resource object 101 through the test management object 103, and find the corresponding target resource object 102 through the target management object 104. In particular, finding the corresponding target resource object 102 through the target management object 104 reduces the difficulty for the target resource object 102 to find other target resource objects 102. At the same time, since the network diagnosis is performed by the test resource object 101 entering the network command space of the target resource object 102, it does not need to be directly executed by the target resource object 102 and has no impact on the target resource object 102.

[0066] Optionally, after the test resource object 101 in the control client C enters the network namespace of the target resource object 102 in the client C, it sends network diagnostic commands to at least all test management objects 103 and target management objects 104 in the cluster as the target resource object 102.

[0067] Optionally, after the test resource object 101 in the control client C enters the network namespace of the target resource object 102 in the client C, it sends network diagnostic commands to at least some test management objects 103 and target management objects 104 in the cluster as the target resource object 102.

[0068] In one application scenario, after the test pod in client C enters the network namespace of the target pod in client C, it sends network diagnostic commands to at least the test service and the target service in the cluster as the identity of the target resource object 102.

[0069] Furthermore, following step S300 above, the following is also included: Send a fifth instruction to server S so that server S controls test resource object 101 in server S to enter the network namespace of target resource object 102 in server S, and then sends network diagnostic instructions to at least test management object 103 and target management object 104 in the cluster as target resource object 102.

[0070] Specifically, test resource object 101 in server S has permission to access all target resource objects 102 in server S. Therefore, test resource object 101 can enter the network namespace of target resource object 102 in server S, and then send network diagnostic commands to test management object 103 and target management object 104 in the cluster as target resource object 102. By sending network diagnostic commands to test management object 103 and target management object 104 in the cluster, the verification results of network connectivity between target resource object 102 on server S and test management object 103 and target management object 104 in the cluster can be obtained. The above process is mainly used to detect the network connectivity between the target resource object 102 on server S and the test management object 103 and target management object 104 in the cluster. This detection ensures that the target resource object 102 can find the corresponding test resource object 101 through the test management object 103, and find the corresponding target resource object 102 through the target management object 104. In particular, finding the corresponding target resource object 102 through the target management object 104 reduces the difficulty for the target resource object 102 to find other target resource objects 102. At the same time, since the network diagnosis is performed by the test resource object 101 entering the network command space of the target resource object 102, it does not need to be directly executed by the target resource object 102, and has no impact on the target resource object 102.

[0071] Optionally, after the test resource object 101 in the server S enters the network namespace of the target resource object 102 in the server S, it sends network diagnostic commands to at least all test management objects 103 and target management objects 104 in the cluster as the target resource object 102.

[0072] Optionally, after the test resource object 101 in the server S enters the network namespace of the target resource object 102 in the server S, it sends network diagnostic commands to at least some test management objects 103 and target management objects 104 in the cluster in the identity of the target resource object 102.

[0073] In one application scenario, after the test pod in server S enters the network namespace of the target pod in server S, it sends network diagnostic commands to at least the test service and the target service in the cluster as the identity of the target resource object 102.

[0074] Furthermore, prior to step S200, the following steps are also included: The system queries the newly created test resource object 101 and controls it to send network diagnostic commands to the test management object 103 and the target management object 104 in the cluster. Additionally, a sixth command is sent to client C to enable server S to query the newly created test resource object 101 and control it to send network diagnostic commands to the test management object 103 and the target management object 104 in the cluster. The specific process described above can be found in similar implementations described earlier and will not be repeated here.

[0075] In one embodiment, prior to step S200, the method further includes: In response to the presence of a target node in the cluster, a warning log is output; where the target node is the server S in the cluster that has insufficient resources and / or cannot be scheduled.

[0076] Specifically, the server S has insufficient resources and cannot be scheduled, indicating that the server S is temporarily or permanently unable to execute tasks or tests. Therefore, a warning log is output to provide a notification instead of stopping directly. This is mainly to avoid some abnormal nodes affecting the overall inspection in the cluster.

[0077] Further reading Figure 5 , Figure 5 This is a flowchart illustrating one embodiment of step S300. The step of sending the first instruction to the server S in step S300 specifically includes: S210: In response that server S is the target node, do not send the first instruction to server S.

[0078] Specifically, if the target node is an abnormal node, and the server S is an abnormal node, then the server S is ignored, and the client C does not need to send the first instruction to the corresponding server S, that is, it does not need to perform network diagnostics.

[0079] S220: Otherwise, send the first instruction to the server S.

[0080] Specifically, if the target node is an abnormal node, and the server S is not an abnormal node, the client C needs to send the first instruction to the corresponding server S, that is, to perform network diagnostics.

[0081] S400: Obtain the network test results fed back by each test resource object 101 in the client C and the server S.

[0082] Specifically, client C summarizes and outputs the network diagnostic results performed by each test resource object 101 in client C and server S in the steps of the different implementation methods described above. The displayed results can be the verification results corresponding to the initiating and receiving points of the network diagnostic commands. Optionally, results with anomalies can be displayed, while results without anomalies can be hidden. Optionally, all results can be displayed, with anomalies displayed first. From the output results, anomalies can be identified based on which nodes are abnormal and their patterns can be analyzed. For example, if there are anomalies in cross-network segment access or in specific nodes, further investigation and analysis can be conducted at the node level, focusing on component and physical link anomalies.

[0083] In one embodiment, after step S400, the following is included: Delete all test resource objects 101.

[0084] Specifically, test resource object 101 is only used for temporary testing. After the network inspection is completed, it can be deleted to free up storage space.

[0085] In another embodiment, after step S400, the following is included: Retain all test resource objects 101.

[0086] Specifically, although test resource object 101 is only used for temporary testing, if the inspection frequency is high, test resource object 101 can be retained for future use, and there is no need to create a new test resource object 101 when it is used next time.

[0087] See Figure 6 , Figure 6 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device 300 includes a processor 310 and a memory 320. The processor 310 is coupled to the memory 320. The memory 320 stores program data. The processor 310 executes the program data in the memory 320 to implement the steps in any of the above embodiments. The detailed steps can be found in the above embodiments and will not be repeated here.

[0088] Among them, electronic device 300 can be any device with algorithm capabilities, such as mobile phone, tablet computer, smartwatch, desktop computer or laptop computer, without any restrictions.

[0089] See Figure 7 , Figure 7 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. The computer-readable storage medium 400 stores a computer program 410, which can be executed by a processor to implement the steps in any of the above methods. Detailed method steps can be found in the relevant content above, and will not be repeated here.

[0090] Specifically, the computer-readable storage medium 400 can be a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or a device that can store the computer program 410. Alternatively, it can be a server that stores the computer program 410, which can send the stored computer program 410 to other devices for execution, or it can run the stored computer program 410 itself.

[0091] This application also provides a detection device, which includes a new module, a diagnostic module, and an acquisition module that are interconnected.

[0092] The creation module is used to create test resource objects and send creation instructions to each server in the cluster, so that each server will also create test resource objects after receiving the creation instructions; wherein, both the client and the server include at least one existing target resource object.

[0093] The diagnostic module is used to control the test resource object in the client to enter the network namespace of the target resource object in the client, and then send network diagnostic commands to at least other target resource objects in the client and the target resource object in the server as the target resource object.

[0094] The sending module is used to send a first instruction to the server so that after receiving the first instruction, the test resource object in the server enters the network namespace of the target resource object in the server, and sends network diagnostic instructions to at least the target resource objects in other servers and clients in the identity of the target resource object in the server.

[0095] The acquisition module is used to acquire the network test results fed back by each test resource object in the client and the server.

[0096] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A method for detecting network connectivity on a cloud platform, characterized in that, The method is applied to the client and includes: A new test resource object is created and a creation instruction is sent to each server in the cluster, so that each server also creates the test resource object after receiving the creation instruction; wherein, both the client and the server include at least one existing target resource object; After the test resource object in the client enters the network namespace of the target resource object in the client, it sends network diagnostic commands to at least other target resource objects in the client and the target resource object in the server in the identity of the target resource object; Send a first instruction to the server so that after receiving the first instruction, the test resource object in the server enters the network namespace of the target resource object in the server, and sends the network diagnostic instruction to at least the target resource objects in other servers and the client as the target resource object in the server. Obtain the network test results fed back by each of the test resource objects in the client and the server.

2. The method according to claim 1, characterized in that, Before the step of controlling the test resource object in the client to enter the network namespace of the target resource object in the client, and sending network diagnostic commands as the target resource object to at least other target resource objects in the client and the target resource object in the server, the method further includes: The newly created test resource object is queried, and the queried test resource object is controlled to send network diagnostic commands to the target resource object in the client and the server. A second instruction is sent to the server, so that after receiving the second instruction, the server queries the newly created test resource object and controls the queried test resource object to send network diagnostic instructions to the target resource object in the client and the server.

3. The method according to claim 1, characterized in that, Before the step of sending network diagnostic commands, in the capacity of the target resource object in the client, to at least other target resource objects in the client and the target resource object in the server after controlling the test resource object in the client to enter the network namespace of the target resource object in the client, the method further includes: Query the newly created test resource object, and control the queried test resource object to send network diagnostic commands to the test resource object in the server; Send a third instruction to the server so that after receiving the third instruction, the server queries the newly created test resource object and controls the queried test resource object to send network diagnostic instructions to the test resource objects in other servers and clients; In addition to the step of controlling the test resource object in the client to enter the network namespace of the target resource object in the client, and sending network diagnostic commands as the target resource object to at least other target resource objects in the client and the target resource object in the server, the method also includes: After the test resource object in the client enters the network namespace of the target resource object in the client, it sends a network diagnostic command to the test resource object in the server in the identity of the target resource object. The step of sending the first instruction to the server includes: A fourth instruction is sent to the server so that, upon receiving the fourth instruction, the test resource object in the server enters the network namespace of the target resource object in the server, and sends the network diagnostic instruction to the test resource objects in other servers and clients as the target resource object in the server.

4. The method according to claim 1, characterized in that, Before the step of sending network diagnostic commands, in the capacity of the target resource object in the client, to at least other target resource objects in the client and the target resource object in the server after controlling the test resource object in the client to enter the network namespace of the target resource object in the client, the method further includes: In response to the presence of a target node in the cluster, a warning log is output; wherein, the target node is the server in the cluster that has insufficient resources and / or is unschedulable; Furthermore, the step of sending the first instruction to the server specifically includes: In response that the server is the target node, no first instruction is sent to the server; Otherwise, send the first instruction to the server.

5. The method according to claim 1, characterized in that, After the step of creating a new test resource object and sending the creation command to each server in the cluster, the method further includes: A new test management object is created in the cluster; wherein the test management object is used to proxy at least one of the test resource objects, and the cluster also has at least one target management object, which is used to proxy at least one of the target resource objects; After controlling the test resource object in the client to enter the network namespace of the target resource object in the client, and sending network diagnostic commands as the target resource object to at least other target resource objects in the client and the target resource object in the server, the method further includes: After the test resource object in the client enters the network namespace of the target resource object in the client, it sends network diagnostic commands to at least the test management object and the target management object in the cluster in the identity of the target resource object.

6. The method according to claim 1, characterized in that, The network diagnostic commands include at least the ping command and the telnet command.

7. The method according to claim 1, characterized in that, The step of controlling the test resource object in the client to enter the network namespace of the target resource object in the client includes: Control the test resource object filtering process in the client to obtain the pause process ID of the target resource object in the client, and enter the network namespace of the target resource object in the client through the nsenter command.

8. The method according to claim 1, characterized in that, After obtaining the network test results returned by each of the test resource objects in the client and the server, the method further includes: Delete all the test resource objects mentioned above.

9. An electronic device, characterized in that, The system includes an interconnected memory and a processor, wherein the memory is used to store a computer program, which, when executed by the processor, is used to implement the method as described in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed by a processor to implement the steps of the method as described in any one of claims 1-8.