Network configuration method and device, electronic equipment and storage medium
By building an integrated multi-network model plug-in, the problem of high complexity of cluster network configuration is solved, unified IPAM management and Namespace granular network model settings are realized, network configuration process is simplified, and application performance of distributed clusters is improved.
Patent Information
- Application Number
- CN202510523444.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the implementation of multi-network plug-in collaborative method of cluster network multi-model results in high network configuration complexity, complex deployment and maintenance, unclear boundaries of network problems, lack of a unified IPAM management mechanism, and only supports workload granular network model settings, poor ease of use, and requires users to customize workload scheduling nodes.
Build a multi-network model plug-in that integrates multiple functions, including a first component for configuring resource access control and workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing container multi-network models by deploying and verifying network resources and connectivity in an open source system.
It simplifies the network configuration process, improves network configuration efficiency, improves the application performance of distributed clusters, solves the complexity of collaborative work of multiple network plug-ins, and realizes unified IPAM management and Namespace granular network model settings.
Smart Images

Figure CN120416022A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of container cluster management, and particularly to a network configuration method, apparatus, electronic device, and storage medium. Background Art
[0002] In related open-source network solutions, a multi-network plugin collaboration method is often used to implement multiple models of cluster networks. This implementation method of multi-network plugin collaboration has the following disadvantages: (1) Multiple network plugins are required in the cluster, increasing the complexity of cluster deployment and maintenance; (2) The boundaries of network problems are unclear, making it complex to troubleshoot problems; (3) There is a lack of a unified IPAM (IP Address Management) management mechanism for multiple network plugins; (4) It only supports the setting of network models at the workload granularity and lacks an implementation solution at the Namespace (application space) granularity, resulting in poor usability; (5) Since the network hardware resources required by business applications are different, users need to customize the scheduling nodes of the workload. Summary of the Invention
[0003] The present application provides a network configuration method, apparatus, electronic device, and storage medium to at least solve the problem of high network configuration complexity caused by implementing multiple models of cluster networks through a multi-network plugin collaboration method in related technologies.
[0004] The present application provides a network configuration method, including:
[0005] Obtain the images and deployment files of the multi-network model plugin. The multi-network model plugin integrates multiple components, and the components at least include a first component for configuring resource admission control and setting the workload scheduling node, a second component for managing the container Internet protocol address, and a third component for providing the container multi-network model;
[0006] Based on the images and deployment files of the multi-network model plugin, deploy multiple components in the open-source system;
[0007] In response to the completion of the deployment of multiple components, based on the first component, determine the network resources corresponding to the workload. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the workload scheduling node, and the second network resource is used to describe the network resources that can be allocated to the container;
[0008] Based on the second component, the third component, and the annotation information generated based on the network resources, deploy multiple workloads. In response to the multiple workloads being in the running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0009] The present application further provides a network configuration apparatus, including:
[0010] A data acquisition module, configured to acquire the images and deployment files of a multi-network model plugin. The multi-network model plugin integrates multiple components, and the components at least include a first component for configuring resource admission control and setting workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing a container multi-network model;
[0011] A first deployment module, configured to deploy multiple components in an open-source system based on the images and deployment files of the multi-network model plugin;
[0012] A resource determination module, configured to, in response to the completion of the deployment of multiple components, determine the network resources corresponding to the workload based on the first component. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the scheduling nodes of the workload, and the second network resource is used to describe the network resources that can be allocated to the container;
[0013] A second deployment module, configured to deploy multiple workloads based on the second component, the third component, and the annotation information generated based on the network resources. In response to the multiple workloads being in a running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0014] This application also provides an electronic device, including: a memory, configured to store a computer program; a processor, configured to implement the following steps of the network configuration method when executing the computer program:
[0015] Acquire the images and deployment files of a multi-network model plugin. The multi-network model plugin integrates multiple components, and the components at least include a first component for configuring resource admission control and setting workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing a container multi-network model;
[0016] Deploy multiple components in an open-source system based on the images and deployment files of the multi-network model plugin;
[0017] In response to the completion of the deployment of multiple components, determine the network resources corresponding to the workload based on the first component. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the scheduling nodes of the workload, and the second network resource is used to describe the network resources that can be allocated to the container;
[0018] Deploy multiple workloads based on the second component, the third component, and the annotation information generated based on the network resources. In response to the multiple workloads being in a running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0019] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the following steps of the network configuration method are implemented:
[0020] Obtain the images and deployment files of the multi-network model plug-in. The multi-network model plug-in integrates multiple components, and the components at least include a first component for configuring resource admission control and setting workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing a container multi-network model;
[0021] Based on the images and deployment files of the multi-network model plug-in, deploy multiple components in an open-source system;
[0022] In response to the completion of the deployment of multiple components, based on the first component, determine the network resources corresponding to the workload. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the workload scheduling node, and the second network resource is used to describe the network resources that can be allocated to the container;
[0023] Based on the second component, the third component, and the annotation information generated based on the network resources, deploy multiple workloads. In response to the multiple workloads being in a running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0024] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the following steps of the network configuration method are implemented:
[0025] Obtain the images and deployment files of the multi-network model plug-in. The multi-network model plug-in integrates multiple components, and the components at least include a first component for configuring resource admission control and setting workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing a container multi-network model;
[0026] Based on the images and deployment files of the multi-network model plug-in, deploy multiple components in an open-source system;
[0027] In response to the completion of the deployment of multiple components, based on the first component, determine the network resources corresponding to the workload. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the workload scheduling node, and the second network resource is used to describe the network resources that can be allocated to the container;
[0028] Based on the second component, the third component, and the annotation information generated based on the network resources, deploy multiple workloads. In response to the multiple workloads being in a running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0029] By constructing a multi-network model plug-in that integrates multiple functions, the present application realizes a network multi-model for a distributed cluster, and solves the following technical problems: multiple network plug-ins are required in the cluster, and the complexity of cluster deployment and maintenance is high; multiple network plug-ins work together, the boundaries of network problems are unclear, and the complexity of troubleshooting problems is high; there is a lack of a unified IPAM management mechanism for multiple network plug-ins; only workload-level network model settings are supported, and there is a lack of a solution at the Namespace level, with poor usability; due to different network hardware resources required by business applications, users need to customize the scheduling nodes of the workload, etc.; the application performance of the distributed cluster is improved, the network configuration process is simplified through the configuration of network resources, the network configuration efficiency is improved, and the application performance of the distributed cluster is further improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] To more clearly illustrate the embodiments of the present application, the following will briefly introduce the drawings required for the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0031] Figure 1 It is a schematic diagram of the related technology of a network configuration method provided by an embodiment of the present application;
[0032] Figure 2 It is an application environment diagram of a network configuration method provided by an embodiment of the present application;
[0033] Figure 3 It is a schematic diagram of the overall process of a network configuration method provided by an embodiment of the present application;
[0034] Figure 4 It is an overall architecture diagram of the MultiNet-CNI network plug-in of a network configuration method provided by an embodiment of the present application;
[0035] Figure 5 It is a diagram of the association relationship of resources of a network configuration method provided by an embodiment of the present application;
[0036] Figure 6 It is a working flow diagram of the MultiNet-Controller of a network configuration method provided by an embodiment of the present application;
[0037] Figure 7 It is a storage structure diagram of the IP address pool of a network configuration method provided by an embodiment of the present application;
[0038] Figure 8 It is a schematic diagram of the allocation of the IP address pool and the fixed IP address pool of a network configuration method provided by an embodiment of the present application;
[0039] Figure 9 This is a schematic diagram of the change of IP pool resources for a network configuration method provided by an embodiment of the present application;
[0040] Figure 10 This is a flowchart of the operation of the MultiNet-Daemon component for a network configuration method provided by an embodiment of the present application;
[0041] Figure 11 This is a schematic diagram of the workload distribution for a network configuration method provided by an embodiment of the present application;
[0042] Figure 12 This is a block diagram of the structure of a network configuration device provided by an embodiment of the present application;
[0043] Figure 13 This is an internal structure diagram of an electronic device in an embodiment. Specific embodiments
[0044] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present application.
[0045] It should be noted that in the description of the present application, the terms "including", "comprising" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0046] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of step description, and do not specifically refer to the meaning of order or sequence, nor are they used to limit the present application. They are only used to conveniently describe the method of the present application and cannot be understood as indicating the order of steps. In addition, the technical solutions between various embodiments can be combined with each other, but it must be based on the ability of those of ordinary skill in the art to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present application.
[0047] With the development of cloud computing technology, more and more enterprises are containerizing microservice business applications and using Kubernetes (K8s, an open-source system) to orchestrate containerized applications uniformly. During the smooth migration of microservice business to containerization, to maintain network connectivity, an Underlay (physical network infrastructure) container network solution is often adopted. Of course, different types of applications usually require different network resources. For example, AI (Artificial Intelligence) training and financial transaction applications need high-performance and low-latency network resources, and business applications of different departments need to access different VLAN (Virtual Local Area Network) network domains to achieve network resources for business isolation. To meet the reasonable allocation of network resources for different types of applications, it is necessary to integrate the network resources of the cluster and select an appropriate container network model according to the characteristics of the user's business application and complete the configuration of the container network and the selection of container node scheduling; as Figure 1 shown, in related open-source network solutions, a multi-network plugin collaboration method is often used to implement multiple network models in the cluster. For example, for application scenarios where some applications require high performance and low latency, and some business applications require multi-tenant isolation, it is necessary to use a combination of multi-network plugins such as Multus, VLAN, SRIOV, and IPAM to implement. This implementation scheme of multi-network plugin collaboration has the drawbacks described in the background technology.
[0048] To solve the above technical problems, this application provides a network configuration method, device, electronic device, and storage medium. By constructing a multi-network model plugin that integrates multiple functions, it realizes multiple network models in the distributed cluster and solves the following technical problems: multiple network plugins are required in the cluster, and the complexity of cluster deployment and maintenance is high; multiple network plugins work together, the boundaries of network problems are unclear, and the complexity of troubleshooting problems is high; there is a lack of a unified IPAM management mechanism for multiple network plugins; only the network model setting at the workload granularity is supported, and there is a lack of a solution at the Namespace granularity, and the usability is poor; due to different network hardware resources required by business applications, users need to customize the scheduling nodes of the workload, etc.; it improves the application performance of the distributed cluster. Through the configuration of network resources, it simplifies the network configuration process, improves the network configuration efficiency, and further improves the application performance of the distributed cluster.
[0049] To enable those skilled in the art of this technology to better understand the solution of this application, the following further detailed description of this application will be given in combination with the accompanying drawings and specific implementation manners.
[0050] The network configuration method provided by this application can be applied to such as Figure 2In the application environment shown. Among them, the terminal 102 communicates with the data processing platform set on the server 104 through the network. Among them, the terminal 102 can be but is not limited to various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0051] As Figure 3 shown, an embodiment of the present application provides a network configuration method. Taking the terminal in Figure 1 as an example, the method includes the following steps:
[0052] S1: Obtain the image and deployment file of the multi-network model plug-in. The multi-network model plug-in integrates multiple components, and the components at least include a first component for configuring resource admission control and setting workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing a container multi-network model.
[0053] It should be noted that an image is a form of file storage, which means that the data on one disk has an exact copy on another disk; a deployment file is a configuration file, script, or resource collection used to guide the installation, configuration, and operation of software or a system in a specific environment. It usually contains key information such as application startup parameters, resource paths, and permission settings to ensure the standardization and automation of the deployment process; the multi-network model plug-in integrates three core components. As Figure 4 shown, it includes a first component (MultiNet-Webhook component), a second component (MultiNet-Controller component), and a third component (MultiNet-Daemon component). Among them, the MultiNet-Webhook component is mainly responsible for the admission control of user-configured Network / Subnet resources and setting the scheduling nodes of the workload. The MultiNet-Controller component is mainly responsible for the IPAM (IP Address Management) management of containers, realizing the allocation and recycling of IP addresses of workloads, and supporting the fixed IP function of stateful workloads and stateless workloads. The MultiNet-Daemon component provides a container multi-network model (including SRIOV / RDMA / VLAN, etc.), and can configure network parameters such as network cards, IPs, and routes of containers according to the network type of Pods to ensure network connectivity between containers. Pod refers to an instance of a workload.
[0054] S2: Based on the image and deployment file of the multi-network model plug-in, deploy multiple components in the open-source system.
[0055] It should be noted that the open-source system refers to Kubernetes, which is an open-source system used to manage containerized applications on multiple hosts in a cloud platform. The deployed components at least include the above-mentioned first component, second component, and third component.
[0056] S3: In response to the completion of the deployment of multiple components, based on the first component, determine the network resources corresponding to the workload. The network resources at least include the first network resource and the second network resource. The first network resource is used to describe the container network model and the scheduling node of the workload, and the second network resource is used to describe the network resources that can be allocated to the container.
[0057] It should be noted that a workload is an application running in a Kubernetes cluster. To implement functions such as user-defined network models and Namespace affinity settings, two types of CRD resources are provided, including the first network resource and the second network resource. The first network resource and the second network resource refer to the Network resource and the Subnet resource respectively. Both are CRD resources (custom resources). The container network model and the scheduling node of the workload are defined through the Network CRD resource, and the network resources such as the IP and VLAN that can be allocated to the container are defined through the Subnet CRD resource, and Namespace affinity settings are supported. Among them, the key attributes of the Subnet CRD resource are shown in Table 1, and the key attributes of the Network CRD resource are shown in Table 2.
[0058] Table 1: Table of key attributes of the Subnet CRD resource.
[0059]
[0060] Table 2: Table of key attributes of the Network CRD resource.
[0061]
[0062] Among them, the code of the configuration file of the Network CRD resource includes:
[0063]
[0064]
[0065]
[0066] S4: Based on the second component, the third component, and the annotation information generated based on network resources, deploy multiple workloads. In response to the multiple workloads being in the running state, verify the attribute information of the multiple workloads and verify network connectivity.
[0067] It should be noted that the annotation information includes Subnet resources and Network resources used by the workloads. The attribute information of the workloads includes network parameters such as network card type, network segment to which the IP address belongs, IP / MAC / routing, whether the VLAN sub-interface is successfully created, and whether the policy route is successfully generated. The running state refers to the Running state. As Figure 11 shown, the workloads can include storage applications, computing applications, business applications, etc.
[0068] In the above embodiment, by constructing a multi-network model plug-in that integrates multiple functions, a network multi-model for a distributed cluster is realized, and the following technical problems are solved: multiple network plug-ins are required in the cluster, and the complexity of cluster deployment and maintenance is high; multiple network plug-ins work together, the boundaries of network problems are unclear, and the complexity of troubleshooting problems is high; multiple network plug-ins lack a unified IPAM management mechanism; only support the network model setting at the workload granularity, lack of implementation solutions at the Namespace granularity, and the usability is poor; due to different network hardware resources required by business applications, users need to customize the scheduling nodes of the workloads, etc.; the application performance of the distributed cluster is improved. Through the configuration of network resources, the network configuration process is simplified, the network configuration efficiency is improved, and the application performance of the distributed cluster is further improved.
[0069] In some specific embodiments, after deploying multiple components in an open-source system based on the images and deployment files of the multi-network model plug-in, the method further includes:
[0070] Detect the status of the components;
[0071] In response to the components being in the normal state, determine that the components have been deployed successfully.
[0072] In the above embodiment, by detecting the component status, it is determined whether the components have been deployed successfully to ensure the reliability of the network configuration process.
[0073] In some specific embodiments, in response to multiple components having been deployed successfully, based on the first component, determining the network resources corresponding to the workloads includes:
[0074] Create initial network resources;
[0075] Based on the first component, perform a legality check on the configuration parameters of the initial network resources. In response to the check being successful, generate target network resources;
[0076] Create a workload;
[0077] Based on the first component, the application space where the workload is located, and the target network resources, determine the network resources and node scheduling labels used by the workload;
[0078] Based on the network resources and node scheduling labels, adjust the annotation information and node scheduling policy corresponding to the workload.
[0079] Specifically, when the user creates Network / Subnet resources through the cloud management platform, after the MultiNet-Webhook component obtains the Network / Subnet resources, it performs a legality check on the configuration parameters of the Network / Subnet resources. If the resources are illegal, the creation of the resources is prohibited and a prompt message is given to the user. Further, when the user creates a workload through the cloud management platform, the MultiNet-Webhook component obtains the workload resources and determines whether there are affinity Subnet resources in the application space where the workload is located. If so, it obtains the Network resources based on the Subnet resources, thereby determining the Subnet, Network resources, and node scheduling labels used by the workload, and updating the corresponding annotation information and node scheduling policy of the workload, thus completing the creation of the workload. Among them, the association relationship of each resource is as Figure 5 shown.
[0080] In the above implementation, the MultiNet-Webhook component integrated in the MultiNet-CNI network plugin performs a legality check on the Network / Subnet resources and matches the corresponding Network / Subnet resources according to the created workload, thereby improving the reliability of the subsequent network configuration process.
[0081] In some specific implementations, it further includes:
[0082] Construct a list of Network / Subnet resources, which stores known legal Network / Subnet resources, and each resource includes a unique label;
[0083] When the user creates Network / Subnet resources through the cloud management platform, call this list and compare the Network / Subnet resources created by the user with the resources in the list;
[0084] In response to a successful comparison, it is determined that the created Network / Subnet resources are legal resources;
[0085] In response to the comparison failure, obtain the configuration parameters of the Network / Subnet resource and perform a legality check. If the resource is illegal, prohibit the creation of the resource and give a user prompt message;
[0086] In the above embodiment, by comparing the list resources with the resources created by the user, legal resources can be directly determined. When it cannot be determined, verification is performed through the configuration parameters, further ensuring the accuracy of the verification. Through a dual-verification method, the verification efficiency is improved, and while the verification efficiency is improved, the verification accuracy is ensured, further improving the reliability of the subsequent network configuration process.
[0087] In some specific embodiments, when the user creates a workload through the cloud management platform, obtain the workload list, which stores the workload names of the Subnet resources with affinity in the application space;
[0088] Based on this workload list, compare the workload name created by the user with the workload names in the list;
[0089] In response to a successful comparison, it indicates that the workload created by the user has affinity Subnet resources, and based on this Subnet resource, determine the Network resource, node scheduling tags, etc.;
[0090] In response to an unsuccessful comparison, obtain the application space where the workload is located, and determine whether this application space has affinity Subnet resources. If so, obtain the Network resource according to the Subnet resource, so as to determine the Subnet, Network resources used by this workload, and node scheduling tags;
[0091] In the above embodiment, by comparing the list resources with the workload created by the user, the Subnet resources of the workload can be directly determined. When it cannot be determined, then judge through the application space where the workload is located. Through a dual-judgment method, the accuracy of resource invocation is improved.
[0092] In some specific embodiments, as Figure 6 shown, before deploying multiple workloads based on the annotation information generated by the second component, the third component, and the network resources, the method further includes:
[0093] Start the second component;
[0094] In response to the second component being started, initialize the second component;
[0095] In response to the second component having been initialized, perform the master election operation for the second component. After the master election is successful, synchronize the first network resource, the second network resource, and the third network resource. The third network resource is the object resource corresponding to the workload, that is, the Pod resource.
[0096] Based on the second component, monitor the third network resource to obtain update events of the third network resource.
[0097] In response to obtaining an update event of the third network resource, determine the status of the third network resource or the network type of the workload corresponding to the third network resource.
[0098] In response to the status of the third network resource being the unscheduled state or the network type of the workload corresponding to the third network resource being the host network, ignore the update event of the third network resource.
[0099] In response to the update event of the third network resource being a non-ignorable event and the update event of the third network resource being a creation event, obtain the annotation information corresponding to the workload.
[0100] Based on the annotation information, allocate an Internet Protocol address for the workload and update the annotation information.
[0101] In response to the update event of the third network resource being a non-ignorable event and the update event of the third network resource being a deletion event, determine the Internet Protocol address recovery method corresponding to the workload according to the type of the third network resource.
[0102] Periodically scan the fixed Internet Protocol address allocation pool. In response to the fixed Internet Protocol address allocation pool including Internet Protocol addresses whose existence time is greater than a preset threshold, recycle the Internet Protocol addresses. The preset threshold can be set according to actual requirements, such as 300 seconds.
[0103] Specifically, the core workflow of MultiNet-Controller is as Figure 6 shown. After the MultiNet-Controller component is started, it enters the component initialization process, mainly establishing a connection with the K8s Apiserver and initializing the IP address pool. The storage structure of the IP address pool is as Figure 7 shown. Among them, using the name of the subnet as the Key, the IP address pool and the fixed IP allocation pool under this subnet can be indexed. The IP address pool follows the sequential allocation strategy and records the usage status of IP addresses in the form of a cursor. Considering the characteristic that the IP address needs to remain unchanged after the reconstruction of the stateful workload, a fixed IP allocation pool is designed to record the IP allocation situation of the stateful workload. The element format of the fixed IP allocation pool is Namespace / PodName: IP; Time.
[0104] Furthermore, since the MultiNet-Controller component adopts a multi-copy deployment method, it is necessary to elect a primary component. The primary election process uses the common renewal lock method of K8s for preemptive primary election. If the replica successfully elects a primary, it enters the subsequent processing flow. Otherwise, it continuously monitors the primary election status and participates in the primary election again after the primary role fails. After the MultiNet-Controller component successfully elects a primary, it is necessary to synchronize the existing data, including Subnet resources, Network resources, and Pod resources, etc. After obtaining the Subnet resources, according to the IP usage recorded in the Subnet resources, restore the IP address pool and fixed IP allocation pool resources corresponding to the Subnet. This mechanism can achieve data recovery in scenarios such as component abnormal restart and primary election role change; furthermore, start the monitoring process for Pod resources to obtain Pod resource update events. After obtaining the Pod resource update events, judge the status of the Pod resources. If the network type of the Pod resources is HostNetwork (host network) or it is in an unscheduled state, then ignore this Pod update event. Otherwise, judge whether the Pod update event is a deletion event according to the deletionTimestamp field of the Pod resources. If it is a create Pod event (in the Kubernetes cluster, various state changes and operation records that occur during the Pod life cycle), then allocate an IP address for the Pod resources. Among them, the IP allocation process is as follows:
[0105] Check whether there is Subnet / Network resource information in the Pod resource annotation information. If not, obtain the default Subnet / Network information, such as Figure 5As shown in the figure; determine whether the Pod resource has a need for a fixed IP based on the above annotation information. If there is a need for a fixed IP, parse the IP address set in the annotation information, denoted as ippool, and determine the legality of the IP address. For stateful workloads, use the sequential allocation method to allocate IPs from ippool in sequence according to the name of the stateful workload. For stateless workloads, use the random allocation method to allocate IPs. If the IP address is successfully allocated and the Pod resource type is a stateful workload, store the Pod and the allocated IP address in the fixed IP allocation pool corresponding to the Subnet resource; if the Pod resource has no need for a fixed IP, obtain the Subnet information in the annotation, denoted as subnetList (multiple subnets can exist), obtain the Subnet resources from subnetList in sequence, and allocate an IP address for the Pod resource. If it is unsuccessful, continue to allocate from the next Subnet resource. If it is successful, end the allocation process. If the IP address allocation fails, record the allocation failure event. Among them, the allocation status of the IP address pool and the fixed IP pool corresponding to the Subnet resource is as Figure 8 shown; if the Pod resource successfully allocates an IP address, update the annotation of the Pod resource, record information such as the IP address, gateway, Mac, and Vlan, and update the status information of the Subnet resource, recording the newly allocated IP address; if it is a delete Pod event, the IP address needs to be recycled. Among them, the IP recycling process is as follows: determine whether the type of the Pod resource is a stateful workload. If it is a stateful workload, store the IP address in the fixed IP address pool corresponding to the Subnet resource in the format of Namespace / PodName:IP. Otherwise, recycle the IP address of the Pod resource and store it in the IP address pool corresponding to the Subnet resource. At the same time, periodically scan the fixed IP allocation pool of the Subnet resource. If the existence time of the elements (i.e., IP addresses) in this fixed IP address pool is greater than 300 seconds, recycle this IP address to the IP address pool. The schematic diagram of the change of the IP pool resource corresponding to the Subnet resource is as Figure 9 shown. After the IP address is successfully recycled, update the status of the Subnet resource.
[0106] In the above implementation, the MultiNet-Controller component integrated in the MultiNet-CNI network plugin allocates and recycles the IP address corresponding to the workload, and supports the fixed IP function for stateful workloads and stateless workloads, so that resources can be reasonably allocated and the resource utilization rate can be improved.
[0107] In some specific embodiments, before deploying multiple workloads based on the annotation information generated from the second component, the third component, and network resources, the method further includes:
[0108] Start the third component;
[0109] In response to the third component having been started, initialize the third component;
[0110] In response to the third component having been initialized, listen for updates to the third network resource based on the third component to obtain update events for the third network resource;
[0111] Obtain update events for the third network resource;
[0112] In response to the update event for the third network resource being a creation event, parse the annotation information to determine whether there are critical parameters;
[0113] In response to detecting critical parameters within a preset time, select a target network model based on the configuration information of the workload and process the network model, where the preset time can be set according to actual requirements, such as 90s;
[0114] In response to the processing being completed and the workload being in a running state, verify the attribute information of the workload and verify network connectivity.
[0115] Specifically, the core implementation logic of the MultiNet-Daemon component is as Figure 10As shown in the figure, it includes: The MultiNet-Daemon component is deployed in the Daemonset (a type of controller in Kubernetes) mode. After the component starts, it completes initialization actions such as authentication, connection, List / Watch with the cluster apiserver. After initialization, the MultiNet-Daemon component listens for update events of Pod resources and obtains Pod resources. Among them, since the MultiNet-Daemon and the MultiNet-Controller components work asynchronously, after obtaining a Pod resource creation event, within a specific time (the preferred value is 90s), it attempts to determine whether key parameters such as IP / MAC / gateway / network model exist in the annotation information of the Pod resource according to the time backoff mechanism. If the acquisition is successful, it enters the next processing flow; otherwise, it ends the current Pod resource processing flow and waits for the next call from Kubernetes to trigger. Further, according to the network model configured for the Pod resource, a network model is selected, and corresponding processing flows are carried out according to different network models. If the selected network type is the VLAN model, the processing flow is as follows: If the network model of the Pod resource is the VLAN model, verify the legality of parameters such as the IP / MAC / gateway of the Pod resource, and obtain the network card list parameters configured in the Subnet resource according to the Subnet resource configured for the Pod resource. Then, sequentially determine whether this network card exists on this node. If it exists, use this network card as the parent network card of the VLAN sub-interface. According to the VLAN_ID, determine whether the VLAN sub-interface exists on this node. If it does not exist, create the VLAN sub-interface. Determine whether the policy route of the network segment of the Subnet resource associated with the Pod resource exists. If it does not exist, create a policy route, indicating that the traffic of this network segment is sent out through this VLAN sub-interface. Create a network card of the veth-pair type for the Pod resource, and configure parameters such as the IP / MAC / routing of the network card, and verify the network connectivity to the gateway. If an error occurs during the above processing, record the error log and generate a Pod resource network event to prompt the user that there is a network configuration error, and wait for the next call from Kubernetes to trigger. If the network model of the Pod resource is the RDMA model, the processing flow is as follows: Obtain the required RDMA network card type and quantity of the Pod resource; establish GRPC (an open-source high-performance remote procedure call RPC framework) communication with Kubernetes to obtain the RDMA network card resources reported by the device_plugin plugin on this node; switch the application space to which the RDMA belongs and complete the IP / MAC / routing configuration of the network card. If an error occurs during the above processing, record the error log and generate a Pod resource network event to prompt the user that there is a network configuration error, and wait for the next call from Kubernetes to trigger.If the network type of the Pod resource is the MacVlan (or IPVlan) model, the processing flow is as follows: Verify the legality of parameters such as the IP / MAC / gateway of the Pod resource, and obtain the network card list parameters configured in the Subnet resource according to the Subnet resource configured for the Pod resource. Sequentially determine whether this network card exists on this node. If it exists, use this network card as the parent network card of the MACVALN sub-interface, create the MACVLAN sub-interface, switch the application space to which the network card belongs, configure parameters such as the IP / MAC / routing of the network card, and verify the network connectivity to the gateway. If an error occurs during the above processing, record the error log and generate a Pod network event to prompt the user that the network configuration is incorrect, and wait for the next call from Kubernetes to trigger.
[0116] In the above embodiment, the multi-network model of the container is implemented through the MultiNet-Daemon component integrated in the MultiNet-CNI network plugin. The network parameters such as the network card, IP, and routing of the container can be configured according to the network type of the Pod as needed, ensuring the network connectivity between containers. Combined with the configuration of the CRD resource, the network configuration process of the user is greatly simplified, and the efficiency and reliability of the network configuration are improved.
[0117] In the above network configuration method, it includes: obtaining the images and deployment files of the multi-network model plugin, where the multi-network model plugin integrates multiple components, and the components at least include a first component for configuring resource access control and setting workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing a container multi-network model; based on the images and deployment files of the multi-network model plugin, deploying multiple components in an open-source system; in response to the completion of the deployment of multiple components, based on the first component, determining the network resources corresponding to the workload, where the network resources at least include a first network resource and a second network resource, the first network resource is used to describe the container network model and the scheduling node of the workload, and the second network resource is used to describe the network resources that can be allocated to the container; based on the second component, the third component, and the annotation information generated based on the network resources, deploying multiple workloads, and in response to the multiple workloads being in a running state, verifying the attribute information of the multiple workloads and verifying network connectivity. In this application, by constructing a multi-network model plugin that integrates multiple functions, a network multi-model of a distributed cluster is realized, and the following technical problems are solved: multiple network plugins are required in the cluster, and the complexity of cluster deployment and maintenance is high; multiple network plugins work together, the boundaries of network problems are unclear, and the complexity of troubleshooting problems is high; there is a lack of a unified IPAM management mechanism for multiple network plugins; only the network model setting at the workload granularity is supported, and there is a lack of a solution at the Namespace granularity, resulting in poor usability; due to different network hardware resources required by business applications, users need to customize the scheduling nodes of workloads, etc.; the application performance of the distributed cluster is improved, and through the configuration of network resources, the network configuration process is simplified, the network configuration efficiency is improved, and further the application performance of the distributed cluster is improved.
[0118] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0119] It should be understood that although Figure 3 - Figure 11 the steps in the flowchart of Figure 3 - Figure 11 are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover,
[0120] An embodiment of the present application further provides a network configuration device, as Figure 12 shown, including a data acquisition module, a first deployment module, a resource determination module, and a second deployment module, where:
[0121] The data acquisition module is used to acquire the images and deployment files of multi-network model plugins. The multi-network model plugins integrate multiple components, and the components at least include a first component for configuring resource admission control and setting workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing container multi-network models;
[0122] The first deployment module is used to deploy multiple components in an open-source system based on the images and deployment files of the multi-network model plugins;
[0123] The resource determination module is used to, in response to the completion of the deployment of multiple components, determine the network resources corresponding to the workload based on the first component. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the workload scheduling node, and the second network resource is used to describe the network resources that can be allocated to the container;
[0124] The second deployment module is used to deploy multiple workloads based on the second component, the third component, and the annotation information generated based on the network resources, verify the attribute information of the multiple workloads in response to the multiple workloads being in a running state, and verify network connectivity.
[0125] As a preferred embodiment, in the embodiment of the present invention, the device further includes a detection module, and the detection module is specifically used for:
[0126] Detect the status of the components;
[0127] In response to the components being in a normal state, determine that the components have been deployed successfully.
[0128] As a preferred embodiment, in the embodiment of the present invention, the resource determination module is specifically used for:
[0129] Create initial network resources;
[0130] Based on the first component, perform a legality check on the configuration parameters of the initial network resources, and generate target network resources in response to the successful check;
[0131] Create a workload;
[0132] Based on the first component, the application space where the workload is located, and the target network resources, determine the network resources and node scheduling tags used by the workload;
[0133] Adjust the annotation information corresponding to the workload and the node scheduling policy based on the network resources and node scheduling tags.
[0134] As a preferred implementation manner, in the embodiment of the present invention, the second deployment module is specifically configured to:
[0135] Start the second component;
[0136] In response to the second component being started, initialize the second component;
[0137] In response to the second component being initialized, perform the master selection operation of the second component, and after the master selection is successful, synchronize the first network resource, the second network resource, and the third network resource, where the third network resource is the object resource corresponding to the workload.
[0138] As a preferred implementation manner, in the embodiment of the present invention, the second deployment module is specifically further configured to:
[0139] Monitor the third network resource based on the second component to obtain the update event of the third network resource;
[0140] In response to obtaining the update event of the third network resource, determine the status of the third network resource or the network type of the workload corresponding to the third network resource;
[0141] In response to the status of the third network resource being the unscheduled state or the network type of the workload corresponding to the third network resource being the host network, ignore the update event of the third network resource;
[0142] In response to the update event of the third network resource being a non-ignorable event and the update event of the third network resource being a creation event, obtain the annotation information corresponding to the workload;
[0143] Based on the annotation information, allocate an Internet protocol address for the workload and update the annotation information;
[0144] In response to the update event of the third network resource being a non-ignorable event and the update event of the third network resource being a deletion event, determine the Internet protocol address recovery method corresponding to the workload according to the type of the third network resource;
[0145] Periodically scan the fixed Internet protocol address allocation pool, and in response to the fixed Internet protocol address allocation pool including Internet protocol addresses with an existence time greater than a preset threshold, recycle the Internet protocol addresses.
[0146] As a preferred implementation manner, in the embodiment of the present invention, the second deployment module is specifically further configured to:
[0147] Start the third component;
[0148] Initialize the third component in response to the third component having been started;
[0149] In response to the third component having been initialized, listen for the third network resource based on the third component to obtain an update event of the third network resource.
[0150] As a preferred implementation manner, in the embodiments of the present invention, the second deployment module is further specifically configured to:
[0151] Obtain an update event of the third network resource;
[0152] In response to the update event of the third network resource being a creation event, parse the annotation information to determine whether there are critical parameters;
[0153] In response to detecting critical parameters within a preset time, select a target network model based on the configuration information of the workload, and process the network model;
[0154] In response to the processing being completed and the workload being in a running state, verify the attribute information of the workload and verify the network connectivity.
[0155] For the description of the features in the corresponding embodiments of the network configuration device, reference may be made to the relevant descriptions in the corresponding embodiments of the network configuration method, which will not be elaborated here one by one. Each module in the above network configuration device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the electronic device in hardware form or independent of it, or stored in the memory of the electronic device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0156] In one embodiment, an electronic device is provided. The electronic device can be a terminal, and its internal structure diagram can be as Figure 13 shown. The electronic device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. The computer program, when executed by the processor, implements a network configuration method. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen. The input device of the electronic device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the electronic device, or an external keyboard, a touchpad, or a mouse, etc.
[0157] Those skilled in the art can understand,Figure 13 The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the electronic device to which the solution of this application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0158] An embodiment of this application provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in the embodiment of the network configuration method, including:
[0159] S1: Obtain the image and deployment file of the multi-network model plugin. The multi-network model plugin integrates multiple components, and the components at least include a first component for configuring resource admission control and setting the workload scheduling node, a second component for managing the container Internet protocol address, and a third component for providing the container multi-network model.
[0160] S2: Based on the image and deployment file of the multi-network model plugin, deploy multiple components in the open-source system.
[0161] S3: In response to the completion of the deployment of multiple components, based on the first component, determine the network resources corresponding to the workload. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the workload scheduling node, and the second network resource is used to describe the network resources that can be allocated to the container.
[0162] S4: Based on the second component, the third component, and the annotation information generated based on the network resources, deploy multiple workloads. In response to the multiple workloads being in the running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0163] An embodiment of this application also provides a computer-readable storage medium. A computer program is stored in the computer-readable storage medium. Wherein, the computer program is configured to execute the steps in the embodiment of the network configuration method when running, including:
[0164] S1: Obtain the image and deployment file of the multi-network model plugin. The multi-network model plugin integrates multiple components, and the components at least include a first component for configuring resource admission control and setting the workload scheduling node, a second component for managing the container Internet protocol address, and a third component for providing the container multi-network model.
[0165] S2: Based on the image and deployment file of the multi-network model plugin, deploy multiple components in the open-source system.
[0166] S3: In response to the completion of the deployment of multiple components, based on the first component, determine the network resources corresponding to the workload. The network resources include at least a first network resource and a second network resource. The first network resource is used to describe the container network model and the scheduling node of the workload, and the second network resource is used to describe the network resources that can be allocated to the container.
[0167] S4: Based on the second component, the third component, and the annotation information generated based on the network resources, deploy multiple workloads. In response to the multiple workloads being in the running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0168] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drives, read-only memory (ROM), random access memory (RAM), mobile hard disks, magnetic disks, or optical discs, and other media that can store computer programs.
[0169] The embodiments of the present application also provide a computer program product. The above computer program product includes a computer program. When the computer program is executed by a processor, it implements the steps in the embodiment of the network configuration method, including:
[0170] S1: Obtain the image and deployment file of the multi-network model plugin. The multi-network model plugin integrates multiple components. The components include at least a first component for configuring resource admission control and setting the workload scheduling node, a second component for managing the container Internet protocol address, and a third component for providing the container multi-network model.
[0171] S2: Based on the image and deployment file of the multi-network model plugin, deploy multiple components in the open-source system.
[0172] S3: In response to the completion of the deployment of multiple components, based on the first component, determine the network resources corresponding to the workload. The network resources include at least a first network resource and a second network resource. The first network resource is used to describe the container network model and the scheduling node of the workload, and the second network resource is used to describe the network resources that can be allocated to the container.
[0173] S4: Based on the second component, the third component, and the annotation information generated based on the network resources, deploy multiple workloads. In response to the multiple workloads being in the running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0174] Embodiments of the present application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which when executed by a processor implements the steps in the embodiment of the network configuration method, including:
[0175] S1: Obtain the image and deployment file of the multi-network model plug-in. The multi-network model plug-in integrates multiple components, and the components at least include a first component for configuring resource access control and setting the workload scheduling node, a second component for managing the container Internet protocol address, and a third component for providing the container multi-network model.
[0176] S2: Based on the image and deployment file of the multi-network model plug-in, deploy multiple components in the open-source system.
[0177] S3: In response to the completion of the deployment of multiple components, based on the first component, determine the network resources corresponding to the workload. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the workload scheduling node, and the second network resource is used to describe the network resources that can be allocated to the container.
[0178] S4: Based on the second component, the third component, and the annotation information generated based on the network resources, deploy multiple workloads. In response to the multiple workloads being in the running state, verify the attribute information of the multiple workloads and verify the network connectivity.
[0179] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0180] The above has introduced in detail a network configuration method, device, electronic device, and storage medium provided by this application. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A network configuration method, characterized in that, The method includes: Obtain the images and deployment files of the multi-network model plug-in. The multi-network model plug-in integrates multiple components, and the components at least include a first component for configuring resource access control and setting workload scheduling nodes, a second component for managing container Internet protocol addresses, and a third component for providing a container multi-network model; Based on the images and deployment files of the multi-network model plug-in, deploy multiple of the components in an open-source system; In response to the completion of the deployment of multiple of the components, based on the first component, determine the network resources corresponding to the workload. The network resources at least include a first network resource and a second network resource. The first network resource is used to describe the container network model and the scheduling node of the workload, and the second network resource is used to describe the network resources allocable to the container; Based on the second component, the third component, and the annotation information generated based on the network resources, deploy multiple workloads. In response to the multiple workloads being in a running state, verify the attribute information of the multiple workloads and verify network connectivity.
2. The network configuration method according to claim 1, wherein After deploying multiple of the components in an open-source system based on the images and deployment files of the multi-network model plug-in, the method further includes: Detect the status of the components; In response to the components being in a normal state, determine that the components have been deployed successfully.
3. The network configuration method according to claim 1, characterized in that In response to the completion of the deployment of multiple of the components, based on the first component, determining the network resources corresponding to the workload includes: Create initial network resources; Based on the first component, perform a legality check on the configuration parameters of the initial network resources. In response to a successful check, generate target network resources; Create a workload; Based on the first component, the application space where the workload is located, and the target network resources, determine the network resources and node scheduling tags used by the workload; Based on the network resources and the node scheduling tags, adjust the annotation information and node scheduling policy corresponding to the workload.
4. The network configuration method according to claim 1, wherein Before deploying multiple workloads based on the second component, the third component, and the annotation information generated based on the network resources, the method further includes: Start the second component; In response to the second component being started, initialize the second component; In response to the completion of the initialization of the second component, perform a primary election operation on the second component. After the primary election is successful, synchronize the first network resource, the second network resource, and the third network resource. The third network resource is the object resource corresponding to the workload.
5. The network configuration method according to claim 4, wherein Deploying multiple workloads based on the second component, the third component, and the annotation information generated based on the network resources includes: Monitor the third network resource based on the second component to obtain update events of the third network resource; in response to obtaining the update events of the third network resource, determine the status of the third network resource or the network type of the workload corresponding to the third network resource; In response to the status of the third network resource being an unscheduled state or the network type of the workload corresponding to the third network resource being the host network, ignore the update events of the third network resource; In response to the update event of the third network resource being a non-ignorable event and the update event of the third network resource being a creation event, obtain the annotation information corresponding to the workload; Based on the annotation information, allocate an Internet Protocol address for the workload and update the annotation information; In response to the update event of the third network resource being a non-ignorable event and the update event of the third network resource being a deletion event, determine the Internet Protocol address recovery method corresponding to the workload according to the type of the third network resource; periodically scan the fixed Internet Protocol address allocation pool, and in response to the fixed Internet Protocol address allocation pool including an Internet Protocol address whose existence time is greater than a preset threshold, recycle the Internet Protocol address.
6. The network configuration method according to claim 5, wherein Before deploying multiple workloads based on the second component, the third component, and the annotation information generated based on the network resource, the method further includes: Start the third component; In response to the third component having been started, initialize the third component; In response to the third component having been initialized, based on the third component, monitor the third network resource based on the third component to obtain the update event of the third network resource.
7. The network configuration method according to claim 6, wherein Deploying multiple workloads based on the second component, the third component, and the annotation information generated based on the network resource includes: Obtain the update event of the third network resource; In response to the update event of the third network resource being a creation event, parse the annotation information to determine whether there is a key parameter; In response to detecting the key parameter within a preset time, select a target network model based on the configuration information of the workload and process the network model; In response to the processing being completed and the workload being in a running state, verify the attribute information of the workload and verify network connectivity.
8. A network configuration device, characterized in that, The device includes: A data acquisition module, configured to acquire the image and deployment file of a multi-network model plugin, the multi-network model plugin integrating multiple components, and the components at least including a first component for configuring resource admission control and setting workload scheduling nodes, a second component for managing container Internet Protocol addresses, and a third component for providing a container multi-network model; A first deployment module, configured to deploy multiple of the components in an open-source system based on the image and deployment file of the multi-network model plugin; A resource determination module, configured to, in response to multiple of the components having been deployed, determine the network resource corresponding to the workload based on the first component, the network resource at least including a first network resource and a second network resource, the first network resource being used to describe the container network model and the workload scheduling node, and the second network resource being used to describe the network resources allocable to the container; A second deployment module, configured to deploy multiple workloads based on the second component, the third component, and the annotation information generated based on the network resource, and in response to the multiple workloads being in a running state, verify the attribute information of the multiple workloads and verify network connectivity.
9. An electronic device, characterized in that, Includes: A memory, configured to store a computer program; A processor for implementing the steps of the network configuration method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of the network configuration method according to any one of claims 1 to 7 when executed by a processor.
