A communication method and service node for containers

By creating virtual bridges and virtual networks in the container cluster, and performing encryption and decryption on the container's network protocol stack, the problem of container network communication security is solved, cross-node communication security and resource saving are achieved, and it is suitable for multiple application scenarios. .

CN118590330BActive Publication Date: 2024-10-01SICHUAN MEDITATION SOFTWARE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411074114.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-10-01
Estimated Expiration
2044-08-07

AI Technical Summary

Technical Problem

In the cloud computing and containerization technology environment, as the complexity of applications increases and the number of containers and clusters increases, container network communication security issues gradually emerge, which are difficult to effectively solve with existing technologies.

Method used

By obtaining configuration rules in the container cluster, creating a virtual network card pair between the service node's virtual network bridge and the local container, as well as a virtual network between the service node and other service nodes, using the communication key of the secure network domain in the container The network protocol stack encrypts and decrypts communication data and establishes an isolated network environment to ensure communication security.

Benefits of technology

It achieves the security of cross-node container communication, avoids external network interception and monitoring, reduces the security risk of proxy encryption, saves resources, and adapts to multiple application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118590330B_ABST
    Figure CN118590330B_ABST
Patent Text Reader

Abstract

The present application discloses a communication method and service node for a container. The method obtains configuration rules through the service node in the container cluster to create a virtual network card pair between the virtual bridge of the service node and the local container and a virtual network between the service node and other service nodes according to the configuration rules. When the local container communicates with other target containers based on the virtual network card pair and the virtual network, the communication data of the local container is encrypted and decrypted on the network protocol stack of the local container through the communication key of the secure network domain. The communication method provided by the present application creates an isolated network environment for cross-node containers to communicate; in addition, the communication data of the container is encrypted and decrypted on the network protocol stack of the container. By encrypting and decrypting the data from the source, the security risks of proxy encryption can be avoided, which not only achieves the purpose of saving resources, but also can achieve the technical effect of the present application to adapt to multiple application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure generally relates to the field of communication technology, and more specifically to a communication method and service node for a container. Background Technology

[0002] In the current cloud computing and containerization technology environment, containers are widely used in application development and deployment due to their lightweight and high efficiency. However, as application complexity increases, containerized deployment often requires dividing applications into business entry containers and business application containers. This leads to a sharp increase in the number of containers and container clusters. At the same time, the use of multiple network interface cards (NICs) in containers further complicates container networks, and security issues in inter-container network communication are becoming increasingly apparent. Summary of the Invention

[0003] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a communication method for containers and service nodes.

[0004] A first aspect provides a container communication method applied to a container cluster network, the container cluster network including at least one container cluster, the container cluster including at least one service node, the service node having at least one container and a virtual bridge deployed on it, the method comprising:

[0005] The service node obtains configuration rules; the configuration rules are used to instruct the construction of a secure network domain for at least two target containers, the at least two target containers being deployed on different service nodes;

[0006] Based on the configuration rules, a virtual network interface card (NIC) pair is created between the service node's virtual bridge and the local container, and a connection is established between the virtual bridge and the local container through the virtual NIC pair;

[0007] A virtual network is created between the service node and other service nodes based on the configuration rules; the other service nodes are the service nodes corresponding to the target containers other than the local container among the at least two target containers, and the local container is the container deployed on the service node among the at least two target containers.

[0008] When the local container communicates with other target containers based on the virtual network interface card and the virtual network, the communication data of the local container is encrypted and decrypted on the network protocol stack of the local container using the communication key of the secure network domain. The other target containers are the containers deployed on the other service nodes among the at least two target containers.

[0009] The container communication method provided in this application addresses the rapidly increasing number of containers and container clusters, coupled with the growing complexity of container networks due to the use of multiple network interface cards (NICs), and the emerging security issues in inter-container network communication. This application provides a container communication method that obtains configuration rules from service nodes in the container cluster. Based on these rules, it creates virtual NIC pairs between the service node and the local container, as well as virtual networks between the service node and other service nodes. Then, it establishes a connection between the virtual bridge and the local container through the virtual NIC pairs. When the local container communicates with other target containers via the virtual NIC pairs and virtual networks, it encrypts and decrypts the communication data of the local container on its network protocol stack using a communication key from a secure network domain. The communication method provided in this application creates an isolated network environment when containers communicate across nodes by setting up virtual network interface cards and virtual networks. External networks cannot intercept or listen to the network traffic within this environment. In addition, when containers communicate in the isolated network environment, the communication data of the containers is encrypted and decrypted on the container's network protocol stack. By encrypting and decrypting the data at the source, the security risks of proxy encryption can be avoided, further ensuring the security of cross-node communication between containers. Moreover, all of the above improvements are unrelated to the application itself, which not only achieves the goal of saving resources but also enables the technical effect of this application to adapt to multiple application scenarios.

[0010] The first aspect provides a service node, the service node comprising:

[0011] The security network domain controller obtains configuration rules; the configuration rules are used to instruct the construction of a security network domain for at least two target containers, the at least two target containers being deployed on different service nodes.

[0012] A container executor is used to create a virtual network interface pair between the service node's virtual bridge and the local container based on the configuration rules, and to establish a connection between the virtual bridge and the local container through the virtual network interface pair;

[0013] The container executor is also used to create a virtual network between the service node and other service nodes based on the configuration rules; the other service nodes are the service nodes corresponding to the target containers other than the local container among the at least two target containers, and the local container is the container deployed on the service node among the at least two target containers;

[0014] A secure network domain executor is used to encrypt and decrypt the communication data of the local container on the network protocol stack of the local container using the communication key of the secure network domain when the local container communicates with other target containers based on the virtual network interface card and the virtual network. The other target containers are the containers deployed on the other service nodes among the at least two target containers. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0016] Figure 1 An application scenario diagram of the container communication method provided in this application;

[0017] Figure 2 A flowchart illustrating the steps of a container communication method provided in this application;

[0018] Figure 3 A flowchart illustrating the steps of a container communication method provided in this application;

[0019] Figure 4 A flowchart illustrating the steps of a container communication method provided in this application;

[0020] Figure 5 A flowchart illustrating the steps of a container communication method provided in this application;

[0021] Figure 6 A flowchart illustrating the steps of a container communication method provided in this application;

[0022] Figure 7 This is a schematic diagram of the structure of a computer system for a service node provided in this application. DETAILED DESCRIPTION

[0023] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0025] Please refer to Figure 1 , Figure 1This application scenario diagram illustrates a container communication method provided in this application. The application scenario diagram includes a container cluster network, which includes at least one container cluster. Each container cluster includes two service nodes (a service node and another service node). The service node has local containers and virtual bridges deployed on it, while the other service nodes have other target containers, virtual bridges, and communication network cards deployed on them.

[0026] It should be noted that service nodes communicate with other service nodes via communication network cards and physical switches.

[0027] A first pair of virtual network interface cards (NICs) is established between the local container and the virtual bridge of the service node, and a second pair of virtual NICs is established between the virtual bridges of other target containers and other service nodes. The local container sends communication data to the container protocol stack for encryption before sending it to the first sub-NIC of the first virtual NIC pair. The first sub-NIC then sends the communication data to the second sub-NIC of the first virtual NIC pair, and the second sub-NIC then sends the communication data to the virtual bridge of the service node. The virtual bridge of the service node sends the communication data to the virtual bridges of other service nodes through the configured virtual network. The virtual bridges of other service nodes continue to transmit the data through the second virtual NIC to the container protocol stack of other target containers. After decryption at the container protocol stack, cross-node communication between the local container and other target containers is achieved.

[0028] The following is combined Figure 2 The communication of the container provided in this application is illustrated by way of example. Figure 2 This application provides a flowchart of the steps for communication within a container, applying the method to... Figure 1 Taking a service node in the system as an example, this method is illustrated and includes the following steps:

[0029] Step S20: The service node obtains the configuration rules; the configuration rules are used to indicate the construction of a secure network domain for at least two target containers, and the at least two target containers are deployed on different service nodes.

[0030] The container cluster network also includes a container management system and a configuration center, each corresponding to multiple container clusters. The container management system provides a user interface, allowing users to create configuration rules through the interface.

[0031] After obtaining configuration rules, the container management system can distribute them to the configuration center of the container cluster network. Each container cluster in the container management cluster network can access this configuration center in real time to obtain the configuration rules. Specifically, each service node in each container cluster can access the configuration center in real time to obtain the configuration rules. Furthermore, each service node in the container cluster also has a security network domain controller deployed on it, and the security network domain controller deployed on each service node reads the configuration rules from the configuration center in real time.

[0032] Configuration rules are used to instruct the construction of a secure network domain for at least two target containers. In other words, configuration rules are used to build a secure communication environment for at least two target containers deployed on different service nodes when they communicate, in order to avoid or improve the situation where the communication data of at least two target containers is leaked, eavesdropped on, or attacked.

[0033] Based on the role of configuration rules, it can be understood that configuration rules can include unique identifiers for container clusters, service nodes, and containers.

[0034] After obtaining the configuration rules from the configuration center, the security network domain controllers deployed on each service node parse the configuration rules to obtain the unique identifiers of the corresponding container cluster, service nodes, and containers. This allows the security network domain controllers deployed on the service nodes to determine whether the configuration rule is related to the corresponding service node and the containers deployed on the service node.

[0035] For example, a first service node and a second service node are deployed on container cluster A. The security network domain controllers deployed on the first and second service nodes read the configuration rules from the configuration center. Through parsing these rules, the security network domain controller of the first service node determines that the unique identifier of the container cluster is the same as the unique identifier of container cluster A, and that the unique identifier of the service node includes the unique identifier of the first service node. Therefore, the security network domain controller of the first service node can execute the next operation according to the instructions of the configuration rule. Similarly, the security network domain controller of the second service node determines that the unique identifier of the container cluster is the same as the unique identifier of container cluster A, and that the unique identifier of the service node includes the unique identifier of the second service node. Therefore, the security network domain controller of the second service node can execute the next operation according to the instructions of the configuration rule. In other words, when the first service node obtains the configuration rule, it can obtain the information that it needs to build a security network domain for the target container deployed on itself and the target container deployed on the second service node; similarly, the second service node, by parsing the configuration rule, can also obtain the information that it needs to build a security network domain for the target container deployed on itself and the target container deployed on the first service node.

[0036] Understandably, if the security network domain controller parses the configuration rules and determines that the unique identifier of the container cluster is different from the unique identifier of container cluster A, then the security network domain controller may delete the configuration rule or do nothing.

[0037] Optionally, the security network domain controller can monitor the configuration rules stored in the configuration center in real time using a list-watch approach. This monitoring allows for timely acquisition of configuration rules, enabling the timely construction of secure network domains for the target containers required by the user, thus improving the user experience.

[0038] In another optional embodiment, a secure network domain executor is also deployed on the service node. When the secure network domain controller reads the configuration rules from the configuration center, it can perform protocol-to-command conversion of the configuration rules to obtain container network configuration information, and then send the container network configuration information to the secure network domain executor to execute the corresponding configuration operation through the secure network executor.

[0039] In another optional embodiment, when the security network domain controller determines that the configuration rules have been updated (e.g., a container needs to be added or deleted) or that a configuration rule has been deleted, it will reissue the new configuration rules to the security network domain executor, or instruct the security network domain executor to delete the original configuration rules. Then, the service node can perform operations such as deleting the virtual network interface pair between the current service node's virtual bridge and the container according to the updated configuration rules, deleting the virtual network, or adding a new virtual network interface pair to the virtual bridge.

[0040] Since building a secure network domain for target containers across nodes requires the participation of different service nodes, but the operations to be performed by each service node are the same, the following explanation will use the example of this configuration rule to instruct the building of a secure network domain for local containers on service nodes and other target containers on other target containers, and will only use the operations performed by service nodes as an example.

[0041] Step S30: Create a virtual network between service nodes and other service nodes based on configuration rules; other service nodes are service nodes corresponding to at least two target containers other than the local container, and the local container is the container deployed on the service node among at least two target containers;

[0042] Since communication between the local container and other target containers requires network isolation from communication with other containers, this communication necessitates data exchange through a different network (such as the communication network interface card deployed on the service node). In simpler terms, communication between the local container and other target containers requires a different path than the existing communication pathways; therefore, we need to build a virtual network between the service node and other service nodes.

[0043] In an optional embodiment, such as Figure 3 As shown, Figure 3 An optional method embodiment for constructing a virtual network, provided as an exemplary embodiment of this application, includes the following steps:

[0044] Step S301: Parse the configuration rules to obtain the network key;

[0045] As mentioned above, the configuration rules include a unique identifier for the container cluster, a unique identifier for the service node, and a unique identifier for the target container. In addition, the configuration rules also include a network key. This network key is used to build a virtual network between the service node and other service nodes, and it can also encrypt the virtual network, meaning that other containers cannot communicate through this virtual network.

[0046] Therefore, after obtaining the configuration rules and parsing them, the service node and other service nodes can obtain the corresponding network keys. Since the configuration rules are used to build secure network domains for target containers deployed on the service node and other service nodes, it's understandable that the service node and other service nodes obtain the same network keys after parsing.

[0047] In step S302, the service node broadcasts data packets through its communication network card, and the data packets include the network key.

[0048] The communication network interface card (NIC) of the service node is the original NIC configured on the service node. Unlike the virtual bridge, it provides hardware support for communication between service nodes and other service nodes. Communication between service nodes is achieved through data communication via physical switches. After obtaining the network key by parsing the configuration rules, the service node can broadcast a data packet containing the network key to multiple other service nodes via the physical switch. It's understood that other service nodes can also receive this data packet. Upon receiving the data packet, since only other service nodes obtained the network key from the configuration rules, and the others did not, they parse the data packet to obtain the network key sent by the service node. They then determine if this network key matches the one obtained from the configuration rules, thus obtaining the information to establish a virtual network with the service node. However, since other service nodes did not obtain the configuration rules and parse the network key from the configuration rules, even if they obtained the network key from the data packet, they cannot determine what operation needs to be performed.

[0049] Step S303: Receive connection requests initiated by other service nodes to the service node based on broadcast, the connection requests carrying a connection key;

[0050] After broadcasting its network key, the service node receives connection requests from other service nodes. These requests are used to establish virtual network communication. The service node needs to verify the connection request using the connection key carried in the request to ensure the accuracy of the virtual network establishment.

[0051] The method by which a service node verifies a connection request is to compare the connection key sent by other service nodes with the network key. If the comparison is successful, the network key is considered to have successfully verified the connection key, and the connection request is then successfully verified; otherwise, the verification fails. It is understandable that a service node can only establish a virtual network with other service nodes if the comparison is successful.

[0052] Step S304: If the service node successfully verifies the connection key based on the network key, then a virtual network is established based on the connection between the service node and other service nodes.

[0053] Once a service node successfully verifies the connection key using the network key, it means that the service node and other service nodes have successfully joined the same network, which we refer to as a virtual network. Furthermore, the network key ensures the privacy of this virtual network, enhancing the security of communication between local containers and other target containers on the virtual network.

[0054] This application constructs a virtual network to provide a network communication environment isolated from other external networks for cross-node communication between containers. This avoids communication between containers through, for example, communication network cards set up on service nodes, so that communication between containers is not exposed to the external network environment. This reduces the attack surface when containers communicate across nodes and improves the security of cross-node communication between containers.

[0055] Step S40: Based on the configuration rules, create a virtual network interface pair between the service node's virtual bridge and the local container, and establish a connection between the virtual bridge and the local container through the virtual network interface pair;

[0056] The service nodes also deploy virtual bridges, which are involved in data frame processing and forwarding, as well as their application in the virtualization environment. In virtualization technology, virtual bridges are used to expand local area networks or enable network communication between containers and the host machine. In other words, a virtual bridge connects containers to the host machine's network, enabling communication between containers and between containers and external networks. It's important to note that to achieve communication between containers and the host machine, a virtual network interface card (NIC) pair needs to be created between the virtual bridge and the container. This virtual NIC pair enables communication between the virtual bridge and the container. As the name suggests, a virtual NIC pair consists of two NICs; one is deployed on the container, and the other is deployed on the virtual bridge. The virtual NIC pair can communicate directly with each other.

[0057] In an optional embodiment, such as Figure 4 As shown, Figure 4 An optional method embodiment for creating a virtual network interface card (NIC) pair, provided as an exemplary embodiment of this application, includes the following steps:

[0058] Step S401: Parse the configuration rules to obtain the unique identifier of the local container;

[0059] In this context, a service node may have multiple containers deployed, and the configuration rule may instruct only one of the containers on the service node to build a secure network domain with containers on other service nodes. Therefore, the service node needs to determine the target container from the multiple deployed containers, which we refer to here as the local container.

[0060] As described above, the configuration rules include a unique identifier for the container building the secure network domain. Therefore, the service node can obtain the unique identifier of the local container after parsing the configuration rules.

[0061] Step S402: Determine the local container from the service node based on the unique identifier of the local container;

[0062] Once the service node obtains the unique identifier of the container deployed on the service node by parsing the configuration rules, it can determine the local container from the multiple containers deployed on the service node.

[0063] Step S403: Create a virtual network interface pair between the virtual bridge and the local container.

[0064] A virtual network interface card (NIC) pair is a pair of ports; all data packets flowing in from one port will flow out from the other, and vice versa. However, a virtual NIC pair can only enable communication between two network interfaces. But communication between the local container and other target containers requires communication between multiple interfaces. Therefore, we need to create a virtual bridge between the local container and the virtual NIC pair. A virtual bridge can enable communication between several network interfaces; that is, if one network interface in the virtual bridge receives data, it will be copied to other interfaces of the virtual bridge, so that the data can be forwarded from those interfaces.

[0065] Therefore, the virtual bridges deployed on the service nodes and the virtual network interface cards created must work together to enable communication between local containers and other target containers.

[0066] For example, a virtual network interface pair between a virtual bridge and a local container can be created using the following command:

[0067] IP link add <p1-name>type veth peer name <p2-name>

[0068] After the service node creates a virtual network interface pair (NIC) between the virtual bridge deployed on the service node and the local container using the above method, communication between the virtual bridge and the local container cannot be achieved without corresponding configuration. Therefore, the following configuration is required to establish a connection between the virtual bridge and the local container through the virtual NIC pair, thus enabling communication between the two:

[0069] To distinguish between virtual network interface card (NIC) pairs, the two NICs in a virtual NIC pair are referred to as the first NIC and the second NIC. The specific operations for establishing a communication connection between the virtual bridge and the local container are as follows:

[0070] Configure the first network interface card as a sub-device of the virtual bridge;

[0071] Set the namespace of the second network interface card to the namespace of the local container.

[0072] Setting the first network card as a sub-device of the virtual bridge means establishing a mapping relationship between one of the interfaces in the virtual bridge and the first network card, so that one of the interfaces on the virtual bridge can communicate with the first network card.

[0073] Generally speaking, a namespace is a unique set of names, so that there is no ambiguity when objects come from different places but have the same name. Namespaces can mark access paths, so setting the namespace of the second network interface to the namespace of the local container can enable mutual access between the two.

[0074] Furthermore, based on the inherent properties of the virtual network interface card pair, it is known that the first and second network interfaces can communicate directly. After the above settings, a connection can be established between the local container and the virtual bridge, enabling the local container to communicate with the virtual bridge.

[0075] Based on the above settings, the communication between the local container and the virtual bridge will be explained below.

[0076] Since communication is bidirectional, one of the communication methods between the two will be explained below:

[0077] The communication data that a local container needs to send must be encapsulated and processed on the local container's network protocol stack. It's important to note that the network protocol stack is the sum of all layers of protocols in a computer network. Its working principle is that each layer of the network protocol stack is responsible for encapsulating and processing data from the layer above and passing it to the layer below. The receiving end then decapsulates and processes the data in the reverse order, ultimately passing the data to the application layer. Therefore, the local container encapsulates and processes the data to be used for communication through the network protocol stack before sending it out.

[0078] After the local container encapsulates and processes the communication data through the network protocol stack, it transmits the data to the second network interface card (NIC). Since the virtual NIC is a pair of ports, all data packets flowing in from one port will flow out from the other port. In other words, the data flowing into the second NIC must flow out from the first NIC. Therefore, the communication data is transmitted to the first NIC. Since there is a mapping relationship between the first NIC and one of the interfaces of the virtual bridge, one of the interfaces of the virtual network can read the communication data from the first NIC.

[0079] Another communication method is:

[0080] When other network ports of the virtual bridge receive communication data, the data received by one network interface in the virtual bridge will be copied to other interfaces of the virtual bridge. Therefore, the interface in the virtual bridge that establishes a mapping relationship with the first network card will obtain the communication data. The first network card can then obtain the communication data from this interface and flow into the container's network protocol stack from the second network card. After layers of decapsulation and processing by the network protocol stack, the communication data is finally obtained.

[0081] The above only describes the communication between the local container and the virtual bridge deployed on the service node based on the current settings. Since other service nodes will perform the same configuration operations as the service node, they will also establish virtual network interface pairs between other target containers and the virtual bridge deployed on other service nodes. With the help of the virtual network established between the service nodes and other service nodes, communication between the local container and other target containers can be achieved. The following describes the communication between the local container and other target containers based on the settings of the service nodes and other service nodes:

[0082] The first type involves transmitting communication data from the local container to other target containers.

[0083] The local container sends communication data to the virtual network interface card (NIC) pair between itself and the virtual bridge, so that the data can be sent to the interface of the virtual NIC through the virtual NIC pair.

[0084] The secure network domain executor obtains communication data from the interface of the virtual network card;

[0085] The secure network domain executor transmits communication data to other secure network domain executors deployed on other service nodes via a virtual network, enabling other target containers to obtain communication data from the secure network domain executors and virtual network interface cards deployed on other service nodes and from the virtual network interface cards between other target containers.

[0086] Specifically, the local container encapsulates and processes the communication data through the network protocol stack, and then sends the communication data to the second network card, while the communication data flows out from the first network card;

[0087] One of the interfaces of the virtual bridge reads the communication data flowing out from the first network card. The virtual bridge copies the communication data to the other interfaces of the virtual bridge. The security network domain executor deployed on the service node reads the communication data from the other interfaces of the virtual bridge and sends it to the security network domain executor of other service nodes through the virtual network.

[0088] The secure network domain executor of other service nodes sends communication data to one of the interfaces of the virtual bridge deployed on other service nodes. The virtual bridge deployed on other service nodes copies the communication data to other interfaces. The first network interface card corresponding to the virtual bridge deployed on other service nodes obtains the communication data from one of the interfaces and then flows out through the second network interface card corresponding to the other target container deployed on other service nodes to the network protocol stack of the other target container. After layers of decapsulation and processing, the other target container obtains the communication data.

[0089] The second type involves transmitting communication data from other target containers to the local container.

[0090] The local container obtains communication data on the interface of the virtual network card through the virtual network card between the virtual network bridge and the virtual network card. The communication data on the interface of the virtual network card is obtained from the secure network domain executor deployed on the service node. The data obtained by the secure network domain executor is the data sent by other target containers through the secure network domain executor and virtual network card deployed on other service nodes to other target containers.

[0091] In other words, other target containers first encapsulate and process the communication data through the network protocol stack, and then send the communication data to the second network card corresponding to the other target containers and out through the first network card corresponding to the virtual bridge deployed on other service nodes;

[0092] One of the interfaces of the virtual bridge deployed on other service nodes that has a mapping relationship with the first network card reads the communication data flowing out of the first network card. The virtual bridge copies the communication data to the other interfaces of the virtual bridge. The security network domain executor deployed on other service nodes reads the communication data from the other interfaces of the virtual bridge and sends it to the security network domain executor of the service node through the virtual network.

[0093] The secure network domain executor of the service node sends communication data to one of the interfaces of the virtual bridge deployed on the service node. The virtual bridge deployed on the service node copies the communication data to other interfaces. The first network interface card corresponding to the virtual bridge deployed on the service node obtains the communication data from one of the interfaces and then flows out through the second network interface card corresponding to the local container deployed on the service node to the network protocol stack of the local container. After layers of decapsulation and processing, the local container obtains the communication data.

[0094] Step S50: When the local container communicates with other target containers based on virtual network interface cards and virtual networks, the communication data of the local container is encrypted and decrypted on the network protocol stack of the local container using the communication key of the secure network domain. The other target containers are containers deployed on other service nodes among at least two target containers.

[0095] To further strengthen the security of the communication environment between the local container and other target containers, this application isolates the local container from other target containers into a secure network domain. This minimizes network access and reduces the risk of core business containers being eavesdropped on or attacked. The application uses a secure network domain communication key to encrypt and decrypt the communication data of the local container. Furthermore, during the encapsulation and processing of communication data in the container's network protocol stack, this application encrypts and decrypts the communication data at the source, avoiding the security risks of proxy encryption and further ensuring the security of cross-node container communication.

[0096] Before explaining the encryption and decryption process, it is necessary to explain the origin of the encryption and decryption keys.

[0097] The configuration rules include encryption and decryption keys. After the service node parses the configuration rules, the secure network executor deployed on the service node stores the encryption and decryption keys in a map-based mapping table of network namespace IDs and encryption / decryption protocols / keys (referred to here as target mapping information). Target mapping information includes the local container's namespace address, the local container's network interface card (NIC) address, and the corresponding encryption and decryption keys for that NIC.

[0098] When a service node is running a container, the secure network executor deployed on the service node updates the map mapping table via system calls, adding the container's namespace to the target mapping information. When a container is destroyed, the executor removes the container's namespace from the target mapping information. This allows for the mapping between containers and their corresponding encryption and decryption keys.

[0099] Therefore, when the local container needs to perform encryption or decryption, it can simply read the encryption key and decryption key corresponding to the local container from the target mapping information.

[0100] Understandably, if the direction of communication data transmission is from the local container to other target containers, the local container needs to encrypt the communication data according to the encryption key in the communication key; conversely, if the direction of communication data transmission is from other target containers to the local container, the communication data is decrypted according to the encryption key in the communication key.

[0101] In an optional embodiment, such as Figure 5 As shown, Figure 5 An optional method embodiment for encrypting communication data based on an encryption key in a communication key, provided as an exemplary embodiment of this application, includes the following steps:

[0102] Step S501: Obtain the encryption key from the target mapping relationship information based on the namespace address and network card address of the local container. The target mapping relationship information includes the namespace address of the container, the network card address of the container, the encryption key corresponding to the namespace address and network card address, and the decryption key.

[0103] In step S502, during the encapsulation process of the data segment of the communication data on the network protocol stack of the local container, the data segment of the communication data is encrypted using an encryption key.

[0104] In an optional embodiment, such as Figure 6 As shown, Figure 6 An optional method embodiment for decrypting communication data based on a decryption key in a communication key, provided as an exemplary embodiment of this application, includes the following steps:

[0105] Step S601: Obtain the decryption key from the target mapping relationship information based on the namespace address and network card address of the local container;

[0106] In step S602, during the process of decrypting the data segment of the communication data on the network protocol stack of the local container, the data segment of the communication data is decrypted using a decryption key.

[0107] Since communication data within the local container needs to be encapsulated and processed by the local container's network protocol stack, the encryption and decryption process can be performed on the local container's network protocol stack. This application, by encrypting and decrypting communication data during the encapsulation and processing process within the container's network protocol stack, achieves data encryption and decryption at the source, thereby avoiding the security risks of proxy encryption and further ensuring the security of cross-node communication between containers.

[0108] The container communication method provided in this application addresses the rapidly increasing number of containers and container clusters, coupled with the growing complexity of container networks due to the use of multiple network interface cards (NICs), and the emerging security issues in inter-container network communication. This application provides a container communication method that obtains configuration rules from service nodes in the container cluster. Based on these rules, it creates virtual NIC pairs between the service node and the local container, as well as virtual networks between the service node and other service nodes. Then, it establishes a connection between the virtual bridge and the local container through the virtual NIC pairs. When the local container communicates with other target containers via the virtual NIC pairs and virtual networks, it encrypts and decrypts the communication data of the local container on its network protocol stack using a communication key from a secure network domain. The communication method provided in this application creates an isolated network environment when containers communicate across nodes by setting up virtual network interface cards and virtual networks. External networks cannot intercept or listen to the network traffic within this environment. In addition, when containers communicate in the isolated network environment, the communication data of the containers is encrypted and decrypted on the container's network protocol stack. By encrypting and decrypting the data at the source, the security risks of proxy encryption can be avoided, further ensuring the security of cross-node communication between containers. Moreover, all of the above improvements are unrelated to the application itself, which not only achieves the goal of saving resources but also enables the technical effect of this application to adapt to multiple application scenarios.

[0109] It should be noted that although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowchart may be performed in a different order.

[0110] Furthermore, combined with Figure 1 This application also provides a service node, which includes:

[0111] The security network domain controller retrieves configuration rules; these rules are used to instruct the building of a security network domain for at least two target containers, which are deployed on different service nodes.

[0112] The container executor is used to create virtual network interface pairs between the service node's virtual bridge and the local container based on configuration rules, and establish a connection between the virtual bridge and the local container through the virtual network interface pairs;

[0113] The container executor is also used to create a virtual network between service nodes and other service nodes based on configuration rules; other service nodes are service nodes corresponding to at least two target containers other than the local container, and the local container is the container deployed on the service node among at least two target containers;

[0114] The secure network domain executor is used to encrypt and decrypt the communication data of the local container on the network protocol stack of the local container by using the communication key of the secure network domain when the local container communicates with other target containers based on virtual network interface pairs and virtual networks. The other target containers are containers deployed on other service nodes among at least two target containers.

[0115] In an optional embodiment, a container executor is specifically used to parse configuration rules to obtain a network key;

[0116] The service node broadcasts data packets through its communication network card, and the data includes the network key;

[0117] Receive connection requests initiated by other service nodes via broadcast to the service node. The connection requests carry a connection key.

[0118] If the service node successfully verifies the connection key using the network key, a virtual network is established based on the connection between the service node and other service nodes.

[0119] In an optional embodiment, the container executor is further configured to parse configuration rules to obtain a unique identifier for the local container;

[0120] The local container is identified from the service node based on its unique identifier;

[0121] Create a virtual network interface pair between the virtual bridge and the local container.

[0122] In an optional embodiment, the container executor is further configured to set the first network interface card as a sub-device of the virtual bridge;

[0123] Set the namespace of the second network interface card to the namespace of the local container.

[0124] In an optional embodiment, the container executor is further configured to establish a mapping relationship between one of the interfaces in the virtual bridge and the first network interface card.

[0125] In an optional embodiment, the secure network domain executor is specifically used to obtain communication data from the interface of the virtual network interface card and transmit the communication data to the secure network domain executor deployed on other service nodes through the virtual network, so that other target containers can obtain communication data from the secure network domain executor deployed on other service nodes and the virtual network interface card between the virtual network interface card and other target containers.

[0126] In an optional embodiment, the container executor is further configured to encrypt the communication data on the network protocol stack of the local container according to the encryption key in the communication key if the transmission direction of the communication data is from the local container to other target containers.

[0127] If the direction of communication data transmission is from other target containers to the local container, then the communication data is decrypted on the network protocol stack of the local container according to the decryption key in the communication key.

[0128] In an optional embodiment, the container executor is further configured to obtain an encryption key from the target mapping relationship information based on the namespace address and network interface card address of the local container. The target mapping relationship information includes the namespace address of the local container, the network interface card address of the local container, and the encryption key and decryption key corresponding to the network interface card address of the local container.

[0129] During the encapsulation of the data segment of communication data on the local container's network protocol stack, the data segment of the communication data is encrypted using an encryption key.

[0130] In an optional embodiment, the container executor is further configured to obtain a decryption key from the target mapping relationship information;

[0131] During the decryption process of the data segment portion of the communication data on the local container's network protocol stack, the data segment portion of the communication data is decrypted using a decryption key.

[0132] In an optional embodiment, the secure network domain executor is further configured to, if the service node determines that the configuration rules have been updated, delete the virtual network interface card pair between the service node's virtual bridge and the local container according to the updated configuration rules, or create a new virtual network interface card pair for the virtual bridge.

[0133] In an optional embodiment, the secure network domain controller is further configured to process configuration rules into protocols that are converted into commands.

[0134] The following is for reference. Figure 7 It shows a schematic diagram of the structure of a computer system 700 suitable for implementing the service node of the embodiments of this application.

[0135] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0136] The following components are connected to I / O interface 707: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. Drive 710 is also connected to I / O interface 705 as needed. Removable media 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 710 as needed so that computer programs read from them can be installed into storage section 708 as needed.

[0137] In particular, according to embodiments of this disclosure, the above references Figure 2-6 The described process can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing instructions for performing... Figure 2-6 The program code for the method. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from the removable medium 711.

[0138] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0139] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be located in a processor; for example, a processor can be described as including XX unit, YY unit, and ZZ unit. The names of these units or modules do not necessarily limit the unit or module itself; for example, XX unit can also be described as "a unit for XX".

[0140] In another aspect, this application also provides a computer-readable storage medium, which may be a computer-readable storage medium included in the apparatus described in the above embodiments; or it may be a standalone computer-readable storage medium not assembled into a device. The computer-readable storage medium stores one or more programs, which are used by one or more processors to execute the formula input method described in this application.

[0141] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A communication method for a container, It is characterized in that Applied to a container cluster network, the container cluster network includes at least one container cluster, the container cluster includes at least one service node, at least one container and a virtual bridge are deployed on the service node, the method includes: The service node acquires a configuration rule; the configuration rule is used to indicate building a secure network domain for at least two target containers, and the at least two target containers are deployed on different service nodes; Creating a virtual network between the service node and other service nodes based on the configuration rule; the other service nodes are service nodes corresponding to other target containers other than the local container among the at least two target containers, and the local container is a container deployed on the service node among the at least two target containers; Creating a virtual network card pair between the virtual network bridge of the service node and the local container based on the configuration rule, and establishing a connection between the virtual network bridge and the local container through the virtual network card pair; When the local container performs network communication with the other target container based on the virtual network card pair and the virtual network, communication data of the local container is encrypted and decrypted on the network protocol stack of the local container by using the communication key of the secure network domain, and the other target container is a container deployed on the other service node among the at least two target containers; The step of establishing a virtual network between the service node and other service nodes based on the configuration rule and the communication network card of the service node includes: Parsing the configuration rules to obtain a network key; The service node broadcasts a data packet through a communication network card of the service node, wherein the data includes the network key; receiving a connection request initiated by another service node to the service node based on the broadcast, wherein the connection request carries a connection key; If the service node successfully verifies the connection key according to the network key, the virtual network is established based on the connection between the service node and the other service nodes.

2. The communication method according to claim 1, It is characterized in that The step of creating a virtual network card pair between the virtual network bridge of the service node and the local container based on the configuration rule includes: Parsing the configuration rule to obtain a unique identifier of the local container; Determine the local container from the service node according to the unique identifier of the local container; A virtual network card pair is created between the virtual network bridge and the local container.

3. The communication method according to claim 2, It is characterized in that The virtual network card pair includes a first network card and a second network card, the first network card and the second network card are in communication connection, and the connection between the virtual bridge and the local container is established through the virtual network card pair, including: Setting the first network card as a sub-device of the virtual network bridge; The namespace of the second network card is set to the namespace of the local container.

4. The communication method according to claim 3, It is characterized in that The step of setting the first network card as a sub-device of the virtual network bridge includes: A mapping relationship is established between one of the interfaces in the virtual network bridge and the first network card.

5. The communication method according to claim 1, It is characterized in that A secure network domain executor is also deployed on the service node, and the local container performs network communication with the other target containers based on the virtual network card and the virtual network, including: The local container sends the communication data to the virtual network card pair between the local container and the virtual network bridge, so as to send the communication data to the interface of the virtual network card through the virtual network card pair; The secure network domain executor obtains the communication data from the interface of the virtual network card; The secure network domain executor transmits the communication data to the secure network domain executor deployed on the other service node through the virtual network, so that the other target container obtains the communication data from the secure network domain executor deployed on the other service node and the virtual network card between the virtual network card and the other target container; or, The local container obtains the communication data on the interface of the virtual network card through the virtual network card pair between the local container and the virtual bridge. The communication data on the interface of the virtual network card is data obtained from the security network domain executor deployed on the service node. The data obtained by the security network domain executor is data sent by the other target container through the security network domain executor deployed on the other service node and the virtual network card pair between the virtual bridge and the other target container according to the virtual network.

6. The communication method according to claim 5, It is characterized in that The encrypting and decrypting the communication data of the local container by using the communication key of the secure network domain includes: If the transmission direction of the communication data is from the local container to the other target container, encrypting the communication data on the network protocol stack of the local container according to the encryption key in the communication key; If the transmission direction of the communication data is from the other target container to the local container, the communication data is decrypted on the network protocol stack of the local container according to the decryption key in the communication key.

7. The communication method according to claim 6, It is characterized in that The encrypting the communication data according to the encryption key in the communication key comprises: Obtaining the encryption key from target mapping relationship information according to the namespace address of the local container and the network card address of the local container, wherein the target mapping relationship information includes the namespace address of the container, the network card address of the container, and the encryption key and decryption key corresponding to the namespace address and the network card address of the container; In the process of encapsulating the data segment portion of the communication data on the network protocol stack of the local container, the data segment portion of the communication data is encrypted using the encryption key.

8. The communication method according to claim 7, It is characterized in that The decrypting the communication data according to the encryption key in the communication key comprises: Acquire the decryption key from the target mapping relationship information according to the namespace address of the local container and the network card address of the local container; In the process of decrypting the data segment portion of the communication data on the network protocol stack of the local container, the data segment portion of the communication data is decrypted using the decryption key.

9. The communication method according to claim 1, It is characterized in that The configuration rules are created through interface operation.

10. The communication method according to claim 1, It is characterized in that The method further comprises: If the service node determines that the configuration rule is updated, the virtual network card pair between the virtual network bridge of the service node and the local container is deleted according to the updated configuration rule, or a new virtual network card pair is established for the virtual network bridge.

11. The communication method according to claim 1, It is characterized in that The method further comprises: The configuration rules are converted into commands by protocol conversion.

12. A service node, It is characterized in that The service node includes: The security network domain controller obtains a configuration rule; the configuration rule is used to instruct to build a security network domain for at least two target containers, and the at least two target containers are deployed on different service nodes; A container executor, configured to create a virtual network card pair between the virtual network bridge of the service node and the local container based on the configuration rule, and establish a connection between the virtual network bridge and the local container through the virtual network card pair; The container executor is further used to create a virtual network between the service node and other service nodes based on the configuration rule; the other service nodes are service nodes corresponding to other target containers other than the local container in the at least two target containers, and the local container is a container deployed on the service node in the at least two target containers; a secure network domain executor, configured to encrypt and decrypt communication data of the local container on a network protocol stack of the local container using a communication key of the secure network domain when the local container performs network communication with the other target container based on the virtual network card pair and the virtual network, wherein the other target container is a container deployed on the other service node among the at least two target containers; The container executor is further used to parse the configuration rule and obtain the network key; The service node broadcasts a data packet through a communication network card of the service node, wherein the data includes the network key; receiving a connection request initiated by another service node to the service node based on the broadcast, wherein the connection request carries a connection key; If the service node successfully verifies the connection key according to the network key, the virtual network is established based on the connection between the service node and the other service nodes.

Citation Information

Patent Citations

  • Cross-regional container communication system and method, storage medium and computer equipment

    CN112637037A

  • Container communication method based on Kubernetes cluster

    CN115987778A

  • Interface for extending functionality of memory cards

    US20110314068A1

  • Systems and methods for managing autoscaled user space networking stack

    US20240103926A1