A network configuration method and device, electronic equipment and storage medium

By introducing a target controller into the Kubernetes cluster, the label information and neighbor relationships of RR and non-RR nodes are automatically configured, which solves the problem of complexity in large-scale cluster network deployment and improves deployment efficiency and effectiveness.

CN116708160BActive Publication Date: 2026-01-27CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310723300.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-19
Publication Date
2026-01-27
Estimated Expiration
2043-06-19

AI Technical Summary

Technical Problem

Large-scale Kubernetes clusters have poor network deployment performance, and BGP configuration is complex and repetitive, resulting in high deployment difficulty and complexity.

Method used

A target controller is introduced to perform network configuration for target regions in the Kubernetes cluster by acquiring and sending target configuration files. This includes the automated configuration of RR nodes, label information of non-RR nodes, autonomous system numbers, and neighbor relationships.

Benefits of technology

It reduces the network transformation time of Kubernetes clusters, improves network deployment efficiency, and lowers operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116708160B_ABST
    Figure CN116708160B_ABST
Patent Text Reader

Abstract

The application provides a network configuration method and device, electronic equipment and storage medium. The method comprises the following steps: obtaining a target configuration file, the target configuration file comprising a configuration item and a configuration parameter matched with the configuration item, the target configuration file being used to instruct a target controller to perform a configuration operation on a target area in a Kubernetes cluster; sending the target configuration file to a pre-configured target controller, the target controller being used to perform network configuration on the Kubernetes cluster, the Kubernetes cluster comprising at least one target area, the target area comprising a route reflector (RR) node, a non-RR node and a switch associated with the RR node; and controlling the target controller to perform network configuration on a target parameter of the target area in the Kubernetes cluster based on the target configuration file. Through the above characteristics, the network deployment effect of the Kubernetes cluster can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a network configuration method, apparatus, electronic device, and storage medium. Background Technology

[0002] In recent years, with the development of science and technology, Kubernetes, as an advanced container orchestration system, has developed rapidly and has been widely used in the field of cloud computing and cloud services.

[0003] In existing technologies, for large-scale Kubernetes clusters, the nodes are inevitably distributed across different racks in different data centers, and may even be located in different availability zones or regions. This means that different nodes in the cluster will connect to different switches. Therefore, when using a network plugin (Calico) to build a Border Gateway Protocol (BGP) network, multiple different BGP autonomous systems will inevitably emerge. Consequently, when the cluster size is large, the number of BGP configurations becomes very large, and the configuration files are extremely complex and repetitive, making deployment extremely difficult and complex.

[0004] It is evident that existing technologies have a poor effect on network deployment of large-scale Kubernetes clusters. Summary of the Invention

[0005] This invention provides a network configuration method, apparatus, electronic device, and storage medium to address the problem of poor network deployment performance for large-scale Kubernetes clusters in the prior art.

[0006] In a first aspect, embodiments of the present invention provide a network configuration method, the method comprising:

[0007] Obtain the target configuration file, which includes configuration items and configuration parameters matching the configuration items. The target configuration file is used to instruct the target controller to perform configuration operations on the target region in the Kubernetes cluster.

[0008] The target configuration file is sent to a pre-configured target controller, which is used to configure the network of the Kubernetes cluster. The Kubernetes cluster includes at least one target area, which includes route reflector (RR) nodes, non-RR nodes, and switches associated with RR nodes.

[0009] The target controller is controlled to configure the network parameters of the target region in the Kubernetes cluster based on the target configuration file.

[0010] Optionally, the target parameter includes at least one of the following:

[0011] The label information of the RR nodes and the non-RR nodes;

[0012] The autonomous system numbers of the RR nodes and the non-RR nodes;

[0013] The neighbor relationship between the RR node and the non-RR node;

[0014] The neighbor relationship between the RR node and the switch.

[0015] Optionally, obtaining the target configuration file includes:

[0016] The type and name of the target configuration file are determined to obtain the first text;

[0017] Create the configuration items corresponding to the target configuration file. The configuration items include: RR node name, non-RR node name, node filtering rules, autonomous system number, and Internet Protocol IP.

[0018] Add the configuration parameters to the configuration item to obtain the second text;

[0019] The first text and the second text are combined to obtain the target configuration file.

[0020] Optionally, controlling the target controller to perform network configuration for the target region in the Kubernetes cluster based on the target configuration file includes:

[0021] The first target node is queried based on the target configuration file. The first target node is a node in the target region that meets the preset conditions.

[0022] The target controller is controlled to listen for a first operation event to obtain configuration information. The first operation event includes at least one of the following: add operation, update operation, and delete operation, and the first operation event matches the target configuration file.

[0023] A second target node is determined based on the configuration information and the target configuration file. The second target node is a node that exists in the target area in real time.

[0024] Configure the network parameters for the first target node and the second target node.

[0025] Optionally, configuring the target parameters of the first target node and the second target node in the network includes:

[0026] Delete the labels of nodes in the second target node that do not meet the preset conditions, and sequentially label the first target node as either an RR node or a non-RR node;

[0027] The target controller is controlled to configure RR nodes and non-RR nodes managed by RR nodes, establish neighbor relationships between RR nodes and non-RR nodes, and create neighbor relationships between RR nodes and switches associated with RR nodes.

[0028] Optionally, after the target controller performs network configuration on the target region in the Kubernetes cluster based on the target configuration file, the method further includes:

[0029] If the target configuration file is deleted, query the resource file associated with the target configuration file. The resource file includes one of the following: target tag, target autonomous system number, target BGP Peer. The target tag matches the tag of the RR node or non-RR node in the target configuration file, the target autonomous system number matches the autonomous system number in the target configuration file, and the target BGP Peer matches the BGPPeer in the target configuration file.

[0030] The target controller is used to reclaim the resource files.

[0031] In a second aspect, embodiments of the present invention provide a network configuration device, comprising:

[0032] The acquisition module is used to acquire a target configuration file, which includes configuration items and configuration parameters that match the configuration items. The target configuration file is used to instruct the target controller to perform configuration operations on a target region in the Kubernetes cluster.

[0033] A sending module is used to send the target configuration file to a pre-configured target controller, which is used to configure the network of the Kubernetes cluster. The Kubernetes cluster includes at least one target area, which includes route reflector (RR) nodes, non-RR nodes, and switches associated with RR nodes.

[0034] The first processing module is used to control the target controller to perform network configuration of the target parameters of the target region in the Kubernetes cluster based on the target configuration file.

[0035] Optionally, the target parameter includes at least one of the following:

[0036] The label information of the RR nodes and the non-RR nodes;

[0037] The autonomous system numbers of the RR nodes and the non-RR nodes;

[0038] The neighbor relationship between the RR node and the non-RR node;

[0039] The neighbor relationship between the RR node and the switch.

[0040] Optionally, the acquisition module includes:

[0041] The first generation unit is used to determine the type and name of the target configuration file and obtain the first text.

[0042] A creation unit is used to create the configuration items corresponding to the target configuration file. The configuration items include: RR node name, non-RR node name, node filtering rules, autonomous system number, and Internet Protocol IP.

[0043] The second generation unit is used to add the configuration parameters to the configuration item to obtain the second text;

[0044] The first processing unit is used to integrate the first text and the second text to obtain the target configuration file.

[0045] Optionally, the first processing module includes:

[0046] The query unit is used to query a first target node based on the target configuration file, wherein the first target node is a node in the target area that meets preset conditions;

[0047] The second processing unit is configured to control the target controller to listen to a first operation event and obtain configuration information. The first operation event includes at least one of the following: add operation, update operation, and delete operation, and the first operation event matches the target configuration file.

[0048] The third processing unit is used to determine the second target node based on the configuration information and the target configuration file, wherein the second target node is a node that exists in the target area in real time.

[0049] The configuration unit is used to configure the target parameters of the first target node and the second target node in the network.

[0050] Optionally, the configuration unit includes:

[0051] Delete the labels of nodes in the second target node that do not meet the preset conditions, and sequentially label the first target node as either an RR node or a non-RR node;

[0052] The target controller is controlled to configure RR nodes and non-RR nodes managed by RR nodes, establish neighbor relationships between RR nodes and non-RR nodes, and create neighbor relationships between RR nodes and switches associated with RR nodes.

[0053] Optionally, the network configuration device further includes:

[0054] The query module is used to query resource files associated with the target configuration file when the target configuration file is deleted. The resource files include one of the following: target tag, target autonomous system number, and target BGP Peer. The target tag matches the tag of an RR node or a non-RR node in the target configuration file, the target autonomous system number matches the autonomous system number in the target configuration file, and the target BGP Peer matches the BGP Peer in the target configuration file.

[0055] The second processing module is used to reclaim the resource files using the target controller.

[0056] Thirdly, embodiments of the present invention provide an electronic device, including a transceiver and a processor.

[0057] The transceiver is used to obtain a target configuration file, which includes configuration items and configuration parameters that match the configuration items. The target configuration file is used to instruct the target controller to perform configuration operations on a target region in the Kubernetes cluster.

[0058] The transceiver is also used to send the target configuration file to a pre-configured target controller, which is used to configure the network of the Kubernetes cluster. The Kubernetes cluster includes at least one target area, which includes route reflector (RR) nodes, non-RR nodes, and switches associated with the RR nodes.

[0059] The processor is used to control the target controller to perform network configuration of target parameters for the target region in the Kubernetes cluster based on the target configuration file.

[0060] Fourthly, embodiments of the present invention provide an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the network configuration method as described in the first aspect.

[0061] Fifthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the network configuration method as described in the first aspect.

[0062] In this embodiment of the invention, a target configuration file is first obtained and sent to a pre-configured target controller. Finally, the target controller is controlled to perform network configuration on the target parameters of the target region in the Kubernetes cluster based on the target configuration file. The target configuration file includes configuration items and configuration parameters. In this embodiment, the introduction of a target controller to complete the network configuration of the target region in the Kubernetes cluster according to the target configuration file reduces the time required for network transformation of the Kubernetes cluster, thereby improving the network deployment effect of the Kubernetes cluster. Attached Figure Description

[0063] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0064] Figure 1 This is a network architecture diagram of a Kubernetes cluster;

[0065] Figure 2 This is a flowchart illustrating a network configuration method provided in an embodiment of the present invention;

[0066] Figure 3 This is a flowchart illustrating another network configuration method provided in an embodiment of the present invention;

[0067] Figure 4 This is a schematic diagram of the structure of a network configuration device provided in an embodiment of the present invention;

[0068] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0069] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0070] In the embodiments of this invention, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.

[0071] In related technologies, Kubernetes is an open-source container cluster management system from Google that provides functions such as application deployment, maintenance, and scaling mechanisms. Controlling Kubernetes makes it easy to manage containerized applications running across machines.

[0072] In Kubernetes, a Pod is the basic unit of operation, consisting of one or more containers. If a Pod is composed of multiple containers, these containers reside on the same node (i.e., the host) within the Kubernetes cluster. Calico, a commonly used Kubernetes network plugin, uses the Border Gateway Protocol (BGP) to route and exchange container networks across nodes, thereby ensuring network communication between containers.

[0073] For a network architecture diagram of the Kubernetes cluster, please refer to [link / reference]. Figure 1 ,like Figure 1 As shown, each Tor switch includes Route Reflector (RR) nodes and Leaf Nodes. The nodes communicate with each other via the BGP protocol.

[0074] Furthermore, for large-scale Kubernetes clusters, nodes are typically deployed in different regions, different availability zones, and even different racks. This results in different nodes potentially connecting to different switches and having different custom system IDs. As the cluster size increases, when deploying the network using Calico's BGP mode, the BGP configuration will increase indefinitely. These configurations include: the selection and configuration of BGP RR nodes, the configuration of BGP non-RR nodes, the node label configuration, and the configuration of BGP Peers.

[0075] Please see Figure 2 , Figure 2 This is a flowchart illustrating a network configuration method provided in an embodiment of the present invention, as shown below. Figure 2As shown, the method includes the following steps:

[0076] Step 201: Obtain the target configuration file, which includes configuration items and configuration parameters matching the configuration items. The target configuration file is used to instruct the target controller to perform configuration operations on the target region in the Kubernetes cluster.

[0077] Step 202: Send the target configuration file to the pre-configured target controller. The target controller is used to configure the network of the Kubernetes cluster. The Kubernetes cluster includes at least one target area, which includes route reflector (RR) nodes, non-RR nodes, and switches associated with the RR nodes.

[0078] Step 203: Control the target controller to perform network configuration of the target parameters of the target region in the Kubernetes cluster based on the target configuration file.

[0079] In this embodiment of the invention, steps 201, 202 and 203 of the network configuration method described above can be executed by electronic devices, such as computers, and this is not limited.

[0080] In step 201, the target configuration file can be obtained from other devices or servers, and the target configuration file may include configuration items and configuration parameters that match the configuration items. The configuration items and configuration parameters can be set by relevant personnel according to network configuration requirements, and this embodiment of the invention does not limit this.

[0081] It should be understood that the target configuration file mentioned above may include configuration items corresponding to the following operations:

[0082] 1. Identify RR nodes and non-RR nodes, and label both RR nodes and non-RR nodes.

[0083] 2. Add the route-reflector identifier to the Calico Node configuration of the RR node;

[0084] 3. Apply a patch to the Calico Node that needs to modify the AS number to change the Autonomous System (AS) Number field;

[0085] 4. Configure BGP Peer configuration between RR nodes and non-RR nodes;

[0086] 5. Configure BGP Peer between the RR node and the uplink switch.

[0087] In addition, the target configuration file mentioned above can be any file type applicable to the target controller mentioned above. For example, the target configuration file mentioned above is a configuration file for a user-defined resource (CRD). A CRD is a way for Kubernetes clusters to customize resources in order to improve scalability.

[0088] In step 202, the target controller mentioned above is a controller that is pre-deployed in the Kubernetes cluster, such as the Automatic Calico Configuration Controller (ACCC) or other controllers used to monitor various events of the CRD.

[0089] Additionally, a Kubernetes cluster includes at least one target region. This target region comprises route reflector (RR) nodes, non-RR nodes, and switches associated with the RR nodes. A single target configuration file corresponds to only one set of RR and non-RR nodes (i.e., one network segment). Therefore, a target region can be understood as one network segment.

[0090] It should be understood that if there are multiple different sets of RR nodes, then multiple sets of files need to be configured. That is, the number of target configuration files mentioned above matches the number of RR node sets, or in other words, the total number of configuration files depends on how many sets of RR nodes there are. Finally, all configuration files need to be sent to the target controller mentioned above.

[0091] In step 203, after sending the target configuration file to the pre-configured target controller, the target controller is controlled to automatically complete the configuration operations in the target configuration file, that is, to complete the network configuration of the target parameters of the target area in the Kubernetes cluster. Specifically, based on the target configuration file, the target controller can listen for operation events that match the target configuration file and perform configuration operations according to the current state and expected state of the Kubernetes cluster, thereby realizing automated configuration based on the target controller.

[0092] In this implementation, a target configuration file is first obtained and sent to a pre-configured target controller. Finally, the target controller is controlled to perform network configuration on the target parameters of the target region in the Kubernetes cluster based on the target configuration file. The target configuration file includes configuration items and configuration parameters. In this embodiment of the invention, the introduction of a target controller to complete the network configuration of the target region in the Kubernetes cluster according to the target configuration file reduces the time required for network transformation of the Kubernetes cluster, thereby improving the network deployment effect of the Kubernetes cluster.

[0093] It should be noted that if the above Kubernetes cluster adds nodes, and the added nodes do not meet the node selection rules in the target configuration file, then the nodes need to be added to the cluster first, and then the target configuration file needs to be updated. This is to avoid the target controller being unable to detect the addition of new nodes.

[0094] Optionally, the target parameter includes at least one of the following:

[0095] The label information of the RR nodes and the non-RR nodes;

[0096] The autonomous system numbers of the RR nodes and the non-RR nodes;

[0097] The neighbor relationship between the RR node and the non-RR node;

[0098] The neighbor relationship between the RR node and the switch.

[0099] It should be understood that the target parameters in the target configuration file mentioned above may include label information of RR nodes and non-RR nodes, autonomous system number, and neighbor relationship (which can be understood as BGP Peer), etc. The target configuration file is used to guide the target controller to configure the target parameters, thereby completing the network configuration of the target area in the Kubernetes cluster.

[0100] It should be noted that the target parameters mentioned above may also include other parameters, such as the names of RR nodes and non-RR nodes, etc., which are not limited in this embodiment of the invention.

[0101] Optionally, obtaining the target configuration file includes:

[0102] The type and name of the target configuration file are determined to obtain the first text;

[0103] Create the configuration items corresponding to the target configuration file. The configuration items include: RR node name, non-RR node name, node filtering rules, autonomous system number, and Internet Protocol IP.

[0104] Add the configuration parameters to the configuration item to obtain the second text;

[0105] The first text and the second text are combined to obtain the target configuration file.

[0106] It should be understood that the first text above contains information about the type and name of the target configuration file, such as the type of the configuration file (network configuration file) and the name of the configuration file (user-defined). The configuration parameters corresponding to the configuration items in the second text above can also be customized by the user to configure a network that meets the user's needs.

[0107] The first text and the second text mentioned above can be understood as separate text information. Integrating the first text and the second text mentioned above can be understood as merging the two texts into one text, thereby obtaining the target configuration file mentioned above.

[0108] Taking the target configuration file mentioned above as the CRD configuration file as an example, the above configuration items are abstracted into a unified CRD configuration file, as shown in Table 1 below:

[0109] Table 1

[0110]

[0111] The fields corresponding to the configuration items in the CRD configuration file include:

[0112] 1. routeReflectorNodeNames: This field is an array used to specify RR nodes. The values ​​in the array are the Node Names of the RR nodes. The Node Names are based on the results of kubectl get node.

[0113] 2. `leafNodeSelector`: This field is an array that allows multiple rules to be entered to filter Nodes that meet the user's requirements. The final selected Nodes are the union of all Nodes selected by multiple rules. Here, `prefix` is the prefix of the Node name, a string. Generally, machines in the same rack or network segment share the same prefix. `start` and `end` are both integers, where the hostname is sequentially incremented. If the number of digits in `start` is less than the number of digits in `end`, it will be padded with zeros to make up the missing length. The final length is the string length of the `end` number.

[0114] 3. leafNodeNames: In addition to supporting users to specify the node name in the form of prefix + number, it also supports users to directly specify the full name of the node.

[0115] 4. AS Number: Specify the AS number. If not specified, the cluster default AS number (user-defined) will be used.

[0116] 5. ipv4PeerIP: PeerIP in BGPPeer. If there are multiple PeerIPs, there will be multiple BGPPeer configurations.

[0117] 6. ipv6PeerIP: PeerIP in BGPPeer. If there are multiple PeerIPs, there will be multiple BGPPeer configurations.

[0118] It should be noted that the final non-RR nodes leafNodes are the union of all Node nodes calculated based on leafNodeSelector and leafNodeNames.

[0119] In addition, the labels of RR nodes and non-RR nodes need to be unique. Therefore, the key values ​​of the labels of RR nodes and non-RR nodes can be standardized, and different RR nodes and non-RR nodes can be distinguished according to different key values, for example:

[0120] The key value of an RR node can be:

[0121] networkconfig.cmss.com / route-reflector-node;

[0122] The key value for a non-RR node can be:

[0123] networkconfig.cmss.com / leaf-node;

[0124] The value of the tag is taken from the name of the target configuration file. As shown in Table 1 above, the tags for RR nodes and non-RR nodes can be:

[0125] RR node label: networkconfig.cmss.com / route-reflector-node=zone-01;

[0126] Non-RR node label: networkconfig.cmss.com / leaf-node=zone-01.

[0127] In this implementation scheme, firstly, the type and name of the target configuration file are determined to obtain the first text. Then, the configuration item corresponding to the target configuration file is created, and the configuration parameters are added to the configuration item to obtain the second text. Finally, the first text and the second text are integrated to obtain the target configuration file. This method enables network configuration of the Kubernetes cluster to meet user needs, reduces the learning and deployment costs for operations and maintenance personnel, and significantly improves the effectiveness of network configuration for the Kubernetes cluster.

[0128] Optionally, controlling the target controller to perform network configuration for the target region in the Kubernetes cluster based on the target configuration file includes:

[0129] The first target node is queried based on the target configuration file. The first target node is a node in the target region that meets the preset conditions.

[0130] The target controller is controlled to listen for a first operation event to obtain configuration information. The first operation event includes at least one of the following: add operation, update operation, and delete operation, and the first operation event matches the target configuration file.

[0131] A second target node is determined based on the configuration information and the target configuration file. The second target node is a node that exists in the target area in real time.

[0132] Configure the network parameters for the first target node and the second target node.

[0133] It should be understood that the process by which the target controller configures the network of the target area in the Kubernetes cluster based on the target configuration file can be understood as a reconcile process. That is, based on the current network state of the Kubernetes cluster, Calico is used to configure the network to the desired state according to the content of the target configuration file. The desired state is the state required by the user.

[0134] The first target node mentioned above is a node in the target area that meets the preset conditions. The preset conditions can be set by the user, that is, nodes that meet the user's needs. In addition, the first target node can be obtained by matching the relevant fields in the target configuration file. For example, taking the example corresponding to Table 1 above, according to the list of routeReflectorNodeNames and leafNodeNames nodes and the selector rules given in the CRD configuration file, all nodes that meet the preset conditions can be matched.

[0135] It should be noted that selector rules are used for batch configuration based on node hostnames. They include three fields: prefix, start, and end. Prefix is ​​the common prefix of the hostnames, and start and end are their numbers. For example, nodes host01, host02, and host03 can be represented in batches under selector rules, making it convenient for users to configure multiple nodes. See Table 2 for selector rules.

[0136] Table 2

[0137]

[0138] The target controller can obtain the configuration information by listening to the first operation event, which can be an add, update, or delete operation. Then, it can determine the second target node by combining the target configuration file. For example, the target controller can listen to the first operation event and then use the label key obtained from the target configuration file to find all currently existing nodes, i.e., the second target node.

[0139] It should be understood that the confirmation of the first target node and the second target node can also be achieved through conditional queries, and this embodiment of the invention does not limit this.

[0140] The network configuration of the target parameters of the first target node and the second target node can be understood as tagging the nodes, modifying the autonomous system number, and establishing the neighbor relationship between RR nodes and non-RR nodes, and the neighbor relationship between RR nodes and switches.

[0141] In this implementation scheme, the first target node is queried based on the target configuration file to obtain nodes in the target area that meet preset conditions. Next, the target controller listens for a first operation event to obtain configuration information. Then, based on the configuration information and the target configuration file, the second target node is determined. Finally, network configuration is performed on the target parameters of the first and second target nodes. This method enables network configuration operations on the target nodes (first and second target nodes), thus completing the network configuration of the target area in the Kubernetes cluster. This reduces the time required for network transformation of the Kubernetes cluster, thereby improving the network deployment effect of the Kubernetes cluster.

[0142] Optionally, configuring the target parameters of the first target node and the second target node in the network includes:

[0143] Delete the labels of nodes in the second target node that do not meet the preset conditions, and sequentially label the first target node as either an RR node or a non-RR node;

[0144] The target controller is controlled to configure RR nodes and non-RR nodes managed by RR nodes, establish neighbor relationships between RR nodes and non-RR nodes, and create neighbor relationships between RR nodes and switches associated with RR nodes.

[0145] The aforementioned preset conditions can also be understood as user requirements, namely, deleting the labels of nodes in the second target node that do not meet the user requirements.

[0146] In addition, after deleting the labels of nodes that do not meet the preset conditions in the second target node and labeling the first target node as either an RR node or a non-RR node, it is also necessary to modify the AS Number of nodes in different regions as required. The target controller can encapsulate the Calico client and modify the AS Number of the node by calling the Calico API. The AS Number can be customized by the user or the default AS Number can be selected.

[0147] When creating neighbor relationships between RR nodes and non-RR nodes, each RR node only needs one configuration for its BGP Peer with the non-RR nodes managed by that RR node. After the target controller completes the configuration by calling the interface (Calico API), the name of the Calico BGP Peer is added to the Status field of the target configuration file. For example, the name is composed of the fixed prefix rr-to-leaf-bgppeer + the name of the CRD, and the specific format is as follows:

[0148] networkconfig.cmss.com / rr-to-leaf-bgppeer:

[0149] "rr-to-leaf-bgppeer-zone-01";

[0150] When creating neighbor relationships between RR nodes and switches, taking the configuration items in Table 1 as an example, the ipv4PeerIP and ipv6PeerIP fields in the target configuration file are both array types. Each peerIP corresponds to a Calico BGPPeer configuration. After each successful configuration, the name of each Calico BGP Peer is written to the Status field of the target configuration file for use by the target controller during reconcile. For example, the name is composed of the fixed prefix rr-to-switch-bgppeer + CRD name, and the specific format is as follows:

[0151] networkconfig.cmss.com / rr-to-swtich-bgppeer:[“rr-to-switch-bgppeer-zone-01”];

[0152] It should be noted that when updating the ipv4PeerIP in the target configuration file, the target controller can compare the Calico BGPPeer information recorded in the Status field of the CRD to determine whether to add / remove BGPPeer configuration (Reconcile). After successful reconcile, the Status information in the target configuration file needs to be updated to save the latest BGP Peer information.

[0153] In this implementation scheme, the labels of nodes that do not meet the above preset conditions are first deleted. Then, the labels of nodes that meet the above preset conditions are added to distinguish the nodes. Finally, neighbor relationships are established between RR nodes and non-RR nodes, and neighbor relationships are established between RR nodes and switches. This completes the network configuration of the target area in the Kubernetes cluster. The configuration operation is completed automatically by the target controller, which reduces the time required for network transformation of the Kubernetes cluster and improves the network deployment effect of the Kubernetes cluster.

[0154] As an optional implementation, please refer to Figure 3 , Figure 3 This is a flowchart illustrating another network configuration method provided in an embodiment of the present invention, as shown below. Figure 3 As shown, the target controller listens for events (addition, update, and deletion) in the network configuration file, and then compares the latest configuration in the event with the current cluster status to perform the following operations:

[0155] 1. For RR nodes and non-RR nodes that do not match the configuration, delete their labels and AS Numbers (if they exist);

[0156] 2. Label the eligible RR nodes and non-RR nodes separately;

[0157] 3. Modify the AS Number for eligible RR nodes and non-RR nodes respectively (if necessary);

[0158] Finally, create / update / delete the relevant BGP Peers to complete the network configuration of the cluster.

[0159] Optionally, after the target controller performs network configuration on the target region in the Kubernetes cluster based on the target configuration file, the method further includes:

[0160] If the target configuration file is deleted, query the resource file associated with the target configuration file. The resource file includes one of the following: target tag, target autonomous system number, target BGP Peer. The target tag matches the tag of the RR node or non-RR node in the target configuration file, the target autonomous system number matches the autonomous system number in the target configuration file, and the target BGP Peer matches the BGPPeer in the target configuration file.

[0161] The target controller is used to reclaim the resource files.

[0162] It should be understood that after obtaining information to delete the above target configuration file, because the above target configuration file is associated with other resource types, such as Kubernetes Node, Calico Node, BGP Peer, etc., it is also necessary to clean up the resources associated with the above target configuration file at the same time as deleting the above target configuration file.

[0163] In this implementation, when the target configuration file is deleted, the resource file associated with the target configuration file is first queried, and then the target controller is controlled to delete or recycle the resource file. Through this method, the corresponding garbage collection logic is implemented in the target controller. By using the target controller to realize automatic resource recycling, the operation and maintenance costs are reduced.

[0164] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a network configuration device provided in an embodiment of the present invention, such as... Figure 4 As shown, the network configuration device 400 includes:

[0165] The acquisition module 401 is used to acquire a target configuration file, the target configuration file including configuration items and configuration parameters matching the configuration items, the target configuration file being used to instruct the target controller to perform configuration operations on a target region in the Kubernetes cluster;

[0166] Sending module 402 is used to send the target configuration file to a pre-configured target controller. The target controller is used to configure the network of the Kubernetes cluster. The Kubernetes cluster includes at least one target area, and the target area includes route reflector (RR) nodes, non-RR nodes, and switches associated with RR nodes.

[0167] The first processing module 403 is used to control the target controller to perform network configuration on the target parameters of the target region in the Kubernetes cluster based on the target configuration file.

[0168] Optionally, the target parameter includes at least one of the following:

[0169] The label information of the RR nodes and the non-RR nodes;

[0170] The autonomous system numbers of the RR nodes and the non-RR nodes;

[0171] The neighbor relationship between the RR node and the non-RR node;

[0172] The neighbor relationship between the RR node and the switch.

[0173] Optionally, the acquisition module 401 includes:

[0174] The first generation unit is used to determine the type and name of the target configuration file and obtain the first text.

[0175] A creation unit is used to create the configuration items corresponding to the target configuration file. The configuration items include: RR node name, non-RR node name, node filtering rules, autonomous system number, and Internet Protocol IP.

[0176] The second generation unit is used to add the configuration parameters to the configuration item to obtain the second text;

[0177] The first processing unit is used to integrate the first text and the second text to obtain the target configuration file.

[0178] Optionally, the first processing module 403 includes:

[0179] The query unit is used to query a first target node based on the target configuration file, wherein the first target node is a node in the target area that meets preset conditions;

[0180] The second processing unit is configured to control the target controller to listen to a first operation event and obtain configuration information. The first operation event includes at least one of the following: add operation, update operation, and delete operation, and the first operation event matches the target configuration file.

[0181] The third processing unit is used to determine the second target node based on the configuration information and the target configuration file, wherein the second target node is a node that exists in the target area in real time.

[0182] The configuration unit is used to configure the target parameters of the first target node and the second target node in the network.

[0183] Optionally, the configuration unit includes:

[0184] Delete the labels of nodes in the second target node that do not meet the preset conditions, and sequentially label the first target node as either an RR node or a non-RR node;

[0185] The target controller is controlled to configure RR nodes and non-RR nodes managed by RR nodes, establish neighbor relationships between RR nodes and non-RR nodes, and create neighbor relationships between RR nodes and switches associated with RR nodes.

[0186] Optionally, the network configuration device 400 further includes:

[0187] The query module is used to query resource files associated with the target configuration file when the target configuration file is deleted. The resource files include one of the following: target tag, target autonomous system number, and target BGP Peer. The target tag matches the tag of an RR node or a non-RR node in the target configuration file, the target autonomous system number matches the autonomous system number in the target configuration file, and the target BGP Peer matches the BGP Peer in the target configuration file.

[0188] The second processing module is used to reclaim the resource files using the target controller.

[0189] Specifically, see Figure 5 As shown, this embodiment of the invention also provides an electronic device, including a bus 501, a transceiver 502, an antenna 503, a bus interface 504, a processor 505, and a memory 506.

[0190] Transceiver 502 is used to obtain a target configuration file, the target configuration file including configuration items and configuration parameters matching the configuration items, the target configuration file being used to instruct the target controller to perform configuration operations on a target region in the Kubernetes cluster;

[0191] Transceiver 502 is also used to send the target configuration file to a pre-configured target controller, the target controller being used to perform network configuration on the Kubernetes cluster, the Kubernetes cluster including at least one target area, the target area including route reflector (RR) nodes, non-RR nodes, and switches associated with the RR nodes;

[0192] Processor 505 is used to control the target controller to perform network configuration of target parameters for the target region in the Kubernetes cluster based on the target configuration file.

[0193] exist Figure 5 In this document, a bus architecture (represented by bus 501) is used. Bus 501 can include any number of interconnected buses and bridges, linking various circuits including one or more processors represented by processor 505 and memory represented by memory 506. Bus 501 can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. Bus interface 504 provides an interface between bus 501 and transceiver 502. Transceiver 502 can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 505 is transmitted over a wireless medium via antenna 503, which further receives data and transmits it to processor 505.

[0194] Processor 505 manages bus 501 and general processing, and also provides various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory 506 can be used to store data used by processor 505 during operation.

[0195] Optionally, the processor 505 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or a complex programmable logic device (CPLD).

[0196] This invention also provides an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor. When the program is executed by the processor, it implements the various processes of the above-described method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here.

[0197] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described policy management method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be, for example, ROM, RAM, a magnetic disk, or an optical disk.

[0198] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0199] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0200] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.

Claims

1. A network configuration method, characterized in that, include: Obtain the target configuration file, which includes configuration items and configuration parameters that match the configuration items. The target configuration file is used to instruct the target controller to perform configuration operations on the target region in the Kubernetes cluster. The target configuration file is sent to a pre-configured target controller, which is used to configure the network of the Kubernetes cluster. The Kubernetes cluster includes at least one target area, which includes route reflector (RR) nodes, non-RR nodes, and switches associated with RR nodes. The target controller is controlled to configure the network parameters of the target region in the Kubernetes cluster based on the target configuration file; The process of controlling the target controller to perform network configuration on the target parameters of the target region in the Kubernetes cluster based on the target configuration file includes: The first target node is queried based on the target configuration file. The first target node is a node in the target region that meets the preset conditions. The target controller is controlled to listen for a first operation event to obtain configuration information. The first operation event includes at least one of the following: add operation, update operation, and delete operation, and the first operation event matches the target configuration file. A second target node is determined based on the configuration information and the target configuration file. The second target node is a node that exists in the target area in real time. Configure the network parameters for the first target node and the second target node.

2. The network configuration method according to claim 1, characterized in that, The target parameter includes at least one of the following: The label information of the RR nodes and the non-RR nodes; The autonomous system numbers of the RR nodes and the non-RR nodes; The neighbor relationship between the RR node and the non-RR node; The neighbor relationship between the RR node and the switch.

3. The network configuration method according to claim 2, characterized in that, The process of obtaining the target configuration file includes: The type and name of the target configuration file are determined to obtain the first text; Create the configuration items corresponding to the target configuration file. The configuration items include: RR node name, non-RR node name, node filtering rules, autonomous system number, and Internet Protocol IP. Add the configuration parameters to the configuration item to obtain the second text; The first text and the second text are combined to obtain the target configuration file.

4. The network configuration method according to claim 1, characterized in that, The network configuration of the target parameters of the first target node and the second target node includes: Delete the labels of nodes in the second target node that do not meet the preset conditions, and sequentially label the first target node as either an RR node or a non-RR node; The target controller is controlled to configure RR nodes and non-RR nodes managed by RR nodes, establish neighbor relationships between RR nodes and non-RR nodes, and create neighbor relationships between RR nodes and switches associated with RR nodes.

5. The network configuration method according to claim 1, characterized in that, After the target controller configures the network parameters of the target region in the Kubernetes cluster based on the target configuration file, the method further includes: If the target configuration file is deleted, query the resource file associated with the target configuration file. The resource file includes one of the following: target tag, target autonomous system number, target BGP Peer. The target tag matches the tag of the RR node or non-RR node in the target configuration file, the target autonomous system number matches the autonomous system number in the target configuration file, and the target BGP Peer matches the BGP Peer in the target configuration file. The target controller is used to reclaim the resource files.

6. A network configuration device, characterized in that, include: The acquisition module is used to acquire the target configuration file, which includes configuration items and configuration parameters that match the configuration items. The target configuration file is used to instruct the target controller to perform configuration operations on the target area in the Kubernetes cluster. A sending module is used to send the target configuration file to a pre-configured target controller, which is used to configure the network of the Kubernetes cluster. The Kubernetes cluster includes at least one target area, which includes route reflector (RR) nodes, non-RR nodes, and switches associated with RR nodes. The first processing module is used to control the target controller to perform network configuration of the target parameters of the target region in the Kubernetes cluster based on the target configuration file. The first processing module includes: The query unit is used to query a first target node based on the target configuration file, wherein the first target node is a node in the target area that meets preset conditions; The second processing unit is configured to control the target controller to listen to a first operation event and obtain configuration information. The first operation event includes at least one of the following: add operation, update operation, and delete operation, and the first operation event matches the target configuration file. The third processing unit is used to determine the second target node based on the configuration information and the target configuration file, wherein the second target node is a node that exists in the target area in real time. The configuration unit is used to configure the target parameters of the first target node and the second target node in the network.

7. The network configuration device according to claim 6, characterized in that, The target parameter includes at least one of the following: The label information of the RR nodes and the non-RR nodes; The autonomous system numbers of the RR nodes and the non-RR nodes; The neighbor relationship between the RR node and the non-RR node; The neighbor relationship between the RR node and the switch.

8. The network configuration device according to claim 7, characterized in that, The acquisition module includes: The first generation unit is used to determine the type and name of the target configuration file and obtain the first text. A creation unit is used to create the configuration items corresponding to the target configuration file. The configuration items include: RR node name, non-RR node name, node filtering rules, autonomous system number, and Internet Protocol IP. The second generation unit is used to add the configuration parameters to the configuration item to obtain the second text; The first processing unit is used to integrate the first text and the second text to obtain the target configuration file.

9. The network configuration device according to claim 6, characterized in that, The configuration unit includes: Delete the labels of nodes in the second target node that do not meet the preset conditions, and sequentially label the first target node as either an RR node or a non-RR node; The target controller is controlled to configure RR nodes and non-RR nodes managed by RR nodes, establish neighbor relationships between RR nodes and non-RR nodes, and create neighbor relationships between RR nodes and switches associated with RR nodes.

10. The network configuration device according to claim 6, characterized in that, The network configuration device further includes: The query module is used to query resource files associated with the target configuration file when the target configuration file is deleted. The resource files include one of the following: target tag, target autonomous system number, and target BGP Peer. The target tag matches the tag of an RR node or a non-RR node in the target configuration file, the target autonomous system number matches the autonomous system number in the target configuration file, and the target BGP Peer matches the BGP Peer in the target configuration file. The second processing module is used to reclaim the resource files using the target controller.

11. An electronic device, characterized in that, Including transceivers and processors, The transceiver is used to obtain a target configuration file, which includes configuration items and configuration parameters that match the configuration items. The target configuration file is used to instruct the target controller to perform configuration operations on a target region in the Kubernetes cluster. The transceiver is also used to send the target configuration file to a pre-configured target controller, which is used to configure the network of the Kubernetes cluster. The Kubernetes cluster includes at least one target area, which includes route reflector (RR) nodes, non-RR nodes, and switches associated with the RR nodes. The processor is used to control the target controller to perform network configuration of target parameters for the target region in the Kubernetes cluster based on the target configuration file; The process of controlling the target controller to perform network configuration on the target parameters of the target region in the Kubernetes cluster based on the target configuration file includes: The first target node is queried based on the target configuration file. The first target node is a node in the target region that meets the preset conditions. The target controller is controlled to listen for a first operation event to obtain configuration information. The first operation event includes at least one of the following: add operation, update operation, and delete operation, and the first operation event matches the target configuration file. A second target node is determined based on the configuration information and the target configuration file. The second target node is a node that exists in the target area in real time. Configure the network parameters for the first target node and the second target node.

12. An electronic device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the network configuration method as described in any one of claims 1 to 5.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the network configuration method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Hyperledger Fabric network creation method, controller and storage medium

    CN110098954A