A method, system, device, equipment and medium for configuring a container address

By storing and binding the container address segment corresponding to the node in the address management plug-in, it solves the problem of frequently calling the SDN network when configuring the container address, improves the efficiency and immediacy of configuration, and meets the needs of large-scale cluster container creation or destruction. .

CN113766042BActive Publication Date: 2024-09-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202110075802.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-20
Publication Date
2024-09-20
Estimated Expiration
2041-01-20

AI Technical Summary

Technical Problem

In the existing technology, each time a container is created or destroyed, an SDN network needs to be configured. As a result, when a large number of containers are created or destroyed, the VPC cannot configure all container addresses at the first time, affecting performance.

Method used

By storing the container address segments corresponding to the nodes in the address management plug-in and binding them to the elastic network card, it avoids directly calling the SDN network during the container address configuration process and directly generates and outputs the container address configuration information.

Benefits of technology

It improves the efficiency of container address configuration, meets the immediate demand for container address configuration during the creation or destruction of large-scale cluster containers, and reduces dependence on SDN networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113766042B
    Figure CN113766042B
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, system, device, equipment and medium for configuring a container address. The method includes: when a container service plug-in receives a container address configuration request, obtaining the node identification information corresponding to the current node where the container service plug-in is located; sending the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates the container address configuration information, and sends the container address configuration information to the container service plug-in; wherein the address management plug-in stores the container address segments corresponding to at least one node, and each container address segment has been bound to the elastic network card in the corresponding node; outputting the container address configuration information received from the address management plug-in. The embodiment of the present invention improves the configuration efficiency of the container address.
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 cloud computing technology, and in particular to a method, system, device, equipment and medium for configuring a container address. Background Art

[0002] With the development and widespread popularity of Docker technology, cloud-native applications and container scheduling and management systems have also become hot words in the IT field. Kubernetes is a container scheduling and management system designed for production environments. It has native support for load balancing, service discovery, high availability, rolling upgrades, automatic scaling and other functional requirements of container cloud platforms. Since Kubernetes has 8 letters between K and s, it is often referred to as K8s.

[0003] A Node is registered on the VPC (Virtual Private Cloud) in the K8s network solution. The cni (Container Network Interface) plug-in in the Node calls the openAPI interface of the VPC to configure the SDN (Software Defined Network) of the VPC to notify the entire network of the IP address to be bound or unbound, thereby binding or unbinding the IP address of the container with the elastic network card in the Node.

[0004] In the process of implementing the present invention, it is found that there are at least the following technical problems in the prior art:

[0005] Each time a container is created or destroyed, the SDN network needs to be configured to bind or unbind the container IP address to the elastic network card in the node. However, due to the performance of the SDN network, when a large number of containers are created or destroyed, VPC cannot configure all container addresses in the first place. Summary of the invention

[0006] The embodiments of the present invention provide a method, system, device, equipment and medium for configuring a container address to solve the problem that an SDN network needs to be called once when configuring a container address, improve the configuration efficiency of the container address, and better meet the needs of creating or destroying large-scale cluster containers.

[0007] In a first aspect, an embodiment of the present invention provides a method for configuring a container address, the method comprising:

[0008] When the container service plug-in receives the container address configuration request, obtain the node identification information corresponding to the current node where the container service plug-in is located;

[0009] Sending the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates container address configuration information, and sends the container address configuration information to the container service plug-in; wherein the address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node;

[0010] The received container address configuration information sent by the address management plug-in is output.

[0011] In a second aspect, an embodiment of the present invention further provides a method for configuring a container address, the method comprising:

[0012] Receive a container address configuration request sent by a container service plug-in and node identification information corresponding to a current node where the container service plug-in is located;

[0013] Based on the container address configuration request and the node identification information, configure the container address segment corresponding to the current node to generate container address configuration information;

[0014] Sending the container address configuration information to the container service plug-in so that the container service plug-in outputs the container address configuration information;

[0015] The address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node.

[0016] In a third aspect, an embodiment of the present invention further provides a system for configuring a container address, the system comprising: a Master node device and at least one Node node device;

[0017] The Node node device is used to obtain the node identification information corresponding to the current node where the container service plug-in is located when the installed container service plug-in receives a container address configuration request, send the container address configuration request and the node identification information to the address management plug-in, and output the received container address configuration information sent by the address management plug-in;

[0018] The Master node device is used to receive the container address configuration request and the node identification information through the installed address management plug-in, configure the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generate container address configuration information, and send the container address configuration information to the container service plug-in;

[0019] The address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node.

[0020] In a fourth aspect, an embodiment of the present invention further provides a device for configuring a container address, the device comprising:

[0021] A container address configuration request receiving module, configured to obtain node identification information corresponding to the current node where the container service plug-in is located when the container service plug-in receives the container address configuration request;

[0022] A container address configuration request sending module, used to send the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates container address configuration information, and sends the container address configuration information to the container service plug-in; wherein the address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node;

[0023] The container address configuration information output module is used to output the received container address configuration information sent by the address management plug-in.

[0024] In a fifth aspect, an embodiment of the present invention further provides a device for configuring a container address, the device comprising:

[0025] A container address configuration request receiving module, used to receive a container address configuration request sent by a container service plug-in and node identification information corresponding to a current node where the container service plug-in is located;

[0026] A container address configuration information generation module, configured to configure the container address segment corresponding to the current node based on the container address configuration request and the node identification information, and generate container address configuration information;

[0027] A container address configuration information sending module, used to send the container address configuration information to the container service plug-in, so that the container service plug-in outputs the container address configuration information;

[0028] The address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node.

[0029] In a sixth aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0030] one or more processors;

[0031] A memory for storing one or more programs;

[0032] When the one or more programs are executed by the one or more processors, the one or more processors implement any of the container address configuration methods mentioned above.

[0033] In a seventh aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute any of the container address configuration methods mentioned above.

[0034] The embodiments of the above invention have the following advantages or beneficial effects:

[0035] The embodiment of the present invention stores container address segments corresponding to at least one node in the address management plug-in, and each container address segment has been bound to the elastic network card in the corresponding node, so that there is no need to configure the SDN network during the container address configuration process, which solves the problem that the SDN network needs to be configured once for each container address configuration, improves the configuration efficiency of the container address, and better meets the immediacy requirements of the container address configuration in the large-scale cluster container creation or destruction process. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 This is a flowchart of a method for configuring a container address provided in Embodiment 1 of the present invention.

[0037] Figure 2 It is a structural diagram of a container scheduling management system provided in Example 1 of the present invention.

[0038] Figure 3 This is a flowchart of a method for configuring a container address provided in Embodiment 2 of the present invention.

[0039] Figure 4 It is a flowchart of a specific example of a method for configuring a container address provided in the second embodiment of the present invention.

[0040] Figure 5 This is a flowchart of a method for configuring a container address provided in Embodiment 3 of the present invention.

[0041] Figure 6 It is a structural diagram of a container address configuration system provided by Embodiment 4 of the present invention.

[0042] Figure 7 It is a schematic diagram of a container address configuration device provided in Embodiment 5 of the present invention.

[0043] Figure 8It is a schematic diagram of a container address configuration device provided in Embodiment 6 of the present invention.

[0044] Fig. 9 It is a structural schematic diagram of an electronic device provided in Embodiment 7 of the present invention. DETAILED DESCRIPTION

[0045] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0046] Embodiment 1

[0047] Figure 1 This is a flowchart of a method for configuring a container address provided in the first embodiment of the present invention. This embodiment is applicable to the case of configuring a container in a container scheduling management system, and is particularly applicable to the case of creating or destroying a container based on a Kubernetes system. The method can be executed by a container address configuration device, which can be implemented in software and / or hardware, and can be configured on a terminal device. Specifically, it includes the following steps:

[0048] S110: When the container service plug-in receives the container address configuration request, the node identification information corresponding to the current node where the container service plug-in is located is obtained.

[0049] CNI (Container Network Interface) is a standardized protocol for providing network definition specifications for container scheduling and management systems. The CNI protocol mainly defines two types of plug-ins, namely the container network plug-in (cni plug-in) and the address management plug-in (IPAM plug-in). This embodiment defines a container service plug-in (cniserver plug-in) based on the CNI protocol, which is mainly used to implement the binding of the container address segment with the elastic network card in the node.

[0050] In this embodiment, the container service plug-in is a plug-in defined based on the Node node corresponding to the K8s system, and the address management plug-in is a plug-in defined based on the master node corresponding to the K8s system. Node nodes and master nodes are used to describe the two cloud hosts that the K8s system is deployed to run in the cluster. Cloud hosts can also be called resources, usually virtual machines. Among them, the master node is used to coordinate and schedule at least one Node node in the cluster.

[0051] It should be noted that the nodes in this embodiment all represent Node nodes. Specifically, since the container service plug-in is a plug-in defined in the Node node, the node identification information corresponding to the current node is the node identification information of the Node node where the container service plug-in is located. Exemplarily, assuming that the current node is Node node A, the node identification information is NodeA, and assuming that the current node is Node node B, the node identification information is NodeB. The specific identification form of the node identification information is not limited here.

[0052] In one embodiment, optionally, the container address configuration request includes a container address creation request or a container address destruction request.

[0053] S120. Send the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates the container address configuration information, and sends the container address configuration information to the container service plug-in.

[0054] In this embodiment, the address management plug-in stores container address segments corresponding to at least one node, and each container address segment has been bound to an elastic network card in the corresponding node.

[0055] Specifically, the address management plug-in is a plug-in for managing container addresses. The address management plug-in stores at least one container address segment (IPRange) corresponding to each Node node. Exemplarily, the container address segment includes at least one container address. For example, the container address segment corresponding to Node node A includes container address 1, container address 2, and container address 3, and the container address segment corresponding to Node node B includes container address 4 and container address 5. Specifically, the number of container addresses in the container address segment corresponding to each Node node can be the same or different.

[0056] Among them, the elastic network interface (ENI) is a pluggable dynamic network card on the Node. Specifically, the container address of the container is bound to the elastic network card, and the elastic network card is used to provide network services for the container. Exemplarily, an elastic network card can be bound to at least one container address segment.

[0057] Figure 2It is a structural diagram of a container scheduling and management system provided in the first embodiment of the present invention. Specifically, subnet1, subnet2 and subnet3 are virtual subnets defined in VPC, wherein subnet1 represents the virtual subnet corresponding to Node A and Node B, and subnet2 and subnet3 represent the virtual subnet corresponding to the pod in the Node. Among them, pod is a container group consisting of a group of tightly coupled containers. Exemplarily, a container can represent a single process model. Taking NodeB as an example, IPRange1 and IPRange2 with a black background represent two container address segments bound to eni0 (elastic network card) in NodeB, IPRange1 with a white background represents the container address segment bound to eni1 (elastic network card) in NodeB, and eth0 represents the network card corresponding to NodeB. Users can log in to NodeB by accessing the network card.

[0058] S130: Output the received container address configuration information sent by the address management plug-in.

[0059] Exemplarily, the container service plug-in outputs the container address configuration information so that the plug-in that receives the container address configuration information continues to execute subsequent container creation or container destruction processes.

[0060] In one embodiment, optionally, the container address configuration request includes a container address creation request sent by a container network plug-in, and accordingly, the container address configuration information received from the address management plug-in is output, including: sending the address creation success information and the target container address in the received container address configuration information to the container network plug-in; wherein the target container address is a container address with a configuration state of unallocated selected by the address management plug-in from the container address segment corresponding to the current node.

[0061] In one embodiment, optionally, the container address configuration request includes a container address destruction request sent by a container network plug-in, and accordingly, the container address configuration information received from the address management plug-in is output, including: sending address destruction success information in the received container address configuration information to the container network plug-in; wherein the address destruction success information is generated when the address management plug-in modifies the configuration status of the container address in the container address destruction request to an unallocated status.

[0062] Among them, illustratively, the container network plug-in can be used to set the container address for the container. Specifically, the container network plug-in includes a container add interface (addNetwork) and a container delete interface (delNetwork). Specifically, the container scheduling management system sends a container address creation request or a container address destruction request by calling the container add interface or the container delete interface in the container network plug-in.

[0063] The technical solution of this embodiment stores the container address segments corresponding to at least one node in the address management plug-in, and each container address segment has been bound to the elastic network card in the corresponding node, so that there is no need to configure the SDN network during the container address configuration process, which solves the problem that the SDN network needs to be configured once for each container address configuration, improves the configuration efficiency of the container address, and better meets the immediacy requirements of the container address configuration in the large-scale cluster container creation or destruction process.

[0064] Embodiment 2

[0065] Figure 3 It is a flow chart of a method for configuring a container address provided in the second embodiment of the present invention. The technical solution of this embodiment is a further refinement based on the above embodiment. Optionally, the method also includes: obtaining a configuration file pre-registered in the current node where the container service plug-in is located; wherein the configuration file includes the gateway address of at least one elastic network card in the current node and the container address segments corresponding to each of the elastic network cards; for each of the elastic network cards, calling the publishing interface of the virtual private cloud to bind the container address segment corresponding to the elastic network card with the gateway address of the elastic network card; after the binding is completed, the container address segments corresponding to each of the elastic network cards are stored in the address management plug-in.

[0066] The specific implementation steps of this embodiment include:

[0067] S210: Obtain a configuration file pre-registered in the current node where the container service plug-in is located.

[0068] In this embodiment, the configuration file includes the gateway address of at least one elastic network card in the current node and the container address segments corresponding to each elastic network card.

[0069] In one embodiment, optionally, the method also includes: when the container service plug-in is initialized, generating a configuration file based on the network card identification information, gateway address and container address segment corresponding to at least one elastic network card input by the user, and registering the configuration file to the current node where the container service plug-in is located.

[0070] Specifically, a Node node can correspond to at least one elastic network card, and the configuration file contains the network card identification information, gateway address and container address segment corresponding to each elastic network card. The network card identification information is used to distinguish the elastic network cards. For example, the network card identification information corresponding to elastic network card A is 10.1.1.0 / 21, the gateway address is 10.1.1.1, and the container address segment includes 10.1.1.0 / 26 and 10.1.1.64 / 26.

[0071] S220: For each elastic network card, call the publishing interface of the virtual private cloud to bind the container address segment corresponding to the elastic network card to the gateway address of the elastic network card.

[0072] Specifically, the container service plug-in calls the publishing interface (openAPI) of the virtual private cloud VPC based on each elastic network card in the configuration file, so that the VPC configures the SDN network to notify the entire network of the container address segment bound to the elastic network card, and realizes the binding of the gateway address of the elastic network card with the container address segment. In other words, for each elastic network card, the container service plug-in only needs to call the openAPI interface once to realize the binding of multiple container addresses with the elastic network card.

[0073] S230: After the binding is completed, the container address segment corresponding to each elastic network card is stored in the address management plug-in.

[0074] Exemplarily, the container address segment corresponding to the elastic network card is written into the IP pool in the address management plug-in, wherein the IP pool can be a database component.

[0075] S240: When the container service plug-in receives the container address configuration request, the node identification information corresponding to the current node where the container service plug-in is located is obtained.

[0076] S250. Send the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates the container address configuration information, and sends the container address configuration information to the container service plug-in.

[0077] S260: Output the received container address configuration information sent by the address management plug-in.

[0078] Figure 4It is a flowchart of a specific example of a method for configuring a container address provided in the second embodiment of the present invention. Specifically, when the cniserver plug-in (container service plug-in) is initialized (init), based on the configuration file in the current node, the openAPI interface is called to bind the IPRange (container address segment) in the configuration file to the elastic network card in the current node to complete the full network notification. At least one container address in the IPRange in the configuration file is written to the IP pool in the IPAM plug-in (address management plug-in) for storage. Among them, exemplarily, the IP pool can be a database component corresponding to the IPAM plug-in.

[0079] During the process of container creation or destruction, the container scheduling and management system sends a container address creation request or a container address destruction request by calling the container addition interface (addNetwork) or container deletion interface (delNetwork) in the cni plug-in (container network plug-in). Among them, the container address creation request is used to apply for the creation of a container address and configuration of a route, and the container address deletion request is used to apply for the release of a container address and deletion of a route. The cniserver plug-in sends the node identification information of the current node and the container address configuration request to the IPAM plug-in. Based on the container address configuration request and the node identification information, the IPAM plug-in configures the container address segment corresponding to the current node, generates the container address configuration information, and sends the container address configuration information to the cniserver plug-in. The cniserver plug-in sends the container address configuration information to the cni plug-in to complete the creation or destruction of the container address.

[0080] The technical solution of this embodiment adds a configuration file registration process to the container service plug-in initialization process, and implements the binding between the container address segment and the elastic network card based on the container address segment and gateway address in the configuration file, and stores the container address segment after binding in the address management plug-in, which solves the problem of pre-binding of the container address segment and improves the configuration efficiency of the container address. In addition, this solution proposes to bind the container address segment based on the configuration file. The user can modify the input container address segment, or input the network card identification information, gateway address and container address segment corresponding to the new elastic network card. After the container service plug-in is restarted, the dynamic expansion, dynamic reduction or dynamic modification of the container address segment can be completed, or the elastic network card corresponding to the Node node can be dynamically expanded.

[0081] Embodiment 3

[0082] Figure 5This is a flowchart of a method for configuring a container address provided in the third embodiment of the present invention. This embodiment can be applied to the case of configuring a container in a container scheduling management system, and is particularly applicable to the case of creating or destroying a container based on a Kubernetes system. The method can be executed by a container address configuration device, which can be implemented in software and / or hardware, and can be configured on a terminal device. Specifically, it includes the following steps:

[0083] S310: Receive a container address configuration request sent by a container service plug-in and node identification information corresponding to a current node where the container service plug-in is located.

[0084] CNI (Container Network Interface) is a standardized protocol for providing network definition specifications for container scheduling and management systems. The CNI protocol mainly defines two types of plug-ins, namely the container network plug-in (cni plug-in) and the address management plug-in (IPAM plug-in). This embodiment defines a container service plug-in (cniserver plug-in) based on the CNI protocol, which is mainly used to implement the binding of the container address segment with the elastic network card in the node.

[0085] In this embodiment, the container service plug-in is a plug-in defined based on the Node node corresponding to the K8s system, and the address management plug-in is a plug-in defined based on the master node corresponding to the K8s system. Node nodes and master nodes are used to describe the two types of hosts deployed to the cluster by the K8s system. The host can also be called a resource, usually a virtual machine. Among them, the master node is used to coordinate and schedule at least one Node node in the cluster.

[0086] It should be noted that the nodes in this embodiment all represent Node nodes. Specifically, since the container service plug-in is a plug-in defined in the Node node, the node identification information corresponding to the current node is the node identification information of the Node node where the container service plug-in is located. Exemplarily, assuming that the current node is Node node A, the node identification information is NodeA, and assuming that the current node is Node node B, the node identification information is NodeB. The specific identification form of the node identification information is not limited here.

[0087] In one embodiment, optionally, the container address configuration request includes a container address creation request or a container address destruction request.

[0088] S320: Based on the container address configuration request and the node identification information, configure the container address segment corresponding to the current node to generate container address configuration information.

[0089] In one embodiment, optionally, based on the container address configuration request and the node identification information, the container address segment corresponding to the current node is configured to generate the container address configuration information, including: when the container address configuration request is a container address creation request, obtaining the container address segment corresponding to the node identification information, and selecting a container address in the container address segment whose configuration state is an unallocated state as the target container address; modifying the configuration state of the target container address to an allocated state, generating address creation success information, and generating the container address configuration information based on the target container address and the address creation success information.

[0090] In one embodiment, optionally, based on the container address configuration request and the node identification information, the container address segment corresponding to the current node is configured to generate the container address configuration information, including: when the container address configuration request is a container address destruction request, obtaining the container address segment corresponding to the node identification information; modifying the configuration state of the container address in the container address segment corresponding to the destroyed container address in the container address destruction request to an unallocated state, generating address destruction success information, and generating the container address configuration information based on the address destruction success information.

[0091] Specifically, the obtained container address segment is the container address segment that has been bound to the elastic network card. After selecting the target container address or modifying the configuration status of the container address, there is no need to execute the openAPI interface step of calling VPC. You only need to send the container address configuration information to the container service plug-in.

[0092] S330: Send the container address configuration information to the container service plug-in, so that the container service plug-in outputs the container address configuration information.

[0093] In this embodiment, the address management plug-in stores container address segments corresponding to at least one node, and each container address segment has been bound to an elastic network card in the corresponding node.

[0094] Specifically, the address management plug-in is a plug-in for managing container addresses. The address management plug-in stores at least one container address segment (IPRange) corresponding to each Node node. Exemplarily, the container address segment includes at least one container address. For example, the container address segment corresponding to Node node A includes container address 1, container address 2, and container address 3, and the container address segment corresponding to Node node B includes container address 4 and container address 5. Specifically, the number of container addresses in the container address segment corresponding to each Node node can be the same or different.

[0095] Among them, the elastic network interface (ENI) is a pluggable dynamic network card on the Node. Specifically, the container address of the container is bound to the elastic network card, and the elastic network card is used to provide network services for the container. Exemplarily, an elastic network card can be bound to at least one container address segment.

[0096] The technical solution of this embodiment stores the container address segments corresponding to at least one node in the address management plug-in, and each container address segment has been bound to the elastic network card in the corresponding node, so that there is no need to configure the SDN network during the container address configuration process, which solves the problem that the SDN network needs to be configured once for each container address configuration, improves the configuration efficiency of the container address, and better meets the immediacy requirements of the container address configuration in the large-scale cluster container creation or destruction process.

[0097] Embodiment 4

[0098] Figure 6 This is a schematic diagram of the structure of a container address configuration system provided by Embodiment 4 of the present invention. This embodiment of the present invention provides services for the container address configuration method of the above embodiment of the present invention, and can configure the container address configuration device provided by the present invention.

[0099] The container address configuration system includes: a Master node device 410 and at least one Node node device 420, wherein the Node node device 420 is used to obtain the node identification information corresponding to the current node where the container service plug-in is located when the installed container service plug-in receives a container address configuration request, send the container address configuration request and the node identification information to the address management plug-in, and output the container address configuration information sent by the received address management plug-in; the Master node device 410 is used to receive the container address configuration request and the node identification information through the installed address management plug-in, configure the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generate the container address configuration information, and send the container address configuration information to the container service plug-in; wherein the address management plug-in stores the container address segments corresponding to at least one node respectively, and each container address segment has been bound to the elastic network card in the corresponding node.

[0100] CNI (Container Network Interface) is a standardized protocol for providing network definition specifications for container scheduling and management systems. The CNI protocol mainly defines two types of plug-ins, namely the container network plug-in (cni plug-in) and the address management plug-in (IPAM plug-in). This embodiment defines a container service plug-in based on the CNI protocol, which is mainly used to implement the binding of the container address segment with the elastic network card in the node.

[0101] In this embodiment, the container service plug-in is a plug-in defined based on the Node node corresponding to the K8s system, and the address management plug-in is a plug-in defined based on the master node corresponding to the K8s system. Node nodes and master nodes are used to describe the two hosts that the K8s system is deployed to run in the cluster. The host can also be called a resource, usually a virtual machine. Among them, the master node is used to coordinate and schedule at least one Node node in the cluster. The Node node and the master node can be deployed in the Node node device 420 and the Master node device 410 respectively.

[0102] It should be noted that the nodes in this embodiment all represent Node nodes. Specifically, since the container service plug-in is a plug-in defined in the Node node, the node identification information corresponding to the current node is the node identification information of the Node node where the container service plug-in is located. Exemplarily, assuming that the current node is Node node A, the node identification information is NodeA, and assuming that the current node is Node node B, the node identification information is NodeB. The specific identification form of the node identification information is not limited here.

[0103] In one embodiment, optionally, the container address configuration request includes a container address creation request or a container address destruction request.

[0104] In this embodiment, the address management plug-in stores container address segments corresponding to at least one node, and each container address segment has been bound to an elastic network card in the corresponding node.

[0105] Specifically, the address management plug-in is a plug-in for managing container addresses. The address management plug-in stores at least one container address segment (IPRange) corresponding to each Node node. Exemplarily, the container address segment includes at least one container address. For example, the container address segment corresponding to Node node A includes container address 1, container address 2, and container address 3, and the container address segment corresponding to Node node B includes container address 4 and container address 5. Specifically, the number of container addresses in the container address segment corresponding to each Node node can be the same or different.

[0106] Among them, the elastic network interface (ENI) is a pluggable dynamic network card on the Node. Specifically, the container address of the container is bound to the elastic network card, and the elastic network card is used to provide network services for the container. Exemplarily, an elastic network card can be bound to at least one container address segment.

[0107] In one embodiment, optionally, the container service plug-in is also used to: obtain a configuration file pre-registered in the current node where the container service plug-in is located; wherein the configuration file includes the gateway address of at least one elastic network card in the current node and the container address segments corresponding to each elastic network card; for each elastic network card, call the publishing interface of the virtual private cloud to bind the container address segment corresponding to the elastic network card to the gateway address of the elastic network card; after the binding is completed, store the container address segments corresponding to each elastic network card in the address management plug-in.

[0108] In one embodiment, optionally, the Node device 420 is also installed with a container interface plug-in, which is used to: receive a container address configuration request input by a user, send the container address configuration request to the container service plug-in, and receive the container address configuration information sent by the container service plug-in.

[0109] Specifically, if the container address configuration request is a container address creation request, the container address configuration information includes address creation success information and a target container address sent to the container network plug-in; wherein the target container address is a container address selected by the address management plug-in from the container address segment corresponding to the current node and configured in an unallocated state. If the container address configuration request is a container address destruction request, the container address configuration information includes address destruction success information, wherein the address destruction success information is generated when the address management plug-in modifies the configuration state of the container address in the container address destruction request to an unallocated state.

[0110] The technical solution of this embodiment stores the container address segments corresponding to at least one node in the address management plug-in, and each container address segment has been bound to the elastic network card in the corresponding node, so that there is no need to configure the SDN network during the container address configuration process, which solves the problem that the SDN network needs to be configured once for each container address configuration, improves the configuration efficiency of the container address, and better meets the immediacy requirements of the container address configuration in the large-scale cluster container creation or destruction process.

[0111] Embodiment 5

[0112] Figure 7 It is a schematic diagram of a container address configuration device provided in Embodiment 5 of the present invention. This embodiment can be applicable to the case where containers are configured in a container scheduling and management system, and is particularly applicable to the case where containers are created or destroyed based on a Kubernetes system. The device can be implemented in software and / or hardware, and the device can be configured in a terminal device. The container address configuration device includes: a container address configuration request receiving module 510, a container address configuration request sending module 520, and a container address configuration information output module 530.

[0113] The container address configuration request receiving module 510 is used to obtain the node identification information corresponding to the current node where the container service plug-in is located when the container service plug-in receives the container address configuration request;

[0114] The container address configuration request sending module 520 is used to send the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates the container address configuration information, and sends the container address configuration information to the container service plug-in; wherein the address management plug-in stores the container address segments corresponding to at least one node, and each container address segment has been bound to the elastic network card in the corresponding node;

[0115] The container address configuration information output module 530 is used to output the received container address configuration information sent by the address management plug-in.

[0116] The technical solution of this embodiment stores the container address segments corresponding to at least one node in the address management plug-in, and each container address segment has been bound to the elastic network card in the corresponding node, so that there is no need to configure the SDN network during the container address configuration process, which solves the problem that the SDN network needs to be configured once for each container address configuration, improves the configuration efficiency of the container address, and better meets the immediacy requirements of the container address configuration in the large-scale cluster container creation or destruction process.

[0117] On the basis of the above technical solution, optionally, the device further includes:

[0118] A configuration file acquisition module is used to acquire a configuration file pre-registered in the current node where the container service plug-in is located; wherein the configuration file includes the gateway address of at least one elastic network card in the current node and the container address segments corresponding to each elastic network card;

[0119] The container address segment binding module is used to call the publishing interface of the virtual private cloud for each elastic network card, so as to bind the container address segment corresponding to the elastic network card with the gateway address of the elastic network card;

[0120] The container address segment storage module is used to store the container address segments corresponding to each elastic network card in the address management plug-in after the binding is completed.

[0121] On the basis of the above technical solution, optionally, the device further includes:

[0122] The configuration file registration module is used to generate a configuration file based on the network card identification information, gateway address and container address segment corresponding to at least one elastic network card input by the user when the container service plug-in is initialized, and register the configuration file to the current node where the container service plug-in is located.

[0123] Based on the above technical solution, optionally, the container address configuration request includes a container address creation request sent by the container network plug-in, and the container address configuration information output module 530 is specifically used to:

[0124] The address creation success information and the target container address in the received container address configuration information are sent to the container network plug-in; wherein the target container address is a container address in an unallocated state selected by the address management plug-in from the container address segment corresponding to the current node.

[0125] Based on the above technical solution, optionally, the container address configuration request includes a container address destruction request sent by the container network plug-in, and the container address configuration information output module 530 is specifically used to:

[0126] Sending the address destruction success information in the received container address configuration information to the container network plug-in; wherein the address destruction success information is generated when the address management plug-in modifies the configuration state of the container address in the container address destruction request to an unassigned state.

[0127] Embodiment 6

[0128] Figure 8 It is a schematic diagram of a container address configuration device provided in Embodiment 6 of the present invention. This embodiment can be applicable to the case where containers are configured in a container scheduling and management system, and is particularly applicable to the case where containers are created or destroyed based on a Kubernetes system. The device can be implemented in software and / or hardware, and the device can be configured in a terminal device. The container address configuration device includes: a container address configuration request receiving module 610, a container address configuration information generating module 620, and a container address configuration information sending module 630.

[0129] The container address configuration request receiving module 610 is used to receive the container address configuration request sent by the container service plug-in and the node identification information corresponding to the current node where the container service plug-in is located;

[0130] The container address configuration information generation module 620 is used to configure the container address segment corresponding to the current node based on the container address configuration request and the node identification information to generate the container address configuration information;

[0131] The container address configuration information sending module 630 is used to send the container address configuration information to the container service plug-in so that the container service plug-in outputs the container address configuration information;

[0132] The address management plug-in stores container address segments corresponding to at least one node, and each container address segment has been bound to an elastic network card in the corresponding node.

[0133] The technical solution of this embodiment stores container address segments corresponding to at least one node in the address management plug-in, and each container address segment has been bound to the elastic network card in the corresponding node, so that there is no need to configure the SDN network during the container address configuration process, which solves the problem that the SDN network needs to be configured once for each container address configuration, improves the configuration efficiency of the container address, and better meets the immediacy requirements of the container address configuration in the large-scale cluster container creation or destruction process.

[0134] Based on the above technical solution, optionally, the container address configuration information generation module 620 is specifically used to:

[0135] When the container address configuration request is a container address creation request, a container address segment corresponding to the node identification information is obtained, and a container address in the container address segment whose configuration state is unassigned is selected as the target container address;

[0136] The configuration state of the target container address is modified to an allocated state, address creation success information is generated, and container address configuration information is generated based on the target container address and the address creation success information.

[0137] Based on the above technical solution, optionally, the container address configuration information generation module 620 is specifically used to:

[0138] When the container address configuration request is a container address destruction request, obtaining a container address segment corresponding to the node identification information;

[0139] The configuration state of the container address in the container address segment corresponding to the container address to be destroyed in the container address destruction request is modified to an unallocated state, address destruction success information is generated, and container address configuration information is generated based on the address destruction success information.

[0140] The container address configuration device provided in the embodiment of the present invention can be used to execute the container address configuration method provided in the embodiment of the present invention, and has the corresponding functions and beneficial effects of the execution method.

[0141] It is worth noting that in the embodiment of the above-mentioned container address configuration device, the various units and components included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0142] Embodiment 7

[0143] Fig. 9 It is a structural diagram of an electronic device provided by Embodiment 7 of the present invention. The embodiment of the present invention provides services for the implementation of the configuration method of the container address of Embodiments 1 to 2 or 3 of the present invention, and can configure the configuration device of the container address in Embodiment 5 or 6. Fig. 9 A block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention is shown. Fig. 9 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0144] like Fig. 9 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0145] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. These architectures include, by way of example, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0146] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0147] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Fig. 9 not shown, usually called a "hard drive"). Although Fig. 9 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program components that are configured to perform the functions of the various embodiments of the present invention.

[0148] A program / utility 40 having a set (at least one) of program components 42 may be stored, for example, in the memory 28, such program components 42 including, but not limited to, an operating system, one or more application programs, other program components, and program data, each of which or some combination may include an implementation of a network environment. The program components 42 generally perform the functions and / or methods of the embodiments described herein.

[0149] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the electronic device 12, and / or any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed through an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter 20. Fig. 9 As shown, the network adapter 20 communicates with other components of the electronic device 12 via the bus 18. It should be understood that, although not shown in the figure, other hardware and / or software components can be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0150] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the container address configuration method provided in the embodiment of the present invention.

[0151] Embodiment 8

[0152] Embodiment 8 of the present invention further provides a storage medium including computer executable instructions. When the computer executable instructions are executed by a computer processor, they are used to execute a method for configuring a container address. The method includes:

[0153] When the container service plug-in receives the container address configuration request, it obtains the node identification information corresponding to the current node where the container service plug-in is located;

[0154] Sending the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates the container address configuration information, and sends the container address configuration information to the container service plug-in; wherein the address management plug-in stores the container address segments corresponding to at least one node, and each container address segment has been bound to the elastic network card in the corresponding node;

[0155] Output the container address configuration information received from the address management plug-in.

[0156] Alternatively, the computer executable instructions are used to perform a method for configuring a container address when executed by a computer processor, the method comprising:

[0157] Receive the container address configuration request sent by the container service plug-in and the node identification information corresponding to the current node where the container service plug-in is located;

[0158] Based on the container address configuration request and the node identification information, configure the container address segment corresponding to the current node to generate container address configuration information;

[0159] Sending the container address configuration information to the container service plug-in so that the container service plug-in outputs the container address configuration information;

[0160] The address management plug-in stores container address segments corresponding to at least one node, and each container address segment has been bound to an elastic network card in the corresponding node.

[0161] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, 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 above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.

[0162] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0163] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0164] Computer program code for performing the operation of the present invention may be written in one or more programming languages ​​or combinations thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0165] Of course, the computer executable instructions of a storage medium including computer executable instructions provided in an embodiment of the present invention are not limited to the above method operations, and can also execute related operations in the container address configuration method provided in any embodiment of the present invention.

[0166] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for configuring a container address, characterized in that: include: When the container service plug-in receives the container address configuration request, obtain the node identification information corresponding to the current node where the container service plug-in is located; Send the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates container address configuration information, and sends the container address configuration information to the container service plug-in; wherein the address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node, the container address segment belongs to a virtual subnet defined in a private cloud network, and the elastic network card is a pluggable dynamic network card on the corresponding node; The received container address configuration information sent by the address management plug-in is output.

2. The method according to claim 1, characterized in that: The method further comprises: Obtain a configuration file pre-registered in the current node where the container service plug-in is located; wherein the configuration file includes a gateway address of at least one elastic network card in the current node and a container address segment corresponding to each of the elastic network cards; For each of the elastic network cards, calling the publishing interface of the virtual private cloud to bind the container address segment corresponding to the elastic network card to the gateway address of the elastic network card; After the binding is completed, the container address segment corresponding to each elastic network card is stored in the address management plug-in.

3. The method according to claim 2, characterized in that The method further comprises: When the container service plug-in is initialized, a configuration file is generated based on the network card identification information, gateway address and container address segment corresponding to at least one elastic network card input by the user, and the configuration file is registered in the current node where the container service plug-in is located.

4. The method according to claim 1, characterized in that: The container address configuration request includes a container address creation request sent by a container network plug-in. Accordingly, outputting the received container address configuration information sent by the address management plug-in includes: Sending the address creation success information and the target container address in the received container address configuration information to the container network plug-in; wherein the target container address is a container address selected by the address management plug-in from the container address segment corresponding to the current node and having a configuration state of unallocated.

5. The method according to claim 1, characterized in that The container address configuration request includes a container address destruction request sent by a container network plug-in. Accordingly, outputting the received container address configuration information sent by the address management plug-in includes: Sending the address destruction success information in the received container address configuration information to the container network plug-in; wherein the address destruction success information is generated when the address management plug-in modifies the configuration state of the container address in the container address destruction request to an unallocated state.

6. A method for configuring a container address, characterized in that: include: Receive a container address configuration request sent by a container service plug-in and node identification information corresponding to a current node where the container service plug-in is located; Based on the container address configuration request and the node identification information, configure the container address segment corresponding to the current node to generate container address configuration information; Sending the container address configuration information to the container service plug-in so that the container service plug-in outputs the container address configuration information; Among them, the address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node. The container address segment belongs to a virtual subnet defined in the private cloud network, and the elastic network card is a pluggable dynamic network card on the corresponding node.

7. The method according to claim 6, characterized in that The configuring the container address segment corresponding to the current node based on the container address configuration request and the node identification information to generate the container address configuration information includes: When the container address configuration request is a container address creation request, obtaining a container address segment corresponding to the node identification information, and selecting a container address in the container address segment whose configuration state is unallocated as a target container address; The configuration state of the target container address is modified to an allocated state, address creation success information is generated, and container address configuration information is generated based on the target container address and the address creation success information.

8. The method according to claim 6, characterized in that The configuring the container address segment corresponding to the current node based on the container address configuration request and the node identification information to generate the container address configuration information includes: When the container address configuration request is a container address destruction request, obtaining a container address segment corresponding to the node identification information; The configuration state of the container address in the container address segment corresponding to the container address to be destroyed in the container address destruction request is modified to an unallocated state, address destruction success information is generated, and container address configuration information is generated based on the address destruction success information.

9. A container address configuration system, characterized in that: include: Master node device and at least one Node node device; The Node node device is used to obtain the node identification information corresponding to the current node where the container service plug-in is located when the installed container service plug-in receives a container address configuration request, send the container address configuration request and the node identification information to the address management plug-in, and output the received container address configuration information sent by the address management plug-in; The Master node device is used to receive the container address configuration request and the node identification information through the installed address management plug-in, configure the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generate container address configuration information, and send the container address configuration information to the container service plug-in; Among them, the address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node. The container address segment belongs to a virtual subnet defined in a private cloud network, and the elastic network card is a pluggable dynamic network card on the corresponding node.

10. The system according to claim 9, characterized in that The Node node device is also installed with a container interface plug-in, which is used to: receive a container address configuration request input by a user, send the container address configuration request to the container service plug-in, and receive the container address configuration information sent by the container service plug-in.

11. A container address configuration device, characterized in that: include: A container address configuration request receiving module, configured to obtain node identification information corresponding to the current node where the container service plug-in is located when the container service plug-in receives the container address configuration request; A container address configuration request sending module, used to send the container address configuration request and the node identification information to the address management plug-in, so that the address management plug-in configures the container address segment corresponding to the current node based on the container address configuration request and the node identification information, generates container address configuration information, and sends the container address configuration information to the container service plug-in; wherein the address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node, the container address segment belongs to a virtual subnet defined in a private cloud network, and the elastic network card is a pluggable dynamic network card on the corresponding node; The container address configuration information output module is used to output the received container address configuration information sent by the address management plug-in.

12. A container address configuration device, characterized in that: include: A container address configuration request receiving module, used to receive a container address configuration request sent by a container service plug-in and node identification information corresponding to a current node where the container service plug-in is located; A container address configuration information generation module, configured to configure the container address segment corresponding to the current node based on the container address configuration request and the node identification information, and generate container address configuration information; A container address configuration information sending module, used to send the container address configuration information to the container service plug-in, so that the container service plug-in outputs the container address configuration information; Among them, the address management plug-in stores container address segments corresponding to at least one node, and each of the container address segments has been bound to an elastic network card in the corresponding node. The container address segment belongs to a virtual subnet defined in the private cloud network, and the elastic network card is a pluggable dynamic network card on the corresponding node.

13. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for configuring the container address as described in any one of claims 1-5 or claims 6-8.

14. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to execute the method for configuring a container address as described in any one of claims 1-5 or claims 6-8.

Citation Information

Patent Citations

  • Method and system for automatically setting arbitrary bonding for multi-network card and multi-network segment under LINUX system

    CN105847053A

  • Implementation method of Docker network plug-in

    CN106790658A

  • Deployment method and device realizing distributing type storage system

    CN106790660A

  • Method and system for allocating IP addresses to containers

    CN107580083A

  • IP address management method and edge cluster

    CN110266833A