Communication method and device based on container cluster, equipment and storage medium

By deploying work nodes of container group units in container clusters and establishing VXLAN tunnels, nodes outside the cluster can access container group units in the cluster, solving the problems of high cost and complex management in the existing technology, and achieving low-cost and simplified management access methods.

CN119603101APending Publication Date: 2025-03-11TRANSWARP TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411763142.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The prior art is costly and complex in implementing the access of cluster content group units from outside the container cluster.

Method used

By deploying the work node of the container group unit in the container cluster, a VXLAN tunnel in which the first endpoint device in the work node communicates with the second endpoint device in the outside cluster node does not need to rely on additional hardware configuration and actual communication address division.

Benefits of technology

Reduces the cost of out-of-cluster nodes accessing cluster content group units and simplifies the management process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119603101A_ABST
    Figure CN119603101A_ABST
Patent Text Reader

Abstract

The invention discloses a communication method and device based on a container cluster, equipment and a storage medium. The method is applied to a working node in a container cluster, and comprises the following steps: creating and starting a first endpoint device for VXLAN communication based on user datagram protocol port information, a network identifier of a virtual extensible local area network (VXLAN) and a node address of the working node; creating a network resource of the working node in the main node of the container cluster based on the container group unit adaptive network segment of the working node, the device address of the first endpoint device, the physical address of the first endpoint device and the node address of the working node; detecting a network resource creation event of a cluster external node in combination with the main node, and determining a network resource of the cluster external node; and according to the network resource of the cluster external node, establishing a VXLAN tunnel for communication between the first endpoint device and a second endpoint device in the cluster external node, so that the cluster external node accesses the container group unit through the VXLAN tunnel. And the cost of accessing the cluster inner container group unit by the cluster outer node is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of communication technology, and in particular, to a communication method, apparatus, device, and storage medium based on a container cluster. Background Art

[0002] Kubernetes can be understood as a container orchestration and management platform. In the Kubernetes environment, a container cluster can be deployed. Each container group unit (i.e., Pod) deployed by the nodes in the container cluster can correspond to a virtual Pod Internet Protocol address (Pod Internet Protocol, PodIP). PodIP can be used for communication within the cluster, but cannot be directly accessed outside the cluster.

[0003] In the prior art, the PodIP can be announced to the routing outside the cluster through the Border Gateway Protocol (BGP), so that the nodes outside the cluster can directly access the PodIP, but this method requires the support of hardware routing equipment and the opening of the BGP function; the actual communication address can also be directly assigned to the Pod so that the nodes outside the cluster can directly access the Pod, but this method requires a large number of actual communication addresses to support it. Both of the above methods can realize the access of nodes outside the cluster to the Pod, but the corresponding on-site implementation cost and management cost are high. Summary of the invention

[0004] The present invention provides a communication method, apparatus, device and storage medium based on a container cluster, which can reduce the cost of nodes outside the cluster accessing container group units within the cluster.

[0005] In a first aspect, an embodiment of the present invention provides a communication method based on a container cluster, which is applied to a working node where a container group unit is deployed in a container cluster. The method includes:

[0006] Based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the working node, create and start a first endpoint device for VXLAN communication;

[0007] Creating a network resource of the working node in the master node of the container cluster based on the container group unit adaptation network segment of the working node, the device address of the first endpoint device, the physical address of the first endpoint device, and the node address of the working node;

[0008] In conjunction with the master node detecting a network resource creation event of a node outside the cluster, determining the network resource of the node outside the cluster;

[0009] According to the network resources of the node outside the cluster, a VXLAN tunnel is established for the first endpoint device to communicate with the second endpoint device in the node outside the cluster, so that the node outside the cluster accesses the container group unit through the VXLAN tunnel.

[0010] In a second aspect, an embodiment of the present invention provides a communication method based on a container cluster, which is applied to an out-of-cluster node outside the container cluster. The method includes:

[0011] Based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the node outside the cluster, create and start a second endpoint device for VXLAN communication;

[0012] Creating a network resource of the node outside the cluster in the master node of the container cluster based on the container group unit adaptation network segment of the node outside the cluster, the device address of the second endpoint device, the physical address of the second endpoint device, and the node address of the node outside the cluster;

[0013] Acquire network resources of working nodes in the container cluster in conjunction with the master node;

[0014] According to the network resources of the working node, a VXLAN tunnel is established for the second endpoint device to communicate with the first endpoint device in the working node, so that the node outside the cluster accesses the container group unit of the working node through the VXLAN tunnel.

[0015] In a third aspect, an embodiment of the present invention provides a communication device based on a container cluster, which is configured on a working node where a container group unit is deployed in the container cluster, and the device includes:

[0016] A first creation module is used to create and start a first endpoint device for VXLAN communication based on user datagram protocol port information, a network identifier of a virtual extensible local area network VXLAN, and a node address of the working node;

[0017] A second creation module is used to create network resources of the working node in the master node of the container cluster based on the container group unit adaptation network segment of the working node, the device address of the first endpoint device, the physical address of the first endpoint device and the node address of the working node;

[0018] A determination module, configured to detect a network resource creation event of an out-cluster node in conjunction with the master node, and determine the network resources of the out-cluster node;

[0019] The first communication module is used to establish a VXLAN tunnel for communication between the first endpoint device and a second endpoint device in the node outside the cluster according to the network resources of the node outside the cluster, so that the node outside the cluster accesses the container group unit through the VXLAN tunnel.

[0020] In a fourth aspect, an embodiment of the present invention provides a communication device based on a container cluster, which is configured at an external node outside the container cluster, and the device includes:

[0021] A third creation module is used to create and start a second endpoint device for VXLAN communication based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the node outside the cluster;

[0022] a fourth creation module, configured to create, in the master node of the container cluster, a network resource of the node outside the cluster based on the container group unit adaptation network segment of the node outside the cluster, the device address of the second endpoint device, the physical address of the second endpoint device, and the node address of the node outside the cluster;

[0023] An acquisition module, used to acquire network resources of working nodes in the container cluster in conjunction with the master node;

[0024] The second communication module is used to establish a VXLAN tunnel for communication between the second endpoint device and the first endpoint device in the working node according to the network resources of the working node, so that the node outside the cluster can access the container group unit of the working node through the VXLAN tunnel.

[0025] In a fifth aspect, an embodiment of the present invention provides an electronic device, including:

[0026] at least one processor; and

[0027] a memory communicatively connected to the at least one processor; wherein,

[0028] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the method as described in the first aspect, or execute the method as described in the second aspect.

[0029] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect, or implements the method described in the second aspect.

[0030] The technical solution of the embodiment of the present invention is to establish a VXLAN tunnel for communication between a first endpoint device in the working node and a second endpoint device in a node outside the cluster by deploying a working node of a container group unit in a container cluster. Without relying on additional hardware configuration and actual communication address division, the node outside the cluster can access the container group unit in the cluster through the VXLAN tunnel, thereby reducing the cost of the node outside the cluster accessing the container group unit in the cluster.

[0031] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 is a flow chart of a communication method based on a container cluster provided according to Embodiment 1 of the present invention;

[0034] Figure 2 This is a schematic diagram of communication between a container cluster and a node outside the cluster provided according to Embodiment 1 of the present invention;

[0035] Figure 3 is a flow chart of a communication method based on a container cluster provided according to Embodiment 2 of the present invention;

[0036] Figure 4 It is a structural diagram of a communication device based on a container cluster provided according to Embodiment 3 of the present invention;

[0037] Figure 5 It is a structural diagram of a communication device based on a container cluster provided according to Embodiment 4 of the present invention;

[0038] Figure 6 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0040] It should be noted that the terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0041] Embodiment 1

[0042] Figure 1 This is a flow chart of a communication method based on a container cluster provided according to the first embodiment of the present invention. This embodiment can be applied to the case where a VXLAN tunnel is established through a working node in which a container group unit is deployed in a container cluster so that a node outside the cluster can access the container group unit in the working node through the VXLAN tunnel. The method can be executed by a communication device based on a container cluster, which can be implemented in the form of software and / or hardware and integrated in an electronic device serving as a working node. Furthermore, the electronic device includes but is not limited to: a computer, a laptop, etc.

[0043] Figure 2 FIG. 1 is a schematic diagram of a container cluster communicating with nodes outside the cluster according to Embodiment 1 of the present invention. Figure 2 As shown, the container cluster is connected to the nodes outside the cluster.

[0044] Among them, the container cluster can be a cluster deployed in the Kubernetes environment. Kubernetes, referred to as K8s, is an open source container orchestration platform for automating the deployment, expansion and management of containerized applications. The main goal of Kubernetes can be to help developers and system administrators more easily deploy applications, expand services, and manage containers across host clusters.

[0045] A container cluster can include worker nodes and master nodes, and the number of worker nodes and master nodes can be one or more. Among them, the master node can be the node in the container cluster responsible for managing the state and configuration of the cluster. The worker node can be the node in the container cluster responsible for running the actual instance of the application. The worker node can be deployed with a container group unit, namely a Pod, which can be the smallest deployable unit in Kubernetes. A Pod can contain one or more containers, which share storage and network.

[0046] The node outside the cluster may be a node located outside the container cluster and communicating with the container cluster. Optionally, the node outside the cluster may be a node in another K8s cluster other than the container cluster of the embodiment of the present invention, or may be a separate node, which is not limited here.

[0047] Combination Figure 2 The architecture shown is Figure 1 The method shown is described as follows: Figure 1 As shown, the method includes:

[0048] S110. Create and start a first endpoint device for VXLAN communication based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the working node.

[0049] Among them, Virtual Extensible LAN (VXLAN) can be understood as a network virtualization technology that allows the creation of a virtual Layer 2 network on an existing Internet Protocol (IP) network, thereby transcending physical limitations and achieving large-scale network isolation and expansion. VXLAN can embed the Layer 2 Media Access Control (MAC) frame into the User Data Protocol (UDP), encapsulate it on the Layer 3 IP network for transmission, and thus achieve virtual network communication across physical network boundaries.

[0050] The user datagram protocol port information may be information indicating a port required for UDP communication, such as indicating that the port number required for UDP communication is 4096, which is not limited here.

[0051] The VXLAN Network Identifier (VNI) can be a 24-bit number used to distinguish different VXLAN networks, and can theoretically support up to 16M (2^24) isolated VXLAN networks. Optionally, the VNI can be set to 1000, which is not limited here.

[0052] The node address of the working node can be the IP address of the working node, which is not limited here.

[0053] The first endpoint device can be a device created in a working node and adapted to the starting point or end point of a VXLAN tunnel, specifically a VXLAN Tunnel End Point (VTEP) device, which is responsible for encapsulating and decapsulating VXLAN packets and supports Linux and Windows environments. Among them, a VXLAN tunnel can be a second-layer logical channel established on a three-layer network based on VXLAN technology, enabling devices originally in different physical locations to communicate with each other in the same logical network.

[0054] In this step, you can create and start the first endpoint device on the working node, configure the first endpoint device to use the port required for UDP communication indicated by the User Datagram Protocol port information, such as 4096, configure the network identifier corresponding to the first endpoint device to be 100, and configure the communication between the first endpoint device and the node outside the cluster to be based on the node address of the working node. This step is Figure 2 Step 1 is shown.

[0055] S120. Create network resources of the working node in the master node of the container cluster based on the container group unit adaptation network segment of the working node, the device address of the first endpoint device, the physical address of the first endpoint device, and the node address of the working node.

[0056] Among them, the container group unit adaptation network segment of the working node is the Pod network segment corresponding to the working node. In kubernetes, each node can correspond to a non-overlapping Pod network segment, and a local database can be maintained on each node through the IP Address Management (IPAM) plug-in to allocate IP addresses based on the Pod network segment corresponding to each node.

[0057] The device address of the first endpoint device may be an IP address of the first endpoint device, which is used to locate the first endpoint device in the working node. Optionally, the first IP of the Pod network segment corresponding to the working node may be configured as the IP address of the first endpoint device.

[0058] The physical address of the first endpoint device may be a MAC address of the first endpoint device.

[0059] In this step, the working node can communicate with the core components in the master node and create the network resources of the working node (also known as ClusterNode) in the master node. The network resources of the working node can include the Pod network segment corresponding to the working node, the IP address of the first endpoint device, the MAC address of the first endpoint device, and the IP address of the working node. Figure 2 Step 2 is shown.

[0060] Among them, the core component in the master node can be the kube-apiserver component, which is a core component of the Kubernetes control plane and serves as the front-end service of the system. The kube-apiserver exposes the Kubernetes application programming interface (API) and is the entrance to the Kubernetes cluster. All components in the Kubernetes cluster can interact with the cluster through the kube-apiserver.

[0061] In one embodiment, when creating a network resource of a working node, the event processing field corresponding to the network resource of the working node can be set to a second content. Among them, the event processing field can be a field used to determine whether the network resource corresponds to a node outside the cluster or a working node in the container cluster. The event processing field is set to the first content, such as false (i.e., false), which can indicate that the network resource corresponds to a node outside the cluster; the event processing field is set to the second content, such as true (i.e., true), which can indicate that the network resource corresponds to a working node in the cluster.

[0062] S130. Detecting a network resource creation event of an out-cluster node in conjunction with the master node, and determining the network resources of the out-cluster node.

[0063] The network resource creation event may be an event of creating a network resource, and the network resource creation event of a node outside the cluster may be an event of creating a network resource by a node outside the cluster.

[0064] In this step, the working node can communicate with the core component in the master node, detect network resource creation events based on the core component in the master node, determine the network resource creation events of the nodes outside the cluster from the detected network resource creation events, and further determine the network resources created by the network resource creation events of the nodes outside the cluster as the network resources of the nodes outside the cluster. Figure 2 Step 3 is shown.

[0065] In one embodiment, in conjunction with the master node detecting a network resource creation event of an out-of-cluster node, determining the network resource of the out-of-cluster node includes:

[0066] When a network resource creation event is detected from the master node and the event processing field of the detected network resource creation event is the first content, determining that the detected network resource creation event is a network resource creation event of the node outside the cluster;

[0067] The network resources of the node outside the cluster are determined through the network resource creation event of the node outside the cluster, and the network resources of the node outside the cluster include the container group unit adaptation segment of the node outside the cluster, the device address of the second endpoint device in the node outside the cluster, the physical address of the second endpoint device and the node address of the node outside the cluster.

[0068] That is, if a network resource creation event is detected from the master node, and the event processing field corresponding to the detected network resource creation event is the first content, it indicates that the detected network resource creation event is a network resource creation event of a node outside the cluster, and the network resource created by the network resource creation event of the node outside the cluster is determined as a network resource of the node outside the cluster.

[0069] Among them, the container group unit adaptation network segment of the node outside the cluster is the Pod network segment corresponding to the node outside the cluster; the device address of the second endpoint device in the node outside the cluster is the IP address of the second endpoint device; the physical address of the second endpoint device is the MAC address of the second endpoint device; the node address of the node outside the cluster is the IP address of the node outside the cluster. The second endpoint device can be a device created in the node outside the cluster and adapted to the starting point or end point of the VXLAN tunnel, specifically a VTEP device.

[0070] S140. Establish, according to the network resources of the node outside the cluster, a VXLAN tunnel for communication between the first endpoint device and a second endpoint device in the node outside the cluster, so that the node outside the cluster accesses the container group unit through the VXLAN tunnel.

[0071] In this step, the network resources of the node outside the cluster can be parsed to obtain the Pod network segment corresponding to the node outside the cluster, the IP address of the second endpoint device in the node outside the cluster, the MAC address of the second endpoint device and the IP address of the node outside the cluster. The VXLAN tunnel for communication between the first endpoint device and the second endpoint device is established through the parsed content, so as to transmit the traffic from the node outside the cluster to the container group unit in the cluster through the VXLAN tunnel to the container group unit in the cluster. This step is Figure 2 Step 4 is shown.

[0072] In one embodiment, establishing a VXLAN tunnel for communication between the first endpoint device and a second endpoint device in the node outside the cluster according to the network resources of the node outside the cluster includes:

[0073] The network resources of the node outside the cluster are parsed, the static routing, address resolution protocol and forwarding database corresponding to the working node are configured, and a VXLAN tunnel is established for the first endpoint device to communicate with the second endpoint device in the node outside the cluster.

[0074] Configuring the static routing, address resolution protocol, and forwarding database corresponding to the working node can be achieved through Linux commands, as follows:

[0075] The first command is used to configure the forwarding database (FDB) corresponding to the working node. Specifically: it instructs to add a static MAC address table, namely FDB entry, in the Linux bridge. This entry specifies that the data sent to the MAC address of the second endpoint device in the node outside the cluster should be forwarded through the first endpoint device of the working node, and also specifies the IP address to which the data needs to be sent to the node outside the cluster.

[0076] The second command is used to configure the static route corresponding to the working node. Specifically, it instructs to add a static routing rule. The rule indicates that when the working node needs to send data to the Pod network segment of the node outside the cluster, it should go through the first endpoint device of the working node, use the IP address of the first endpoint device as the source address, and use the IP address of the second endpoint device of the node outside the cluster as the next hop.

[0077] The third command is used to configure the Address Resolution Protocol (ARP) corresponding to the working node. Specifically, it instructs to add an ARP entry that associates the IP address of the second endpoint device of the node outside the cluster with the MAC address of the second endpoint device, ensuring that when the first endpoint device of the working node sends data to the second endpoint device of the node outside the cluster through the VXLAN tunnel, the MAC address of the second endpoint device can be correctly resolved.

[0078] Through the configuration of the preceding commands, unidirectional VXLAN tunnel communication between working nodes and nodes outside the cluster can be established.

[0079] It should be noted that the contents of S110 to S140 in the embodiment of the present invention can all be understood as being implemented by the daemon component (also known as the node-agent component) in the working node. The daemon component can be deployed in the working node in the form of DaemonSet. Among them, DaemonSet is an API object in the Kubernetes cluster that ensures that a specific Pod copy runs on the working node, and is usually used for services that need to run on all nodes, such as log collection, monitoring or network services.

[0080] The technical solution of the embodiment of the present invention is to establish a VXLAN tunnel for communication between a first endpoint device in the working node and a second endpoint device in a node outside the cluster by deploying a working node of a container group unit in a container cluster. Without relying on additional hardware configuration and actual communication address division, the node outside the cluster can access the container group unit in the cluster through the VXLAN tunnel, thereby reducing the cost of the node outside the cluster accessing the container group unit in the cluster.

[0081] Embodiment 2

[0082] Figure 3 This is a flow chart of a communication method based on a container cluster provided according to Embodiment 2 of the present invention. This embodiment can be applied to the case where a VXLAN tunnel is established through a node outside the cluster so that the node outside the cluster can access the container group unit in the working node through the VXLAN tunnel. The method can be executed by a communication device based on a container cluster, which can be implemented in the form of software and / or hardware and integrated in an electronic device serving as a node outside the cluster. Furthermore, the electronic device includes but is not limited to: a computer, a laptop, etc.

[0083] It should be noted that this embodiment is a description of the establishment of a VXLAN tunnel in a node outside the cluster in Embodiment 1. For contents not fully described in this embodiment, please refer to Embodiment 1.

[0084] Combination Figure 2 The architecture shown is Figure 3 The method shown is described as follows: Figure 3 As shown, the method includes:

[0085] S310. Create and start a second endpoint device for VXLAN communication based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the node outside the cluster.

[0086] The second endpoint device may be a device created in a node outside the cluster and adapted to the starting point or end point of the VXLAN tunnel, and may specifically be a VTEP device.

[0087] The user datagram protocol port information may be information indicating a port required for UDP communication, such as indicating that the port number required for UDP communication is 4096, which is not limited here.

[0088] The VXLAN Network Identifier (VNI) can be a 24-bit number used to distinguish different VXLAN networks, and can theoretically support up to 16M (2^24) isolated VXLAN networks. Optionally, the VNI can be set to 1000, which is not limited here.

[0089] The node address of the node outside the cluster can be the IP address of the node outside the cluster, which is not limited here.

[0090] In this step, you can create and start a second endpoint device on the node outside the cluster, configure the second endpoint device to use the port required for UDP communication indicated by the User Datagram Protocol port information, such as 4096, configure the network identifier corresponding to the second endpoint device to be 100, and configure the communication between the second endpoint device and the working node to be based on the node address of the node outside the cluster. This step is Figure 2 Step 5 is shown.

[0091] S320: Create network resources of the node outside the cluster in the master node of the container cluster based on the container group unit adaptation network segment of the node outside the cluster, the device address of the second endpoint device, the physical address of the second endpoint device, and the node address of the node outside the cluster.

[0092] Among them, the container group unit adaptation network segment of the node outside the cluster is the Pod network segment corresponding to the node outside the cluster. Optionally, you can check whether there is a file recording the Pod network segment on the node outside the cluster. If there is no such file, a pseudo Pod network segment is randomly assigned to the node outside the cluster and recorded in the file. If there is such a file and the Pod network segment is recorded in the file, this network segment is used directly.

[0093] The device address of the second endpoint device may be an IP address of the second endpoint device, which is used to locate the second endpoint device in the node outside the cluster. Optionally, the first IP of the Pod network segment corresponding to the node outside the cluster may be configured as the IP address of the second endpoint device.

[0094] The physical address of the second endpoint device may be a MAC address of the second endpoint device.

[0095] In this step, the out-of-cluster node can communicate with the core components in the master node, and the network resources of the out-of-cluster node are created in the master node. The network resources of the out-of-cluster node may include the Pod network segment corresponding to the out-of-cluster node, the IP address of the second endpoint device, the MAC address of the second endpoint device, and the IP address of the out-of-cluster node. Figure 2 Step 6 is shown.

[0096] In one embodiment, when creating a network resource of a node outside the cluster, the event processing field corresponding to the network resource of the node outside the cluster may be set to the first content to trigger a network resource creation event of the node outside the cluster.

[0097] S330. Acquire network resources of working nodes in the container cluster in conjunction with the master node.

[0098] In this step, nodes outside the cluster can communicate with the core components in the master node and obtain the network resources of the working nodes created in the master node. Figure 2 Step 7 is shown.

[0099] In one embodiment, acquiring network resources of working nodes in the container cluster in conjunction with the master node includes:

[0100] Acquire a network resource whose corresponding event processing field is the second content from the master node, and determine the acquired network resource as the network resource of the working node in the container cluster; wherein the network resource of the working node includes the container group unit adaptation network segment of the working node, the device address of the first endpoint device in the working node, the physical address of the first endpoint device and the node address of the working node.

[0101] Among them, the container group unit adaptation network segment of the working node is the Pod network segment corresponding to the working node; the device address of the first endpoint device in the working node is the IP address of the first endpoint device; the physical address of the first endpoint device is the MAC address of the first endpoint device; the node address of the working node is the IP address of the working node.

[0102] S340. According to the network resources of the working node, establish a VXLAN tunnel for the second endpoint device to communicate with the first endpoint device in the working node, so that the node outside the cluster accesses the container group unit of the working node through the VXLAN tunnel.

[0103] In this step, the network resources of the working node can be parsed to obtain the Pod network segment corresponding to the working node, the IP address of the first endpoint device in the working node, the MAC address of the first endpoint device and the IP address of the working node. The VXLAN tunnel for the second endpoint device to communicate with the first endpoint device is established through the parsed content, so as to transmit the traffic from the node outside the cluster to the container group unit in the cluster through the VXLAN tunnel to the container group unit in the cluster. This step is Figure 2 Step 8 is shown.

[0104] In one embodiment, establishing a VXLAN tunnel for communication between the second endpoint device and the first endpoint device in the working node according to the network resources of the working node includes:

[0105] The network resources of the working node are parsed, the static routing, address resolution protocol and forwarding database corresponding to the node outside the cluster are configured, and a VXLAN tunnel is established for the second endpoint device to communicate with the first endpoint device in the working node.

[0106] Configure the static routes, address resolution protocols, and forwarding databases corresponding to the nodes outside the cluster. This can be done through Linux commands, as follows:

[0107] The first command is used to configure the forwarding database corresponding to the node outside the cluster. Specifically: it instructs to add a static MAC address table, namely FDB entry, in the Linux bridge. This entry specifies that the data sent to the MAC address of the first endpoint device in the working node should be forwarded through the second endpoint device of the node outside the cluster, and also specifies the IP address of the working node to which the data needs to be sent.

[0108] The second command is used to configure the static routes corresponding to the nodes outside the cluster. Specifically, it instructs to add a static routing rule. The rule indicates that when the node outside the cluster needs to send data to the Pod network segment of the working node, it should go through the second endpoint device of the node outside the cluster, use the IP address of the second endpoint device as the source address, and use the IP address of the first endpoint device of the working node as the next hop.

[0109] The third command is used to configure the address resolution protocol corresponding to the node outside the cluster. Specifically: it instructs to add an ARP entry, which associates the IP address of the first endpoint device of the working node with the MAC address of the first endpoint device, ensuring that when the second endpoint device of the node outside the cluster sends data to the first endpoint device of the working node through the VXLAN tunnel, the MAC address of the first endpoint device can be correctly resolved.

[0110] Through the configuration of the preceding commands, unidirectional VXLAN tunnel communication between nodes outside the cluster and working nodes can be established.

[0111] It should be noted that the contents of S310 to S340 in the embodiment of the present invention can all be understood as being implemented by a cluster network component (also called a clustermesh component) in a node outside the cluster. The cluster network component can be deployed in a binary form in a node outside the cluster.

[0112] Through the processing of Example 1 and Example 2, VXLAN tunnels are opened between the nodes outside the cluster and the working nodes, so that the nodes outside the cluster can directly communicate with the container group units in the cluster.

[0113] The technical solution of the embodiment of the present invention establishes a VXLAN tunnel for communicating between a second endpoint device in an out-cluster node and a first endpoint device in a working node in a container cluster through an out-cluster node outside the container cluster. Without relying on additional hardware configuration and actual communication address division, the out-cluster node can access the container group unit in the cluster through the VXLAN tunnel, thereby reducing the cost of the out-cluster node accessing the container group unit in the cluster.

[0114] Embodiment 3

[0115] Figure 4 is a structural diagram of a communication device based on a container cluster according to Embodiment 3 of the present invention. This embodiment can be applied to the case where a VXLAN tunnel is established through a working node where a container group unit is deployed in a container cluster so that a node outside the cluster can access the container group unit in the working node through the VXLAN tunnel, such as Figure 4 As shown, the device comprises:

[0116] A first creation module 41 is used to create and start a first endpoint device for VXLAN communication based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the working node;

[0117] A second creation module 42 is used to create network resources of the working node in the master node of the container cluster based on the container group unit adaptation network segment of the working node, the device address of the first endpoint device, the physical address of the first endpoint device and the node address of the working node;

[0118] A determination module 43, configured to detect a network resource creation event of an out-cluster node in conjunction with the master node, and determine the network resources of the out-cluster node;

[0119] The first communication module 44 is used to establish a VXLAN tunnel for communication between the first endpoint device and the second endpoint device in the node outside the cluster according to the network resources of the node outside the cluster, so that the node outside the cluster accesses the container group unit through the VXLAN tunnel.

[0120] The container cluster-based communication device provided in this embodiment creates and starts a first endpoint device for VXLAN communication through a first creation module based on user datagram protocol port information, a network identifier of a virtual extensible local area network VXLAN, and a node address of the working node; creates network resources of the working node in the master node of the container cluster through a second creation module based on the container group unit adaptation network segment of the working node, the device address of the first endpoint device, the physical address of the first endpoint device, and the node address of the working node; determines the network resources of the node outside the cluster by detecting a network resource creation event of a node outside the cluster in combination with the master node through a determination module; and establishes a VXLAN tunnel for communication between the first endpoint device and the second endpoint device in the node outside the cluster according to the network resources of the node outside the cluster through the first communication module, so that the node outside the cluster can access the container group unit through the VXLAN tunnel. This solution deploys working nodes of container group units in the container cluster and establishes a VXLAN tunnel for communication between the first endpoint device in the working node and the second endpoint device in the node outside the cluster. Without relying on additional hardware configuration and actual communication address division, the node outside the cluster can access the container group units in the cluster through the VXLAN tunnel, reducing the cost of the node outside the cluster accessing the container group units in the cluster.

[0121] Further, the determination module 43 is specifically used for:

[0122] When a network resource creation event is detected from the master node and the event processing field of the detected network resource creation event is the first content, determining that the detected network resource creation event is a network resource creation event of the node outside the cluster;

[0123] The network resources of the node outside the cluster are determined through the network resource creation event of the node outside the cluster, and the network resources of the node outside the cluster include the container group unit adaptation segment of the node outside the cluster, the device address of the second endpoint device in the node outside the cluster, the physical address of the second endpoint device and the node address of the node outside the cluster.

[0124] Furthermore, the first communication module 44 is specifically used for:

[0125] The network resources of the node outside the cluster are parsed, the static routing, address resolution protocol and forwarding database corresponding to the working node are configured, and a VXLAN tunnel is established for the first endpoint device to communicate with the second endpoint device in the node outside the cluster.

[0126] The communication device based on container cluster provided in the embodiment of the present invention can execute the communication method based on container cluster provided in the first embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0127] Embodiment 4

[0128] Figure 5 is a structural diagram of a communication device based on a container cluster according to a fourth embodiment of the present invention. This embodiment can be applied to the case where a VXLAN tunnel is established through a node outside the cluster so that the node outside the cluster accesses the container group unit in the working node through the VXLAN tunnel, such as Figure 5 As shown, the device comprises:

[0129] A third creation module 51 is used to create and start a second endpoint device for VXLAN communication based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the node outside the cluster;

[0130] A fourth creation module 52, configured to create a network resource of the node outside the cluster in the master node of the container cluster based on the container group unit adaptation network segment of the node outside the cluster, the device address of the second endpoint device, the physical address of the second endpoint device, and the node address of the node outside the cluster;

[0131] An acquisition module 53 is used to acquire network resources of working nodes in the container cluster in combination with the master node;

[0132] The second communication module 54 is used to establish a VXLAN tunnel for communication between the second endpoint device and the first endpoint device in the working node according to the network resources of the working node, so that the node outside the cluster can access the container group unit of the working node through the VXLAN tunnel.

[0133] The container cluster-based communication device provided in this embodiment creates and starts a second endpoint device for VXLAN communication through a third creation module based on user datagram protocol port information, a network identifier of a virtual extensible local area network VXLAN, and a node address of the node outside the cluster; creates network resources of the node outside the cluster in the master node of the container cluster through a fourth creation module based on an adaptation network segment of a container group unit of the node outside the cluster, a device address of the second endpoint device, a physical address of the second endpoint device, and a node address of the node outside the cluster; acquires network resources of a working node in the container cluster in combination with the master node through an acquisition module; and establishes a VXLAN tunnel for communication between the second endpoint device and the first endpoint device in the working node through a second communication module according to the network resources of the working node, so that the node outside the cluster can access the container group unit of the working node through the VXLAN tunnel. This solution establishes a VXLAN tunnel through an out-cluster node outside the container cluster for communication between the second endpoint device in the out-cluster node and the first endpoint device in the working node in the container cluster. Without relying on additional hardware configuration and actual communication address division, the out-cluster node can access the container group unit in the cluster through the VXLAN tunnel, reducing the cost of the out-cluster node accessing the container group unit in the cluster.

[0134] Furthermore, the acquisition module 53 is specifically used for:

[0135] Acquire a network resource whose corresponding event processing field is a second content from the master node, and determine the acquired network resource as a network resource of a working node in the container cluster;

[0136] The network resources of the working node include the container group unit adaptation network segment of the working node, the device address of the first endpoint device in the working node, the physical address of the first endpoint device and the node address of the working node.

[0137] Furthermore, the second communication module 54 is specifically used for:

[0138] The network resources of the working node are parsed, the static routing, address resolution protocol and forwarding database corresponding to the node outside the cluster are configured, and a VXLAN tunnel is established for the second endpoint device to communicate with the first endpoint device in the working node.

[0139] The communication device based on container cluster provided in the embodiment of the present invention can execute the communication method based on container cluster provided in the second embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0140] Embodiment 5

[0141] Figure 6Schematic diagram of an electronic device implementing an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0142] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0143] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0144] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a communication method based on a container cluster.

[0145] In some embodiments, the communication method based on the container cluster may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the communication method based on the container cluster described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the communication method based on the container cluster in any other appropriate manner (e.g., by means of firmware).

[0146] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0147] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0148] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0149] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input from the user can be received in any form.

[0150] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0151] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0152] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0153] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A communication method based on container cluster, characterized in that: Applied to a working node for deploying a container group unit in a container cluster, the method comprises: Based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the working node, create and start a first endpoint device for VXLAN communication; Creating a network resource of the working node in the master node of the container cluster based on the container group unit adaptation network segment of the working node, the device address of the first endpoint device, the physical address of the first endpoint device, and the node address of the working node; In conjunction with the master node detecting a network resource creation event of a node outside the cluster, determining the network resource of the node outside the cluster; According to the network resources of the node outside the cluster, a VXLAN tunnel is established for the first endpoint device to communicate with the second endpoint device in the node outside the cluster, so that the node outside the cluster accesses the container group unit through the VXLAN tunnel.

2. The method according to claim 1, characterized in that In conjunction with the master node detecting a network resource creation event of a node outside the cluster, determining the network resource of the node outside the cluster includes: When a network resource creation event is detected from the master node and the event processing field of the detected network resource creation event is the first content, determining that the detected network resource creation event is a network resource creation event of the node outside the cluster; The network resources of the node outside the cluster are determined through the network resource creation event of the node outside the cluster, and the network resources of the node outside the cluster include the container group unit adaptation segment of the node outside the cluster, the device address of the second endpoint device in the node outside the cluster, the physical address of the second endpoint device and the node address of the node outside the cluster.

3. The method according to claim 1, characterized in that Establishing a VXLAN tunnel for communication between the first endpoint device and a second endpoint device in the node outside the cluster according to the network resources of the node outside the cluster, including: The network resources of the node outside the cluster are parsed, the static routing, address resolution protocol and forwarding database corresponding to the working node are configured, and a VXLAN tunnel is established for the first endpoint device to communicate with the second endpoint device in the node outside the cluster.

4. A communication method based on container cluster, characterized in that: Applied to an out-of-cluster node outside a container cluster, the method includes: Based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the node outside the cluster, create and start a second endpoint device for VXLAN communication; Creating a network resource of the node outside the cluster in the master node of the container cluster based on the container group unit adaptation network segment of the node outside the cluster, the device address of the second endpoint device, the physical address of the second endpoint device, and the node address of the node outside the cluster; Acquire network resources of working nodes in the container cluster in conjunction with the master node; According to the network resources of the working node, a VXLAN tunnel is established for the second endpoint device to communicate with the first endpoint device in the working node, so that the node outside the cluster accesses the container group unit of the working node through the VXLAN tunnel.

5. The method according to claim 4, characterized in that Acquiring network resources of working nodes in the container cluster in conjunction with the master node includes: Acquire a network resource whose corresponding event processing field is a second content from the master node, and determine the acquired network resource as a network resource of a working node in the container cluster; The network resources of the working node include the container group unit adaptation network segment of the working node, the device address of the first endpoint device in the working node, the physical address of the first endpoint device and the node address of the working node.

6. The method according to claim 4, characterized in that Establishing a VXLAN tunnel for communication between the second endpoint device and the first endpoint device in the working node according to the network resources of the working node, including: The network resources of the working node are parsed, the static routing, address resolution protocol and forwarding database corresponding to the node outside the cluster are configured, and a VXLAN tunnel is established for the second endpoint device to communicate with the first endpoint device in the working node.

7. A communication device based on a container cluster, characterized in that: A working node configured to deploy a container group unit in a container cluster, the device comprising: A first creation module is used to create and start a first endpoint device for VXLAN communication based on user datagram protocol port information, a network identifier of a virtual extensible local area network VXLAN, and a node address of the working node; A second creation module is used to create network resources of the working node in the master node of the container cluster based on the container group unit adaptation network segment of the working node, the device address of the first endpoint device, the physical address of the first endpoint device and the node address of the working node; A determination module, configured to detect a network resource creation event of an out-cluster node in conjunction with the master node, and determine the network resources of the out-cluster node; The first communication module is used to establish a VXLAN tunnel for communication between the first endpoint device and a second endpoint device in the node outside the cluster according to the network resources of the node outside the cluster, so that the node outside the cluster accesses the container group unit through the VXLAN tunnel.

8. A communication device based on a container cluster, characterized in that: An out-of-cluster node configured outside the container cluster, the device comprising: A third creation module is used to create and start a second endpoint device for VXLAN communication based on the user datagram protocol port information, the network identifier of the virtual extensible local area network VXLAN, and the node address of the node outside the cluster; a fourth creation module, configured to create, in the master node of the container cluster, a network resource of the node outside the cluster based on the container group unit adaptation network segment of the node outside the cluster, the device address of the second endpoint device, the physical address of the second endpoint device, and the node address of the node outside the cluster; An acquisition module, used to acquire network resources of working nodes in the container cluster in conjunction with the master node; The second communication module is used to establish a VXLAN tunnel for communication between the second endpoint device and the first endpoint device in the working node according to the network resources of the working node, so that the node outside the cluster can access the container group unit of the working node through the VXLAN tunnel.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method as claimed in any one of claims 1 to 3, or execute the method as claimed in any one of claims 4 to 6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the program implements the method according to any one of claims 1 to 3, or implements the method according to any one of claims 4 to 6.

Citation Information

Cited By

  • Multi-cluster network communication method, device, equipment, medium and product

    CN121125592A

  • Resource scheduling method and device

    CN121542058A