CN114650223A - Network configuration method and device of Kubernetes cluster and electronic equipment - Google Patents

Network configuration method and device of Kubernetes cluster and electronic equipment Download PDF

Info

Publication number
CN114650223A
CN114650223A CN202210338961.8A CN202210338961A CN114650223A CN 114650223 A CN114650223 A CN 114650223A CN 202210338961 A CN202210338961 A CN 202210338961A CN 114650223 A CN114650223 A CN 114650223A
Authority
CN
China
Prior art keywords
local area
network
area network
virtual local
pod
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210338961.8A
Other languages
Chinese (zh)
Inventor
陈南飞
王旸
蒋驰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mingyang Industrial Technology Research Institute Shenyang Co ltd
Original Assignee
Mingyang Industrial Technology Research Institute Shenyang Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mingyang Industrial Technology Research Institute Shenyang Co ltd filed Critical Mingyang Industrial Technology Research Institute Shenyang Co ltd
Priority to CN202210338961.8A priority Critical patent/CN114650223A/en
Publication of CN114650223A publication Critical patent/CN114650223A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/10Packet switching elements characterised by the switching fabric construction

Abstract

The embodiment of the application provides a network configuration method and device of a Kubernetes cluster and electronic equipment. The method comprises the following steps: accessing a database of a Kubernetes cluster, and acquiring at least one network resource object, wherein the network resource object comprises a virtual local area network name and a virtual local area network parameter; according to the parameters of the virtual local area network, a virtual local area network interface corresponding to the name of each virtual local area network is remotely established on a physical switch connected with each working node of the Kubernetes cluster; acquiring a virtual local area network name list recorded in a configuration document of a POD to be configured; creating at least one virtual interface in a network namespace corresponding to a POD to be configured according to a virtual local area network name list recorded in a configuration document of the POD to be configured; and connecting the corresponding virtual local area network interface and the virtual interface according to the same virtual local area network name to complete the network configuration between the POD to be configured and the physical switch. The technical scheme of the embodiment of the application can create a plurality of network interfaces for PODs.

Description

Network configuration method and device of Kubernetes cluster and electronic equipment
Technical Field
The present application relates to the field of computer and virtual network technologies, and in particular, to a network configuration method and apparatus for a kubernets cluster, and an electronic device.
Background
When migrating a traditional application to a kubernets cluster, the application started through Pod and the traditional application should have the same network operation environment as much as possible, so that the reliability of network communication is ensured, and the problem of high migration cost caused by application transformation is solved. However, in the kubernets cluster, there is only one network interface after a Pod is created, and the kubernets cluster cannot create multiple network interfaces for the Pod.
Based on this, how to create multiple network interfaces for Pod in the kubernets cluster is an urgent technical problem to be solved.
Disclosure of Invention
Embodiments of the present application provide a network configuration method and apparatus for a kubernets cluster, and an electronic device, so that at least a plurality of network interfaces can be created for a Pod in the kubernets cluster.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of an embodiment of the present application, there is provided a network configuration method of a kubernets cluster, where the method includes: accessing a database of a Kubernetes cluster, and acquiring at least one network resource object, wherein the network resource object comprises a virtual local area network name and a virtual local area network parameter; according to the parameters of the virtual local area network, a virtual local area network interface corresponding to the name of each virtual local area network is remotely established on a physical switch connected with each working node of the Kubernetes cluster; acquiring a virtual local area network name list recorded in a configuration document of a POD to be configured; creating at least one virtual interface in a network namespace corresponding to a POD to be configured according to a virtual local area network name list recorded in a configuration document of the POD to be configured; and connecting the corresponding virtual local area network interface and the virtual interface according to the same virtual local area network name to complete the network configuration between the POD to be configured and the physical switch.
In some embodiments of the present application, the virtual local area network parameters include a network prefix, a starting network address, and a gateway.
In some embodiments of the application, the remotely creating, on a physical switch connected to each working node of the Kubernetes cluster, a virtual local area network interface corresponding to each virtual local area network name includes: adding a network control module in a Kubernetes cluster, wherein the network control module is used for monitoring the change of the network resource object; controlling the network control module to establish remote connection with a physical switch, and issuing at least one group of virtual local area network parameters to the physical switch; the physical switch establishes a virtual local area network interface corresponding to each virtual local area network name according to at least one group of virtual local area network parameters; and controlling the network control module to disconnect the remote connection with the physical switch.
In some embodiments of the present application, the creating, by the physical switch, a vlan interface corresponding to each vlan name according to at least one set of vlan parameters includes: the physical switch creates at least one virtual local area network interface; and respectively configuring each group of virtual local area network parameters to each virtual local area network interface so as to complete the creation of the virtual local area network interface corresponding to each virtual local area network name.
In some embodiments of the present application, the creating, according to a list of names of virtual local area networks recorded in a configuration document of a POD to be configured, at least one virtual interface in a network namespace corresponding to the POD to be configured includes: adding a multi-network card management module in a Kubernetes cluster, wherein the multi-network card management module is used for creating at least one additional network interface for PODs to be configured; controlling the multi-network card management module to determine at least one group of virtual local area network parameters according to a virtual local area network name list recorded in a configuration document configuring the POD; and creating at least one virtual interface in the network name space corresponding to the POD to be configured according to at least one group of virtual local area network parameters.
In some embodiments of the present application, the creating, according to at least one set of virtual local area network parameters, at least one virtual interface in a network namespace corresponding to the POD to be configured includes: creating at least one virtual interface in a network namespace corresponding to the POD to be configured; and configuring each group of virtual local area network parameters to each virtual interface so as to complete the operation of creating at least one virtual interface in the network name space corresponding to the POD to be configured.
In some embodiments of the present application, the connecting, according to the same virtual local area network name, a corresponding virtual local area network interface and a corresponding virtual interface to complete network configuration between the POD to be configured and the physical switch includes: adjusting the connection mode of the physical switch into a bridge connection mode, and adjusting the working mode of the physical switch into a port convergence mode to allow all virtual local area network traffic to pass through; creating an OVS bridge at each working node of the Kubernetes cluster, and adding each virtual interface into the OVS bridge corresponding to each working node respectively; establishing a corresponding relation between a virtual local area network interface and a virtual interface based on the same virtual local area network name; based on the corresponding relation, each virtual interface is connected to the physical switch through the OVS network bridge so as to complete the network configuration between the POD to be configured and the physical switch.
In some embodiments of the application, prior to accessing the database of the kubernets cluster, the method further comprises: at least one network resource object is created through a kubecenetes cluster kubecect command line function, and each network resource object is stored in a database.
According to an aspect of the present application, there is provided a network configuration apparatus of a kubernets cluster, the apparatus comprising: the access unit is used for accessing a database of the Kubernetes cluster and acquiring at least one network resource object, wherein the network resource object comprises a virtual local area network name and a virtual local area network parameter; the first establishing unit is used for remotely establishing a virtual local area network interface corresponding to each virtual local area network name on a physical switch connected with each working node of the Kubernetes cluster according to the virtual local area network parameters; the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a virtual local area network name list recorded in a configuration document of a POD to be configured; the second creating unit is used for creating at least one virtual interface in a network name space corresponding to the POD to be configured according to a virtual local area network name list recorded in a configuration document of the POD to be configured; and the connecting unit is used for connecting the corresponding virtual local area network interface and the virtual interface according to the same virtual local area network name to complete the network configuration between the POD to be configured and the physical switch.
According to an aspect of the present application, there is provided an electronic device comprising one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and loaded and executed by the one or more processors to implement the operations performed by the kubernets clustered network configuration method.
Based on the scheme, the application has at least the following advantages or progresses:
in the application, according to a network resource object in a database of a Kubernetes cluster, a plurality of virtual local area network interfaces are created in a physical switch, and then a plurality of virtual interfaces are created in a network namespace corresponding to a POD to be configured according to a configuration document of the POD to be configured, wherein the virtual interfaces and the virtual local area network interfaces can use the same network prefix, the same initial network address and the same gateway, so that multi-line network connection can be established between the physical switch and the POD to be configured, a plurality of network interfaces are successfully created for the POD to be configured, and the access requirements of different users on the POD are met.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 illustrates a connection diagram of an exemplary system to which aspects of embodiments of the present application may be applied;
FIG. 2 illustrates a flow diagram of a method of network configuration for a Kubernets cluster according to one embodiment of the present application;
fig. 3 shows a flow chart of a method of network configuration of a kubernets cluster according to an embodiment of the present application;
FIG. 4 illustrates a flow diagram of a method of network configuration for a Kubernets cluster according to one embodiment of the present application;
FIG. 5 illustrates a flow diagram of a method of network configuration for a Kubernetes cluster according to one embodiment of the present application;
FIG. 6 illustrates a flow diagram of a method of network configuration for a Kubernets cluster according to one embodiment of the present application;
FIG. 7 illustrates a flow diagram of a method of network configuration for a Kubernets cluster according to one embodiment of the present application;
FIG. 8 shows a block diagram of a network configuration apparatus according to an embodiment of the present application;
FIG. 9 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It should be noted that: reference herein to "a plurality" means two or more. "and/or" describe the association relationship of the associated objects, meaning that there may be three relationships, e.g., A and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
It is noted that the terms first, second and the like in the description and claims of the present application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the objects so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in other sequences than those illustrated or described herein.
Please refer to fig. 1.
Fig. 1 shows a connection diagram of an exemplary system to which the technical solution of the embodiment of the present application can be applied. As shown in fig. 1, physical switch 101 may be physically connected to working nodes 102 and 103 in a kubernets cluster. In worker node 102, POD 104 and POD 105 are connected to physical switch 101 through an interface provided by worker node 102; in worker node 103, POD 106 and POD 107 are connected to physical switch 101 through an interface provided by worker node 103.
In an embodiment of the present application, the service cluster formed by the system architecture may be a kubernets cluster, where the kubernets cluster includes at least one Master node (i.e., a management node) and at least one Worker node (i.e., a work node), and the kubernets cluster is a highly available computer cluster, and the computers are connected to work as a unit. The abstraction in the kubernets cluster allows containerized applications to be deployed to the cluster without having to bind them specifically to a computer. To take advantage of this new deployment model, applications need to be containerized in a way that separates them from a single host. Compared with previous deployment models, the containerized application is more flexible and available, the application is directly installed on a specific computer, and the program package is deeply integrated into a host. The kubernets cluster automates the distribution and scheduling of application containers across clusters in a more efficient manner.
In this application, the kubernets cluster may include a plurality of working nodes, each working node needs to establish a physical connection with a physical switch, and inside each working node, each POD needs to be connected to the physical switch through an interface provided by the working node, so that each POD is actually networked online, and the use or management of a user is facilitated.
It should be noted that the embodiments proposed in the present application can be used in a cloud scenario, such as cloud computing, which is a computing mode that distributes computing tasks over a resource pool formed by a large number of computers, so that various application systems can obtain computing power, storage space, and information services as needed. The network that provides the resources is referred to as the "cloud". Resources in the cloud can be infinitely expanded to users, and can be acquired at any time, used as required and expanded at any time. The cloud computing resource pool mainly comprises computing equipment (which is a virtualization machine and comprises an operating system), storage equipment and network equipment.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
please refer to fig. 2.
Fig. 2 shows a flow chart of a network configuration method of a kubernets cluster according to an embodiment of the present application. As shown in fig. 2, the method may include steps S201-S205:
step S201, accessing a database of the Kubernets cluster to obtain at least one network resource object, wherein the network resource object comprises a virtual local area network name and a virtual local area network parameter.
Step S202, according to the virtual local area network parameters, a virtual local area network interface corresponding to each virtual local area network name is remotely established on a physical switch connected with each working node of the Kubernetes cluster.
Step S203, acquiring a list of names of the virtual local area networks recorded in the configuration document of the POD to be configured.
Step S204, according to the virtual local area network name list recorded in the configuration document of the POD to be configured, at least one virtual interface is created in the network name space corresponding to the POD to be configured.
Step S205, according to the same virtual local area network name, connecting the corresponding virtual local area network interface and virtual interface, and completing network configuration between the POD to be configured and the physical switch.
In this application, the parameters of the virtual local area network may include a network prefix, a starting network address, and a gateway.
In the application, according to a network resource object in a database of a Kubernets cluster, a plurality of virtual local area network interfaces are created in a physical switch, and then a plurality of virtual interfaces are created in a network namespace corresponding to a POD to be configured according to a configuration document of the POD to be configured, wherein the virtual interfaces and the virtual local area network interfaces can use the same network prefix, starting network address and gateway, so that multi-line network connection can be established between the physical switch and the POD to be configured, a plurality of network interfaces are successfully created for the POD to be configured, and the access requirements of different users on the POD are met.
Please refer to fig. 3.
Fig. 3 shows a flow chart of a network configuration method of a kubernets cluster according to an embodiment of the present application. As shown in fig. 3, the method for remotely creating a vlan interface corresponding to each vlan name on a physical switch connected to each working node of the kubernets cluster may include steps S301 to S304:
step S301, adding a network control module in the Kubernets cluster, wherein the network control module is used for monitoring the change of the network resource object.
Step S302, the network control module is controlled to establish remote connection with a physical switch, and at least one group of virtual local area network parameters is issued to the physical switch.
Step S303, the physical switch creates a vlan interface corresponding to each vlan name according to at least one set of vlan parameters.
Step S304, controlling the network control module to disconnect the remote connection with the physical switch.
In the application, the network control module is added to monitor the network resource objects in the database and perform corresponding operations. For example, after it is monitored that a new network resource object is created, the network control module needs to be controlled to issue a virtual local area network parameter to the physical switch, so that the physical switch creates a new virtual local area network interface.
Please refer to fig. 4.
Fig. 4 shows a flow chart of a network configuration method of a kubernets cluster according to an embodiment of the present application. As shown in fig. 4, the method for the physical switch to create the vlan interfaces corresponding to the respective vlan names according to at least one set of vlan parameters may include steps S401 to S402:
step S401, the physical switch creates at least one virtual local area network interface.
Step S402, configuring each set of vlan parameters to each vlan interface, respectively, to complete the creation of a vlan interface corresponding to each vlan name.
In this application, the physical switch may first create a blank vlan interface, and then configure the received vlan parameters to the blank vlan interface, thereby completing the creation of the vlan interface.
For example, in the present application, the network control module may run on a Master node of a kubernets cluster, and then, taking a network resource object vlan-100-network as an example, a processing manner of the network control module may be as follows:
firstly, a network control module acquires specific information of a network resource object, and acquires a virtual local area network name (Vlan 100) and a gateway (192.168.10.254) from the specific information; secondly, the network control module establishes remote connection with the SW1 physical switch, and the remote connection can use SSH, Netconf or WebSocket and other protocols; furthermore, the network control module issues configuration to the SW1 physical switch through the remote connection, for creating Vlan100 and Vlan100 interfaces, and configures the IP of the Vlan100 interface to 192.168.10.254; finally, the network controller disconnects the remote connection to the SW1 switch.
In this application, if the network resource object in the database is deleted, the network control module also needs to perform corresponding processing, and the specific processing manner may be as follows:
firstly, a network control module acquires specific information of a network resource object, and acquires a virtual local area network name (Vlan 100) and a gateway (192.168.10.254) from the specific information; secondly, the network control module establishes remote connection with the SW1 physical switch, and the remote connection can use SSH, Netconf or WebSocket and other protocols; furthermore, the network control module issues configuration to the SW1 physical switch through a remote connection for deleting Vlan100 and Vlan100 interfaces; finally, the network controller disconnects the remote connection to the SW1 switch.
Please refer to fig. 5.
Fig. 5 shows a flow chart of a network configuration method of a kubernets cluster according to an embodiment of the present application. As shown in fig. 5, the method for creating at least one virtual interface in the network namespace corresponding to the POD to be configured according to the list of virtual local area network names recorded in the configuration document of the POD to be configured may include steps S501-S503:
step S501, adding a multi-network card management module in the Kubernets cluster, wherein the multi-network card management module is used for creating at least one additional network interface for PODs to be configured.
Step S502, controlling the multi-network card management module to determine at least one group of virtual local area network parameters according to a virtual local area network name list recorded in a configuration document configuring the POD.
Step S503, according to at least one group of virtual local area network parameters, creating at least one virtual interface in the network namespace corresponding to the POD to be configured.
Please refer to fig. 6.
Fig. 6 shows a flow chart of a network configuration method of a kubernets cluster according to an embodiment of the present application. As shown in fig. 6, the method for creating at least one virtual interface in the network namespace corresponding to the POD to be configured according to at least one set of virtual local area network parameters may include steps S601-S602:
step S601, creating at least one virtual interface in the network namespace corresponding to the POD to be configured.
Step S602, configuring each group of vlan parameters to each virtual interface, so as to complete an operation of creating at least one virtual interface in the network namespace corresponding to the POD to be configured.
In the application, a multi-network card management module may be added to kubernets, and is used to create a plurality of network interfaces (i.e., a plurality of network cards) for a Pod as needed when the Pod is created according to the network configuration of the Pod, and remove a specified network interface for the Pod when the Pod is deleted.
In this application, if a plurality of network cards need to be created for a Pod, when a configuration file for creating the Pod is written, the configuration file may be specified in metadata.
In the present application, when creating Pod, if the metadata information does not include a key of mingyangtech, com, cn/multi-network or a key of mingyangtech, com, cn/multi-network as an empty character string, it indicates that a single network card Pod is created, and the processing flow at this time is completely the same as the conventional processing flow of kubernets.
In this application, the multi-network card management module may run on a Master node, and its processing mode may be as follows, hereinafter, a dual-network card Pod is created, where a network resource object is illustrated by taking vlan-100-network as an example, and when writing a configuration file for creating this dual-network card Pod, it is necessary to specify "tiny yangtech, com, cn/multi-network: vlan-100-network" in metadata.
When creating the dual-network card Pod, the multi-network card management module may process the following manner: and acquiring the detailed information of the Pod, and acquiring the Worker node where the Pod is located from the detailed information, wherein the Worker node is marked as W1.
The key value of mingyangtech, com, cn/multi-network, namely "vlan-100-network" is obtained from metadata of the configuration file of the Pod, and the character string is divided by a comma to analyze, so as to obtain a network resource object name list, in this embodiment, only one network resource object is provided, and the name is vlan-100-network.
Traversing the network resource object name list, and processing each network resource object name in the list according to the following mode: acquiring a network namespace corresponding to the Pod from the W1 node, and recording the network namespace as netns 1; a tap virtual interface is created in netns1, denoted eth 1.
Searching a data network resource object according to a network resource object name (Vlan-100-network), obtaining a virtual local area network name (Vlan 100) and a gateway (192.168.10.254), allocating an IP (Internet protocol) for an eth1 interface according to a network prefix and a starting IP, marking the IP as allocated, and assuming that the allocated IP is 192.168.10.100.
An IP 192.168.10.100 is configured for the eth1 interface and the gateway is 192.168.10.254.
The eth1 interface is added to the interface provided by W1 and the Vlan Tag is set to 100.
The names of all tap virtual interfaces created for the Pod in the previous step are spliced into character strings, the names of a plurality of virtual interfaces are separated by commas, and the names are in the shapes of "eth 1, eth2 and eth 3", and "mingyangtech.com.cn/multi-interface: eth1, eth2 and eth 3" are set in the Pod metadata.labels and are stored in an Etcd database.
In this application, when deleting the dual network card Pod, the processing mode of the multi-network card management module may be as follows: and acquiring the detailed information of the Pod, acquiring the Worker node where the Pod is located from the detailed information, marking as W1, and acquiring the Pod IP list.
The key value, namely "vlan-100-network", of mingyangtech, com, cn/multi-network is obtained from the Pod metadata, and the character string is divided by a comma to be analyzed, so as to obtain a network resource object name list, wherein in the embodiment, only one network resource object is provided, and the name is vlan-100-network.
Traversing the network resource object name list, and processing each network resource object name in the list according to the following mode:
and searching the network resource object according to the network resource object name (vlan-100-network).
And searching the Pod IP list for an IP matched with the network prefix of the network resource object, and marking the IP as assignable in the network resource object.
The key value of mingyangtech, com, cn/multi-interface, which is the character string formed by splicing the Pod virtual interface names, is obtained from the Pod metadata, and the character string is divided by commas for analysis, so that all the virtual interface names of the Pod are obtained. At the W1 node, all virtual interfaces for the Pod are removed from the interfaces provided by the W1.
Please refer to fig. 7.
Fig. 7 shows a flow chart of a network configuration method of a kubernets cluster according to an embodiment of the present application. As shown in fig. 7, the connecting the corresponding vlan interfaces and virtual interfaces according to the same vlan name to complete the network configuration between the POD to be configured and the physical switch may include steps S701 to S702:
step S701, the connection mode of the physical switch is adjusted to a bridge connection mode, and the working mode of the physical switch is adjusted to a port convergence mode, so as to allow all the flows of the virtual local area network to pass through.
Step S702, creating OVS bridges at each working node of the Kubernetes cluster, and adding each virtual interface into the OVS bridge corresponding to each working node.
Step S703, based on the same virtual lan name, establishes a corresponding relationship between the virtual lan interface and the virtual interface.
Step S704, based on the corresponding relationship, each virtual interface is connected to the physical switch through the OVS bridge, so as to complete network configuration between the POD to be configured and the physical switch.
In the application, one physical interface can be selected from each Worker node of the kubernets cluster and used for forwarding the flow of the Pod multi-network-card network. The physical interface is connected with a physical switch, the physical switch interface is set as a two-layer bridge interface, the working mode is set as a Trunk mode, and all virtual local area network traffic is allowed to be forwarded through the interface. TRUNK means port convergence, and bandwidth between a switch and a network node can be increased by combining 2 or more physical ports into a logical path, and bandwidth belonging to the ports can be combined to provide a high bandwidth which is several times of the independent port for each port.
Meanwhile, Open vSwitch (OVS for short) can be installed on a Kubernets Worker node, an OVS bridge br-multi is created, an ens1 interface on the Worker node is added into the bridge br-multi, a virtual interface of the Worker node is accessed into the bridge br-multi, the virtual interface is accessed into a physical switch through the bridge br-multi and then through a physical interface, and therefore network configuration between the POD to be configured and the physical switch is completed.
In one embodiment of the present application, prior to accessing the database of the kubernets cluster, the method further comprises: at least one network resource object is created through a kubecenetes cluster kubecect command line function, and each network resource object is stored in a database.
In the present application, a new crd (custom resource definitio n) resource can be added in kubernets: vlan network, i.e., the network resource object described above. The network resource object may represent a virtual local area network, which is used to define the virtual local area network and includes information such as network prefix, initial IP, gateway, etc.
The following example describes a network resource object vlan-100-network that can be used to create a virtual local area network with a name of 100, a network prefix of 192.168.10.0/24, a starting IP of 192.168.10.100-192.168.10.200, and a gateway of 192.168.10.254.
Figure BDA0003578019620000111
Figure BDA0003578019620000121
In kubernets, network resource objects may be created and deleted via kubecect commands. After the network resource object is created, the Etcd will be stored. After the network resource object is deleted, the network resource object is also deleted from the Etcd.
An apparatus embodiment of the present application will now be described with reference to the accompanying drawings:
fig. 8 shows a block diagram of a network configuration device according to an embodiment of the application. As shown in fig. 8, the apparatus 800 may include: an access unit 801, a first creation unit 802, an acquisition unit 803, a second creation unit 804, and a connection unit 805.
The specific configuration of the apparatus 800 may include:
the accessing unit 801 is configured to access a database of the kubernets cluster, and obtain at least one network resource object, where the network resource object includes a virtual local area network name and a virtual local area network parameter.
A first creating unit 802, configured to remotely create, according to the virtual local area network parameters, a virtual local area network interface corresponding to each virtual local area network name on a physical switch connected to each working node of the Kubernetes cluster.
An obtaining unit 803 is used to obtain a list of virtual local area network names recorded in a configuration document of a POD to be configured.
The second creating unit 804 is configured to create at least one virtual interface in a network namespace corresponding to a POD to be configured according to a virtual local area network name list recorded in a configuration document of the POD to be configured.
The connecting unit 805 is configured to connect the corresponding vlan interface and the corresponding vlan interface according to the same vlan name, so as to complete network configuration between the POD to be configured and the physical switch.
Please refer to fig. 9.
FIG. 9 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 900 of the electronic device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments.
As shown in fig. 9, the computer system 900 includes a Central Processing Unit (CPU)901, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 902 or a program loaded from a storage portion 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for system operation are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An Input/Output (I/O) interface 905 is also connected to bus 904.
The following components are connected to the I/O interface 905: an input portion 906 including a keyboard, a mouse, and the like; an output section 907 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage portion 908 including a hard disk and the like; and a communication section 909 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as necessary. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 910 as necessary, so that a computer program read out therefrom is mounted into the storage section 908 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 909 and/or installed from the removable medium 911. The computer program executes various functions defined in the system of the present application when executed by a Central Processing Unit (CPU) 901.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the network configuration method of the kubernets cluster described in the above embodiments.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may be separate and not incorporated into the electronic device. The computer readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device is enabled to implement the network configuration method of the kubernets cluster described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, and may also be implemented by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A network configuration method of a Kubernetes cluster is characterized by comprising the following steps:
accessing a database of a Kubernetes cluster, and acquiring at least one network resource object, wherein the network resource object comprises a virtual local area network name and a virtual local area network parameter;
according to the parameters of the virtual local area network, a virtual local area network interface corresponding to each virtual local area network name is remotely established on a physical switch connected with each working node of the Kubernetes cluster;
acquiring a virtual local area network name list recorded in a configuration document of a POD to be configured;
creating at least one virtual interface in a network namespace corresponding to a POD to be configured according to a virtual local area network name list recorded in a configuration document of the POD to be configured;
and connecting the corresponding virtual local area network interface and the virtual interface according to the same virtual local area network name to complete the network configuration between the POD to be configured and the physical switch.
2. The method of claim 1, wherein the virtual local area network parameters comprise a network prefix, a starting network address, and a gateway.
3. The method of claim 1, wherein remotely creating a virtual local area network interface corresponding to each virtual local area network name on a physical switch connected to each working node of the Kubernetes cluster comprises:
adding a network control module in a Kubernetes cluster, wherein the network control module is used for monitoring the change of the network resource object;
controlling the network control module to establish remote connection with a physical switch, and issuing at least one group of virtual local area network parameters to the physical switch;
the physical switch establishes a virtual local area network interface corresponding to each virtual local area network name according to at least one group of virtual local area network parameters;
and controlling the network control module to disconnect the remote connection with the physical switch.
4. The method of claim 3, wherein the physical switch creating a VLAN interface corresponding to each VLAN name based on at least one set of VLAN parameters comprises:
the physical switch creates at least one virtual local area network interface;
and respectively configuring each group of virtual local area network parameters to each virtual local area network interface so as to complete the creation of the virtual local area network interface corresponding to each virtual local area network name.
5. The method according to claim 1, wherein the creating at least one virtual interface in the network namespace corresponding to the POD to be configured according to the list of virtual local area network names recorded in the configuration document of the POD to be configured comprises:
adding a multi-network card management module in a Kubernetes cluster, wherein the multi-network card management module is used for creating at least one additional network interface for PODs to be configured;
controlling the multi-network card management module to determine at least one group of virtual local area network parameters according to a virtual local area network name list recorded in a configuration document configuring a POD (platform data center);
and creating at least one virtual interface in the network name space corresponding to the POD to be configured according to at least one group of virtual local area network parameters.
6. The method according to claim 5, wherein said creating at least one virtual interface in the network namespace corresponding to the POD to be configured according to at least one set of virtual local area network parameters comprises:
creating at least one virtual interface in a network namespace corresponding to the POD to be configured;
and configuring each group of virtual local area network parameters to each virtual interface so as to complete the operation of creating at least one virtual interface in the network name space corresponding to the POD to be configured.
7. The method according to claim 1, wherein said connecting corresponding vlan interfaces and vlan interfaces according to the same vlan name to complete network configuration between the POD to be configured and the physical switch, comprises:
adjusting the connection mode of the physical switch into a bridge connection mode, and adjusting the working mode of the physical switch into a port convergence mode to allow all virtual local area network traffic to pass through;
creating an OVS bridge at each working node of the Kubernetes cluster, and adding each virtual interface into the OVS bridge corresponding to each working node respectively;
establishing a corresponding relation between a virtual local area network interface and a virtual interface based on the same virtual local area network name;
based on the corresponding relation, each virtual interface is connected to the physical switch through the OVS network bridge so as to complete the network configuration between the POD to be configured and the physical switch.
8. The method of claim 1, wherein prior to accessing a database of a kubernets cluster, the method further comprises:
at least one network resource object is created through a kubecenetes cluster kubecect command line function, and each network resource object is stored in a database.
9. An apparatus for network configuration of a kubernets cluster, the apparatus comprising:
the access unit is used for accessing a database of the Kubernetes cluster and acquiring at least one network resource object, wherein the network resource object comprises a virtual local area network name and a virtual local area network parameter;
the first establishing unit is used for remotely establishing a virtual local area network interface corresponding to each virtual local area network name on a physical switch connected with each working node of the Kubernetes cluster according to the virtual local area network parameters;
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a virtual local area network name list recorded in a configuration document of a POD to be configured;
the second creating unit is used for creating at least one virtual interface in a network name space corresponding to the POD to be configured according to a virtual local area network name list recorded in a configuration document of the POD to be configured;
and the connecting unit is used for connecting the corresponding virtual local area network interface and the virtual interface according to the same virtual local area network name to complete the network configuration between the POD to be configured and the physical switch.
10. An electronic device, comprising one or more processors and one or more memories having stored therein at least one program code, the at least one program code being loaded into and executed by the one or more processors to perform operations performed by the network configuration method for a kubernets cluster of any of claims 1 to 8.
CN202210338961.8A 2022-04-01 2022-04-01 Network configuration method and device of Kubernetes cluster and electronic equipment Pending CN114650223A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210338961.8A CN114650223A (en) 2022-04-01 2022-04-01 Network configuration method and device of Kubernetes cluster and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210338961.8A CN114650223A (en) 2022-04-01 2022-04-01 Network configuration method and device of Kubernetes cluster and electronic equipment

Publications (1)

Publication Number Publication Date
CN114650223A true CN114650223A (en) 2022-06-21

Family

ID=81995702

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210338961.8A Pending CN114650223A (en) 2022-04-01 2022-04-01 Network configuration method and device of Kubernetes cluster and electronic equipment

Country Status (1)

Country Link
CN (1) CN114650223A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116016028A (en) * 2022-12-09 2023-04-25 明阳产业技术研究院(沈阳)有限公司 Method, system, medium and equipment for creating multiple network interfaces for Pod based on IPvlan
CN116996379A (en) * 2023-08-11 2023-11-03 中科驭数(北京)科技有限公司 Cloud primary network service quality configuration method and device based on OVN-Kubernetes

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116016028A (en) * 2022-12-09 2023-04-25 明阳产业技术研究院(沈阳)有限公司 Method, system, medium and equipment for creating multiple network interfaces for Pod based on IPvlan
CN116016028B (en) * 2022-12-09 2024-03-15 明阳产业技术研究院(沈阳)有限公司 Method, system, medium and equipment for creating multiple network interfaces for Pod based on IPvlan
CN116996379A (en) * 2023-08-11 2023-11-03 中科驭数(北京)科技有限公司 Cloud primary network service quality configuration method and device based on OVN-Kubernetes

Similar Documents

Publication Publication Date Title
CN107580083B (en) Method and system for allocating IP addresses of containers
JP4740897B2 (en) Virtual network configuration method and network system
EP3376738A1 (en) Resource configuration method and network device thereof
CN107566165B (en) Method and system for discovering and deploying available resources of power cloud data center
CN105593773A (en) Systems and methods for automated commissioning of virtualized distributed control systems
CN111880902A (en) Pod creation method, device, equipment and readable storage medium
CN114650223A (en) Network configuration method and device of Kubernetes cluster and electronic equipment
CN103109271A (en) Inter-platform application migration realization method and system
US20120233305A1 (en) Method, apparatus, and computer product for managing operation
EP3639134A1 (en) Detecting and managing recurring patterns in device and service configuration data
CN110224917B (en) Data transmission method, device and system and server
CN109474467A (en) Network automatically management method, device, storage medium and electronic equipment
CN106878204A (en) The creation method and device of a kind of virtual machine
CN106155264A (en) The computer approach of the power consumption of management storage subsystem and computer system
CN113709810A (en) Method, device and medium for configuring network service quality
CN114489954A (en) Tenant creation method based on virtualization platform, tenant access method and equipment
CN112333672B (en) Method and device for opening UPF network element of 5G core network
CN116724543A (en) Container cluster management method and device
CN111459510A (en) Cross-network operating system installation method and device, electronic equipment and medium
CN115150268A (en) Network configuration method and device of Kubernetes cluster and electronic equipment
CN114070889B (en) Configuration method, traffic forwarding device, storage medium, and program product
CN115277398A (en) Cluster network configuration method and device
CN106817291A (en) VXLAN realizes device and its method of work
CN115277701A (en) Network management method, device, medium and electronic equipment of cluster system
CN108833177A (en) Virtual switch management method and main control card

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination