Deployment unit configuration method and device of cloud host, equipment, storage medium and program product
By creating aggregation ports and virtual LAN identifiers in the cloud host, the problems of idle cloud host resources and network redundancy are solved, and stable communication between the target deployment unit and the cloud host and external network is achieved, thereby improving resource utilization and business operation efficiency.
Patent Information
- Application Number
- CN202511702792.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-10
AI Technical Summary
In existing technologies, when cloud hosts and Pods work together, cloud host resources cannot be fully utilized. Pods and cloud hosts are in the same network layer, resulting in idle network resources and inability to access external networks. Furthermore, in multi-tenant scenarios, network namespace redundancy limits the flexible allocation of resources.
By creating aggregation ports and virtual LAN identifiers in the cloud host, the network configuration of the target deployment unit is realized. The network namespace connecting the cloud host and the deployment unit is configured with virtual Ethernet and routing rules to ensure that the target deployment unit can access the external network with the help of the cloud host's network resources, thus achieving Layer 2 and Layer 3 isolation.
It improves the utilization of hardware computing power and network bandwidth, reduces resource idleness, builds a layered and orderly network architecture, ensures stable communication between deployment units and cloud hosts and external networks, meets the collaborative work needs of business instances in cloud-native scenarios, and improves overall business operation efficiency.
Smart Images

Figure CN121509430A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of cloud computing, and in particular to a cloud host container configuration method, device, equipment, storage medium and program product. BACKGROUND
[0002] A cloud host is a virtual computing node built based on cloud computing technology, and can allocate resources such as CPU, memory, storage, etc. on demand. In a cloud native technology system, OpenStack (a cloud host management platform) and K8s (Kubernetes, a container orchestration platform) are two core tools of the cloud host. OpenStack is the core of underlying resource management, and can create, schedule and maintain cloud hosts in batches to provide a stable virtual hardware environment for upper-layer businesses. K8s focuses on the management of upper-layer containerized businesses, and a Pod is the smallest deployment unit in K8s, and each Pod corresponds to a lightweight business instance (such as an e-commerce order service or a user login module).
[0003] With the increasing complexity of enterprise businesses, the cloud hosts managed by OpenStack and the Pods scheduled by K8s need to work together, and the business instances in the Pods need to frequently access the core resources on the cloud hosts. The same network communication between the two is a prerequisite for the normal operation of the business. In the prior art, in order to realize the collaborative work of the cloud host and the Pod, the K8s network model is set to the Neutron network model (which is specially responsible for providing configurable and scalable virtual network services for cloud hosts on OpenStack), the K8s tenant creation event is listened to and the corresponding network resources are created by calling the Neutron API to realize the intercommunication between the Pod and the virtual machine. However, this scheme leads to the fact that the cloud host resources cannot be fully utilized, the Pod and the cloud host are in the same layer network architecture, and the network resources such as the network card and bandwidth of the cloud host only serve themselves and cannot be used by the Pod to access the external network. In addition, the network namespace is redundant in the multi-tenant scenario, which further limits the flexible allocation of cloud host resources, resulting in the idle of resources such as hardware computing power and network bandwidth. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a deployment unit configuration method, device, equipment, storage medium and program product of a cloud host, which can realize the collaborative work of the cloud host and the deployment unit, enable the deployment unit to realize external communication through the cloud host, fully utilize the cloud host resources, and avoid the idle of cloud host resources.
[0005] To achieve the above purpose, the embodiments of the present application provide a deployment unit configuration method of a cloud host, comprising: When it is detected that there is a target deployment unit to be configured in the cloud host, obtaining configuration information of the target deployment unit; creating a virtual network port of the target deployment unit according to the configuration information; determining a virtual local area network identifier of the target deployment unit according to the aggregation port of the cloud host; adding the virtual network port into the aggregation port of the cloud host according to the virtual local area network identifier; network configuring the target deployment unit by using the virtual local area network identifier.
[0006] As an improvement of the above scheme, the network configuring the target deployment unit by using the virtual local area network identifier comprises: creating a virtual Ethernet pair according to the virtual local area network identifier; connecting network namespaces of the cloud host and the target deployment unit by using the virtual Ethernet pair respectively, and configuring an Internet Protocol address of the virtual network port by using the virtual Ethernet pair; enabling the virtual Ethernet pair; configuring a routing rule in the network namespace of the target deployment unit.
[0007] As an improvement of the above scheme, the creating a virtual Ethernet pair according to the virtual local area network identifier comprises: taking a software-defined network card of the cloud host as a master card, and taking the virtual local area network identifier as a traffic differentiation identifier to create a virtual Ethernet pair.
[0008] As an improvement of the above scheme, the determining a virtual local area network identifier of the target deployment unit according to the aggregation port of the cloud host comprises: obtaining all sub-port information of the aggregation port of the cloud host that has been associated; if the number of the sub-ports is 0, generating the virtual local area network identifier of the target deployment unit as 1; if the number of the sub-ports is not 0, extracting virtual local area network identifiers bound by each sub-port and determining a maximum value among the virtual local area network identifiers, and adding 1 to the maximum value to generate the virtual local area network identifier of the target deployment unit.
[0009] As an improvement of the above scheme, the method further comprises: when detecting that the current in-memory database does not exist the aggregation port corresponding to the cloud host, obtaining a network port of the cloud host; taking the network port as a master port of port aggregation, and calling a network component interface of a software-defined network to create an aggregation port; writing the created aggregation port into the in-memory database.
[0010] As an improvement of the above scheme, the obtaining a network port of the cloud host comprises: obtain a network address of the cloud host; query a network port of the cloud host according to the network address and the network identification.
[0011] To achieve the above object, the embodiment of the present application further provides a cloud host deployment unit configuration device, which comprises: a configuration information obtaining module, configured to obtain configuration information of a target deployment unit to be configured in a cloud host when it is detected that the target deployment unit exists in the cloud host; a virtual network port creating module, configured to create a virtual network port of the target deployment unit according to the configuration information; a virtual local area network identification determining module, configured to determine a virtual local area network identification of the target deployment unit according to a convergence port of the cloud host; a virtual local area network identification storing module, configured to add the virtual network port into the convergence port of the cloud host according to the virtual local area network identification; a network configuration module, configured to perform network configuration on the target deployment unit by using the virtual local area network identification.
[0012] To achieve the above object, the embodiment of the present application further provides a cloud host deployment unit configuration device, which comprises a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, and the processor implements the cloud host deployment unit configuration method of any one of the above embodiments when executing the computer program.
[0013] To achieve the above object, the embodiment of the present application further provides a computer readable storage medium, which comprises a stored computer program, wherein the computer readable storage medium performs the cloud host deployment unit configuration method of any one of the above embodiments when the computer program runs.
[0014] To achieve the above object, the embodiment of the present application further provides a computer program product, which comprises computer instructions, and the computer instructions implement the cloud host deployment unit configuration method of any one of the above embodiments when executed by a processor.
[0015] Compared with the prior art, the cloud host deployment unit configuration method, device, equipment, storage medium and program product provided by the application can associate the virtual network port of the target deployment unit to the aggregation port of the cloud host, and realize network configuration based on the virtual local area network identifier, so that the target deployment unit can access the external network by means of the network card, bandwidth and other network resources of the cloud host, break the limitation that the cloud host resources in the traditional scheme only serve themselves, improve the utilization rate of hardware computing power and network bandwidth, and reduce resource idling. In addition, the network ports of multiple deployment units are managed by the aggregation port, and the same cloud host is used for the second layer isolation of multiple deployment units, so as to avoid network namespace redundancy in the multi-tenant scenario and build a hierarchical and orderly network architecture. At the same time, the virtual Ethernet is connected and the default route is configured, so as to ensure the stable communication of the deployment unit, the cloud host and the external network, meet the network demand of business instance cooperative work in the cloud native scenario, and improve the overall business operation efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 is the overall flowchart of the cloud host deployment unit configuration method provided by the embodiment of the application; Figure 2 is the flowchart of creating the cloud host aggregation port provided by the embodiment of the application; Figure 3 is another flowchart of creating the cloud host aggregation port provided by the embodiment of the application; Figure 4 is the flowchart of the cloud host deployment unit configuration method provided by the embodiment of the application; Figure 5 is another flowchart of the cloud host deployment unit configuration method provided by the embodiment of the application; Figure 6 is the flowchart of the network configuration of the target deployment unit provided by the embodiment of the application; Figure 7 is the network topology structure schematic diagram of the cloud host and the deployment unit provided by the embodiment of the application; Figure 8 is the structure block diagram of the cloud host deployment unit configuration device provided by the embodiment of the application; Figure 9 is the structure block diagram of the cloud host deployment unit configuration device provided by the embodiment of the application. DETAILED DESCRIPTION
[0017] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0018] Neutron is a network component of OpenStack, responsible for managing and configuring the network part of cloud hosts. Neutron provides rich network functions such as private network, external network access, subnet definition, port connection, routing, floating IP, security group, etc., to meet the network needs of complex cloud environments.
[0019] Kubernetes CNI (Container Network Interface) is an open standard designed to provide flexible and pluggable network solutions for Kubernetes clusters. By separating network functions and configurations from the container runtime environment, various network plugins such as Calico and Flannel can run independently and integrate with Kubernetes. CNI plugins are responsible for allocating IP addresses, creating virtual network devices, and implementing network connections, supporting a variety of network technologies and protocols. It allows users to select and combine different plugins according to their needs, enabling flexible management and control of container networks, suitable for on-premises data centers, public clouds, and hybrid cloud environments. CNI also supports advanced features such as fine-grained network policies, multi-tenant isolation, load balancing, and service discovery, providing extensive network selection and configuration flexibility to ensure reliable network connectivity and communication.
[0020] The embodiment of the application constructs a cooperative network architecture of OpenStack and Kubernetes by utilizing the unified management capability of the Neutron component on cloud host network resources and the plug-in network configuration characteristics of Kubernetes CNI. With the fine configuration capability of Neutron on cloud host private network, subnet, port (including aggregation port), VLAN (Virtual Local Area Network) identifier, virtual network identifier and other resources, the underlying network resources are allocated for the target deployment unit (such as Pod) and cross-level isolation is realized. On the other hand, the virtual network port and IP address resources managed by Neutron are dynamically injected into the Kubernetes cluster through the CNI interface, and the container network adaptation operations such as virtual Ethernet pair creation, routing configuration and the like of the Pod and cloud host network namespace are completed by the CNI plug-in, so that the Pod can not only reuse the Neutron network channel of the cloud host to access the external network, but also can guarantee the flexible expansion and multi-tenant isolation demand of the container network through the standardized interface of CNI, finally solving the problem of network resource fragmentation of cloud host and Pod in the traditional architecture, realizing the efficient cooperation of the underlying cloud host resources and the upper container service.
[0021] Referring to Figure 1 , Figure 1is the overall flowchart of the deployment unit configuration method of the cloud host provided by the embodiment of the application, the application provides an Openstack cloud host-based deployment unit (such as a container) network implementation method, which is executed in two stages. Stage one includes steps 1.1-1.3, which is the initialization deployment stage of CNI. It mainly involves creating a Trunk resource through the Openstack Neutron API according to the SDN (Software-Defined Networking, software-defined network) network information of the current cloud host, and persisting the Trunk information. The key steps of this stage include creating a Trunk resource according to the characteristics and requirements of the current cloud host network environment, and persisting the created Trunk information for subsequent network configuration and management. Stage two includes steps 2.1-2.5, which is the Kubernetes configuration deployment unit (such as a Pod) stage. CNI creates a Port and Port security group, rate limiting, etc. information through the Openstack Neutron API according to the user-defined network configuration information, then binds the created Port to the Trunk of stage one as a Subport according to the read persistent Trunk information, and finally configures the network in the PodNamespace according to the Port information, such as configuring the corresponding network card IP and routing information, so as to realize the communication between containers and the external network.
[0022] The application realizes the two-layer network isolation of the Pod on the Openstack cloud host through the Trunk resource model of Neutron, and realizes the three-layer network isolation through the network VNI information of the Port. By persisting the key network information, efficient resource binding and management can be realized during the container creation and configuration process, and a stable and reliable foundation is provided for the network communication between containerized applications.
[0023] Referring to Figure 2 , Figure 2 is the flowchart of creating a cloud host Trunk provided by the embodiment of the application. When creating a Trunk, steps S11-S13 are included. Referring to Figure 3 , Figure 3 is another flowchart of creating a cloud host Trunk provided by the embodiment of the application. The steps S11-S13 are described in detail below. Figure 3
[0024] S11, when it is detected that there is no Trunk corresponding to the cloud host in the current in-memory database, the network port of the cloud host is acquired.
[0025] Exemplarily, the trunk port is a trunk carrier of the cloud host network resource, and is used for centralized management of a plurality of sub-ports. When the trunk information corresponding to the current cloud host is not queried in the in-memory database, it is indicated that the network trunk resource of the cloud host has not been initialized, and the basic network port of the cloud host needs to be acquired first, so as to provide a main port carrier for subsequent creation of the trunk.
[0026] Further, the acquiring the network port of the cloud host comprises: acquiring a network identifier and a network address of the cloud host; and querying the network port of the cloud host according to the network identifier and the network address.
[0027] Exemplarily, the network identifier of the cloud host is a three-layer network ID (corresponding to a unique identifier of a subnet or a network in OpenStack), and the network address is an IP address of the cloud host. Through the two parameters, the unique identifier PortId of the physical / virtual network port Port bound to the cloud host can be queried by calling the OpenStack Neutron API (a core management interface of an SDN network). For example, if the three-layer network ID of the cloud host is net-123, and the IP address is 192.168.1.10, then by using the port query interface of the Neutron API, the PortId corresponding to the cloud host can be accurately located as port-456, which is used as the basis for subsequent creation of the trunk.
[0028] In the embodiment of the application, whether the trunk information exists in the in-memory database is detected first, so as to avoid repeated creation of resources. Then, the three-layer network ID and the IP address of the cloud host are used to accurately query the network port PortId, so as to ensure that the subsequent trunk creation has a clear main port carrier, lay a foundation for network resource association of the cloud host and the container in the SDN network, and improve the accuracy and efficiency of network resource initialization.
[0029] S12, taking the network port as a main port of port aggregation, and calling a network component interface of a software-defined network to create a trunk port.
[0030] Exemplarily, the network port of the cloud host acquired in S11 is taken as a main port (Trunk Port) of the trunk, a trunk creation request is sent by calling the OpenStack Neutron API, the request specifies the main port ID, a network isolation strategy and other parameters, and the Neutron generates a corresponding trunk resource in the SDN network, such as trunk-789, which is used as a trunk node of a sub-port of a subsequent deployment unit (such as a Pod).
[0031] S13, writing the created trunk port into the in-memory database.
[0032] Exemplary, the in-memory database refers to a memory-based high-speed storage system (such as Redis), which has the characteristics of low delay and high throughput, and is suitable for storing temporary or critical data that needs to be frequently accessed. After writing the created Trunk information (including TrunkID, master port PortId, creation time, etc.) into the in-memory database, the CNI plug-in can quickly read the Trunk information from the in-memory database when creating and configuring the deployment unit of Kubernetes, without the need to repeatedly call the Neutron API query, thereby improving the efficiency of container network configuration.
[0033] In the embodiment of the present application, based on the SDN network architecture (OpenStack Neutron), the initialization of the cloud host aggregation port is completed, first, the memory database is detected to avoid resource redundancy, then the three-layer network ID and IP are used to accurately locate the PortId of the cloud host, and the Neutron API is called to create a Trunk with the PortId as the master port, and the Trunk information is written into the in-memory database to realize efficient reuse. Both ensure the accurate binding of Trunk resources and cloud host network, and provide efficient support for the subsequent binding of the sub-port of the deployment unit of Kubernetes through the fast access characteristics of the in-memory database, and finally improve the stability, accuracy and configuration efficiency of the container network initialization, and lay a foundation for the network cooperation of OpenStack and Kubernetes.
[0034] Referring to Figure 4 , Figure 4 is a flowchart of a deployment unit configuration method of a cloud host provided by an embodiment of the present application, and the deployment unit configuration method of the cloud host comprises steps S1-S5. Referring to Figure 5 , Figure 5 is another flowchart of a deployment unit configuration method of a cloud host provided by an embodiment of the present application, and the following will be described in combination with Figure 5 The above steps S1-S5 will be described in detail.
[0035] S1, when it is detected that there is a target deployment unit to be configured in the cloud host, the configuration information of the target deployment unit is obtained.
[0036] Exemplarily, the configuration information includes network requirement parameters of the target deployment unit, such as a tenant ID, a subnet ID (corresponding to a three-layer network ID of OpenStack Neutron), an IP address (static allocation or dynamic acquisition requirement), a security group rule (such as an allowed inbound / outbound port), a bandwidth limit threshold, a VLAN isolation requirement, and the like. The target deployment unit to be configured refers to a target deployment unit that has been scheduled to the current cloud host by Kubernetes, but has not completed network initialization, such as not binding a virtual network port, not configuring an IP and a route, and the like, and cannot communicate with the outside; and the configured deployment unit has completed network binding and does not need to repeat the process. The life cycle event of the deployment unit can be captured in real time through a container runtime interface or a listening mechanism of a CNI plug-in of Kubernetes, and when the deployment unit is scheduled to the cloud host and the network state is not ready, it is determined that the target deployment unit to be configured, and the step is triggered.
[0037] S2, creating a virtual network port of the target deployment unit according to the configuration information.
[0038] Exemplarily, the virtual network port (Port) refers to a virtual network interface managed by OpenStack Neutron, is a logical entrance for the target deployment unit to access the SDN network, is associated with network attributes such as an IP address, a subnet, a security group, a VNI (Virtual Network Identifier), and a VID (VLAN Identifier), and is equivalent to a virtual network card of the target deployment unit in the cloud network. Based on the configuration information obtained in step S1, a Port creation request is sent to Neutron by calling an OpenStack Neutron API, and the request carries a tenant ID (realizing multi-tenant isolation), a subnet ID (specifying a belonging network), an IP address requirement (such as a static IP or a DHCP dynamic allocation), a security group ID (associating a preset access rule), a bandwidth limit parameter, and the like; after receiving the request, Neutron allocates resources in the corresponding subnet, generates a unique virtual network port identifier, and binds the configuration information to the virtual network port, thereby completing the creation of the virtual network port. S3, determining a virtual local area network identifier of the target deployment unit according to a convergence port of the cloud host.
[0039] Exemplarily, the Trunk information of the convergence port is read from the in-memory database to locate the Trunk resource corresponding to the current cloud host, including a Trunk ID, a main port, and all Subport information associated with the main port.
[0040] Further, the step S3 specifically comprises: acquiring all sub-port information associated in the aggregation port of the cloud host; if the number of the sub-ports is 0, generating the virtual local area network identifier of the target deployment unit as 1; if the number of the sub-ports is not 0, extracting the virtual local area network identifier bound by each sub-port and determining the maximum value, and adding 1 to the maximum value to generate the virtual local area network identifier of the target deployment unit.
[0041] For example, all sub-ports Subport bound under the Trunk are traversed, and the virtual local area network identifier VID allocated by each sub-port Subport is extracted. If the cloud host has not yet completed network configuration and bound to the Trunk for any target deployment unit, there is no sub-port Subport under the Trunk, that is, the number of sub-ports is 0, at this time, the initial VID is allocated for this target deployment unit, such as the initial VID is 1; if there is a sub-port Subport, the maximum VID is filtered out, and 1 is added as the VID of the target deployment unit, such as the existing maximum VID is 5, and the VID of the target deployment unit is 6, so as to realize the self-increment allocation of the VID number.
[0042] In the embodiment of the application, the network isolation context of the cloud host is associated through the Trunk information, so that the different target deployment units on the same cloud host realize the two-layer network isolation through the unique and self-increment VID, the traffic interference between the deployment units is avoided, and the network security is ensured.
[0043] S4, according to the virtual local area network identifier, adding the virtual network port to the aggregation port of the cloud host.
[0044] For example, after determining the Virtual Local Area Network (VID) of the target deployment unit, the virtual network port created for it needs to be associated as a subport with the cloud host's aggregation port trunk. This can be done by calling the OpenStack Neutron API to send an add subport request to Neutron. The request explicitly specifies the unique identifier of the trunk (TrunkID, read from the in-memory database), the unique identifier of the port to be added (PortId), and the corresponding VID. Upon receiving the request, Neutron adds an association record for the port in the trunk configuration, marking it as a subport under the trunk and binding it to the corresponding VID, thus achieving a three-layer association of "Trunk-VID-Subport". After adding the subport, the updated trunk information (including the newly added subport's PortId, VID, and association time) needs to be synchronously written to the in-memory database, overwriting the original trunk record. This way, when configuring networks for other target deployment units, the latest trunk information can be read from the in-memory database, ensuring the continuity of VID allocation and the consistency of trunk resource management. In addition, this process binds the virtual network port to the aggregation port through VID, which not only realizes the access registration of the target deployment unit in the cloud host network, but also ensures that the traffic of different subports under the same trunk does not interfere with each other through the layer 2 isolation feature of VID.
[0045] S5. Configure the network for the target deployment unit using the virtual local area network identifier.
[0046] Further, see Figure 6 , Figure 6 This is a flowchart of network configuration for a target deployment unit provided in an embodiment of the present invention. Step S5 specifically includes steps S51 to S54. It is also combined with... Figure 5 The above steps S51 to S54 are explained in detail.
[0047] S51. Create a virtual Ethernet pair based on the virtual LAN identifier.
[0048] For example, a virtual Ethernet pair (Veth Pair) refers to a pair of virtual network devices, with each end acting like a virtual network cable interface. Traffic received at one end is directly forwarded to the other, and it is commonly used for communication between different network namespaces. Since the target deployment unit and the cloud host belong to different network namespaces (which need to be isolated), but need to communicate through the network resources of the cloud host, the virtual Ethernet pair acts as a bridge across namespaces, enabling traffic forwarding between the two and serving as the core channel for the target deployment unit to access the cloud host network.
[0049] Further, step S51 specifically includes: using the software-defined network interface card (NIC) of the cloud host as the primary NIC, and using the virtual LAN identifier as the traffic differentiation identifier to create a virtual Ethernet pair.
[0050] For example, the SDN network interface card (NIC) of a cloud host (such as a virtual NIC managed by OpenStack Neutron, associated with a trunk master port) is the main exit point for accessing the external network. When creating a virtual Ethernet pair, one end is bound to the host namespace where the SDN NIC resides and associated with a Virtual LAN identifier, so that traffic passing through this end carries a VID label; the other end is temporarily located in the host namespace, waiting to be moved to the namespace of the target deployment unit later. This process uses the VID to distinguish the traffic of the target deployment unit from the traffic of other deployment units, laying the foundation for Layer 2 isolation.
[0051] It should be noted that network namespaces refer to the network isolation technology provided by the Linux kernel. Each namespace has independent network devices, IP addresses, routing tables, etc., which can achieve network environment isolation for different applications.
[0052] In this embodiment of the invention, by creating a virtual Ethernet pair with an SDN network card as the main carrier and a VID as the distinguishing identifier, a dedicated communication channel between the target deployment unit and the cloud host is constructed. Furthermore, the VID enables Layer 2 isolation labeling of traffic, ensuring that the network traffic of the target deployment unit can be accurately associated with the Trunk resources of the cloud host. This provides hardware-level support for subsequent cross-namespace communication and isolation, and improves the targeting and security of network configuration.
[0053] S52. Utilize the virtual Ethernet to connect the network namespaces of the cloud host and the target deployment unit respectively, and utilize the virtual Ethernet to configure the Internet Protocol address of the virtual network port.
[0054] For example, the external communication interface of the virtual Ethernet connection to the target deployment unit is moved into the target deployment unit's dedicated network namespace, allowing the target deployment unit to directly operate the external communication interface. Simultaneously, within the target deployment unit's namespace, an IP address associated with the virtual network port is configured for the external communication interface. Namespace isolation ensures network security, and binding the port's IP address ensures that the target deployment unit's network identity is consistent with the virtual network resources managed by Neutron, achieving address reachability between the target deployment unit and the external network.
[0055] S53. Enable the virtual Ethernet pair.
[0056] For example, by activating the interfaces at both ends of the virtual Ethernet pair via command, switching them from a closed state to a running state, only after being enabled can both ends receive and forward traffic, ensuring that the communication channel between the target deployment unit and the cloud host is truly available.
[0057] S54. Configure routing rules within the network namespace of the target deployment unit.
[0058] For example, within the network namespace of the target deployment unit, a default routing rule can be set via command to specify that all outbound communication traffic of the target deployment unit (such as access to other deployment units, cloud hosts, or external networks) should be forwarded through the external communication interface of the virtual Ethernet pair, and finally exit the network via the SDN network card and Trunk resources of the cloud host. This rule ensures that the traffic of the target deployment unit follows the preset path and avoids network chaos.
[0059] In this embodiment of the invention, a virtual Ethernet pair is used to solve the cross-isolation communication problem between the target deployment unit and the cloud host. VID ensures Layer 2 traffic isolation, and IP configuration and routing rules enable the target deployment unit to seamlessly reuse the SDN network resources of the cloud host to access the external network. This satisfies the isolation requirements of the container network, achieves efficient sharing of cloud host resources, and improves the stability and maintainability of the container network through standardized configuration steps, providing reliable end-point configuration support for the collaborative network architecture of OpenStack and Kubernetes.
[0060] Further, see Figure 7 , Figure 7 This is a schematic diagram of the network topology of a cloud host and deployment units provided in an embodiment of the present invention. The topology clearly shows the association logic between multiple deployment units (Pods) on the cloud host and the SDN network. In the diagram, the compute node is a physical / virtual node carrier, which contains one cloud host. The cloud host is associated with an Open vSwitch (a virtual switch of OpenStack Neutron) through eth0 (the main network interface card of the cloud host), and finally accesses the external network through a physical network interface card. Three deployment units (Pod01, Pod02, and Pod03) are deployed in the cloud host. Each Pod corresponds to one subport, and all subports are bound to the trunk port corresponding to the main network interface card eth0 of the cloud host.
[0061] For example, each Pod's network interface card (NIC) is bound to a Port created by OpenStack Neutron. The Port carries complete network configuration information. Taking Pod01 as an example, its configuration information includes: 1) VNI=10001 indicates a Layer 3 network isolation identifier, used to distinguish the virtual network to which a Pod belongs; 2) PortId=portv0001-01 represents the unique identifier of the virtual network port; 3) VID=1 indicates a Layer 2 isolation identifier, corresponding to the VLAN sub-NIC eth0.1 of the Pod; 4) IP=172.30.2.3 and GW=172.30.2.254 represent the Pod's IP address and gateway address, respectively.
[0062] For example, taking Pod01 as an example, the outbound network flow of all Pods is explained. The outbound traffic of Pod01 needs to be transmitted through the path of "Pod sub-network interface → cloud host main network interface → Open vSwitch → external network". The specific steps are as follows: 1.1) eth0.1→eth0: The traffic of Pod01 is sent from its own VLAN sub-interface eth0.1 (bound VID=1). Since eth0.1 is a sub-interface of the cloud host's main network interface eth0, the traffic will be forwarded to eth0 with the VID label (achieving the aggregation of Layer 2 isolated traffic). 1.2) eth0→Open vSwitch: The cloud host's main network interface eth0 forwards traffic carrying the VID to the Open vSwitch. This is because when Neutron creates the Port, it binds the Port to the Open vSwitch bridge to ensure that the traffic accesses the SDN network. 1.3) Open vSwitch → External Network: Open vSwitch reads the VNI=10001 carried in the traffic, combines it with the gateway address of the Pod, encapsulates the traffic into the corresponding tunnel (such as a VXLAN tunnel), and finally sends it to the external network through the physical network card, realizing cross-node transmission of the three-layer network.
[0063] For example, taking Pod01 as an example, let's explain the network flow of all Pods entering Pod01. External traffic entering Pod01 needs to go through the path of "external network → Open vSwitch → cloud host main network card → Pod sub-network card". The specific steps are as follows: 2.1) Gateway → Open vSwitch: After the traffic from the external network is processed by the gateway, it is transmitted to the Open vSwitch bridge on the computing node where the cloud host is located through a tunnel (such as VXLAN) according to the destination Port information (such as PortId=portv0001-01). 2.2) Open vSwitch → Cloud host eth0: Open vSwitch forwards traffic to the main network interface card eth0 of the cloud host based on the cloud host information associated with the destination port; 2.3) eth0→eth0.1: The cloud host's main network interface eth0 identifies VID=1 in the traffic, forwards it to the corresponding VLAN sub-network interface eth0.1, and finally sends it to the network namespace of Pod01 to complete the accurate delivery of traffic.
[0064] In this embodiment of the invention, the network topology achieves dual isolation and resource reuse through a combination design of "Trunk+VID+VNI". VID is used to achieve Layer 2 network isolation for multiple Pods on the same cloud host, such as VID=1 for Pod01 and VID=2 for Pod02. VNI is used to achieve Layer 3 network isolation for different Pods, such as VNI=10001 for Pod01 and VNI=10003 for Pod02. All Pods reuse the cloud host's main network interface eth0 and Open vSwitch resources to access the SDN network, which solves the problem of idle cloud host network resources in traditional architectures and ultimately achieves stable communication between Pods on the cloud host and other components in the SDN network.
[0065] Compared to existing technologies, the cloud host deployment unit configuration method disclosed in this invention, by associating the virtual network port of the target deployment unit with the aggregation port of the cloud host and implementing network configuration based on the virtual LAN identifier, enables the target deployment unit to access external networks using the network resources such as the cloud host's network card and bandwidth. This breaks the limitation of traditional solutions where cloud host resources only serve themselves, improves the utilization rate of hardware computing power and network bandwidth, and reduces resource idleness. Furthermore, by centrally managing the network ports of multiple deployment units through the aggregation port and combining it with the virtual LAN identifier to achieve Layer 2 isolation between multiple deployment units on the same cloud host, it avoids network namespace redundancy in multi-tenant scenarios and constructs a layered and orderly network architecture. Simultaneously, by configuring connections and default routes through virtual Ethernet, it ensures stable communication between the deployment unit, the cloud host, and external networks, meeting the network requirements for collaborative work of business instances in cloud-native scenarios and improving overall business operation efficiency.
[0066] See Figure 8 , Figure 8 This is a structural block diagram of a cloud host deployment unit configuration device 100 provided in an embodiment of the present invention. The cloud host deployment unit configuration device 100 includes: The configuration information acquisition module 11 is used to acquire the configuration information of the target deployment unit when it is detected that there is a target deployment unit to be configured in the cloud host; The virtual network port creation module 12 is used to create a virtual network port for the target deployment unit according to the configuration information. The virtual local area network identifier determination module 13 is used to determine the virtual local area network identifier of the target deployment unit based on the aggregation port of the cloud host; The virtual LAN identifier storage module 14 is used to add the virtual network port to the aggregation port of the cloud host according to the virtual LAN identifier; The network configuration module 15 is used to configure the target deployment unit using the virtual local area network identifier.
[0067] Furthermore, the cloud host deployment unit configuration device 100 also includes: The cloud server network port acquisition module is used to acquire the network port of the cloud server when it is detected that there is no aggregation port corresponding to the cloud server in the current memory database; The aggregation port creation module is used to create an aggregation port by calling the network component interface of the software-defined network, with the network port as the main port for port aggregation. The aggregation port persistence module is used to write the created aggregation port into the memory database.
[0068] It is worth noting that the working process of each module in the cloud host deployment unit configuration device 100 described in the embodiments of the present invention can refer to the working process of the cloud host deployment unit configuration method described in the above embodiments, and will not be repeated here.
[0069] See Figure 9 , Figure 9 This is a structural block diagram of a cloud host deployment unit configuration device 200 provided in an embodiment of the present invention. The cloud host deployment unit configuration device 200 includes a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, it implements the steps in the above-described embodiments of the cloud host deployment unit configuration methods.
[0070] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the deployment unit configuration device 200 of the cloud host.
[0071] The cloud host deployment unit configuration device 200 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will understand that the schematic diagram is merely an example of the cloud host deployment unit configuration device 200 and does not constitute a limitation on the cloud host deployment unit configuration device 200. It may include more or fewer components than illustrated, or combine certain components, or use different components. For example, the cloud host deployment unit configuration device 200 may also include input / output devices, network access devices, buses, etc.
[0072] The processor 21 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 21 is the control center of the cloud host deployment unit configuration device 200, connecting all parts of the cloud host deployment unit configuration device 200 via various interfaces and lines.
[0073] The memory 22 can be used to store the computer programs and / or modules. The processor 21 implements various functions of the cloud host deployment unit configuration device 200 by running or executing the computer programs and / or modules stored in the memory 22 and calling the data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0074] Wherein, if the modules / units integrated in the deployment unit configuration device 200 of the cloud host are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor 21, it can implement the steps of the various method embodiments described above. Wherein, the computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0075] Furthermore, the present invention also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the cloud host deployment unit configuration method as described in any of the above embodiments.
[0076] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for configuring deployment units of a cloud server, characterized in that, include: When a target deployment unit to be configured is detected in the cloud host, the configuration information of the target deployment unit is obtained; Create a virtual network port for the target deployment unit based on the configuration information; The virtual local area network identifier of the target deployment unit is determined based on the aggregation port of the cloud host; Based on the virtual LAN identifier, add the virtual network port to the aggregation port of the cloud host; The target deployment unit is configured with the virtual local area network identifier.
2. The cloud host deployment unit configuration method as described in claim 1, characterized in that, The step of configuring the target deployment unit using the virtual local area network identifier includes: Create a virtual Ethernet pair based on the virtual LAN identifier; The virtual Ethernet is used to connect the network namespaces of the cloud host and the target deployment unit respectively, and the virtual Ethernet is used to configure the Internet Protocol address of the virtual network port; Enable the virtual Ethernet pair; Configure routing rules within the network namespace of the target deployment unit.
3. The cloud host deployment unit configuration method as described in claim 2, characterized in that, The step of creating a virtual Ethernet pair based on the virtual LAN identifier includes: Using the software-defined network interface card (NIC) of the cloud host as the primary NIC and the virtual LAN identifier as the traffic differentiation identifier, a virtual Ethernet pair is created.
4. The cloud host deployment unit configuration method as described in claim 1, characterized in that, The step of determining the virtual local area network identifier of the target deployment unit based on the aggregation port of the cloud host includes: Obtain information about all associated sub-ports in the aggregation port of the cloud host; If the number of sub-ports is 0, then the virtual local area network identifier of the target deployment unit is 1; If the number of sub-ports is not 0, extract the virtual LAN identifier bound to each sub-port and determine the maximum value among them. Then, add 1 to the maximum value to generate the virtual LAN identifier of the target deployment unit.
5. The cloud host deployment unit configuration method as described in claim 1, characterized in that, The method further includes: When it is detected that there is no aggregation port corresponding to the cloud host in the current memory database, the network port of the cloud host is obtained; Using the aforementioned network port as the main port for port aggregation, the network component interface of the software-defined network is invoked to create the aggregation port; The created aggregation port is written to the in-memory database.
6. The cloud host deployment unit configuration method as described in claim 5, characterized in that, The process of obtaining the network port of the cloud host includes: Obtain the network identifier and network address of the cloud host; Based on the network identifier and the network address, query the network port of the cloud host.
7. A cloud server deployment unit configuration device, characterized in that, include: The configuration information acquisition module is used to acquire the configuration information of the target deployment unit when it is detected that there is a target deployment unit to be configured in the cloud host; A virtual network port creation module is used to create a virtual network port for the target deployment unit based on the configuration information. A virtual local area network (VLAN) identifier determination module is used to determine the VLAN identifier of the target deployment unit based on the aggregation port of the cloud host; A virtual LAN identifier storage module is used to add the virtual network port to the aggregation port of the cloud host according to the virtual LAN identifier; The network configuration module is used to configure the network of the target deployment unit using the virtual local area network identifier.
8. A cloud server deployment unit configuration device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the deployment unit configuration method for a cloud host as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the cloud host deployment unit configuration method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the deployment unit configuration method for a cloud host as described in any one of claims 1 to 6.