Method for fixing kube-ovn network virtual bridge address in Linux operating system

By copying and modifying the startup script in the kube-ovn image, it allocates addresses to the virtual bridge on the k8s cluster node, solving the problem of virtual bridge address loss and simplifying the virtual bridge address fixation process.

CN120050263AInactive Publication Date: 2025-05-27HENAN SONGSHAN LAB IND RES INST CO LTD LUOYANG BRANCH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510498331.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2025-05-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In Linux operating systems, when using kube-ovn to connect openstack and k8s networks, the virtual bridge address will be lost after the Kirin system is restarted, resulting in the cloud platform being unable to be ready for use; in other Linux operating systems, the process of fixing the virtual bridge address is complicated.

Method used

Copy the startup script in the kube-ovn image to the local directory of the k8s cluster node, modify the ovs module installation file, make the startup script map into the ovn-ovs pod, and add the command to assign the address to the virtual bridge in the startup script.

Benefits of technology

It solves the problem that the virtual bridge address disappears after the Kirin system is turned on, so that the cloud platform can be used ready to start; at the same time, it simplifies the process of fixing the virtual bridge address in other Linux operating systems, reducing resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120050263A_ABST
    Figure CN120050263A_ABST
Patent Text Reader

Abstract

The invention provides a method for fixing a kube-ovn network virtual bridge address in a Linux operating system, and relates to the technical field of operating systems, the method comprises the following steps: copying a startup script in a kube-ovn mirror image, and storing the startup script in a k8s cluster node local directory; an ovs module installation file is modified, so that the starting script stored in the local directory of the k8s cluster node is mapped to ovn-ovs pod; modifying an ovs module installation file, and executing a locally mapped starting script on a command command; installing a k8s cluster, and selecting the modified kube-ovn obtained in the step 3 by the network plug-in; the method comprises the following steps: creating a virtual network bridge on a k8s cluster node by using kube-ovn, and allocating an address to the virtual network bridge in ovn-ovs pod; and modifying the starting script mapped to the local directory of the k8s cluster node, and adding an address allocation command to the virtual network bridge between starting an ovn-controller module by the starting script and starting log monitoring. For the Kylin system, the virtual bridge address is not lost when the server restarts, the cloud platform can be used after being started, and for other computer systems, the process of fixing the virtual bridge address is simpler.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of operating systems, and specifically relates to a method for fixing the address of a kube-ovn network virtual bridge in a Linux operating system. Background Art

[0002] Kubernetes (abbreviated as k8s) is an open-source container cluster management system that can realize functions such as automatic deployment, automatic scaling, maintenance, and monitoring of container clusters, and has been widely used in the market.

[0003] OpenStack is a cloud platform management project aimed at providing virtual servers for public clouds or private clouds. Since OpenStack is not a single software and its deployment is relatively complex, there has been a method of deploying OpenStack on top of k8s, such as using openstack-helm to deploy OpenStack with one key.

[0004] A complete OpenStack virtual machine service requires many components: such as storage, computing, and networking; different components require different networks to achieve cluster communication, some components also require multiple dedicated networks, and some components require 10 Gigabit network cards for high-speed communication; but if each dedicated network uses a dedicated network card, there will be a problem of insufficient network cards; but if several dedicated networks share a network card, when the business situation is relatively complex, it will form a broadcast storm and reduce communication efficiency. At the same time, this solution needs to adapt the network card name during deployment and needs to be modified every time. To solve this problem, the existing solution is to reuse network cards and create multiple virtual bridges on the network cards. Each bridge has an address in a different network segment, which can not only solve the problem of insufficient network cards but also solve the broadcast storm problem caused by different components using network cards with the same address, as Figure 1 shown.

[0005] The creation of a virtual bridge can be achieved through the kube-ovn network architecture. Since the kube-ovn network architecture provides a namespace-based subnet division mechanism, it realizes the effective isolation and management of network resources. It is increasingly used as a CNI network plugin for k8s clusters. At the same time, it can be combined with the OVN network of the Neutron component in OpenStack, which can reduce the use of other k8s cluster CNI network architectures such as Calico and Flannel, reducing resource consumption. At the same time, OpenStack and Kubernetes share the same OVN, so the concepts of VPC and subnet in the two can be aligned to achieve better control and interconnection. At the same time, we can directly use the kube-ovn network component to create a virtual bridge, which also reduces the resource consumption of using other network plugins to create a virtual bridge. Therefore, connecting OpenStack and k8s networks based on kube-ovn has become a new popular trend in network architecture.

[0006] There are two technical problems when connecting OpenStack and k8s networks using kube-ovn in the Linux operating system: (1) Adapt the cloud platform on the Kylin system, integrate the solution of connecting OpenStack and k8s networks based on kube-ovn and reusing network cards on the Kylin system. When using kube-ovn to create a virtual bridge and bind a virtual network card, and using the ifconfig or ip link command to temporarily assign an IP address to the virtual bridge, the IP address of the virtual bridge will disappear after restarting the server.

[0007] If you try to use the / etc / sysconfig / network-scripts configuration file to permanently fix the address of the bridge, since the bridge is created using kube-ovn, you need to start k8s first to have the bridge address. However, since the startup order of the network component or networkmanager component in the configuration file is before k8s, the bridge does not exist when using the configuration file to fix the address of the bridge, so the virtual bridge cannot be assigned an address.

[0008] However, the normal operation of restarting the cloud platform after the server is shut down or powered off is a common scenario and a problem that must be solved. The cloud platform should be usable immediately after startup, and additional configuration of the cloud platform should not be required after startup. Therefore, the IP address of the virtual bridge should be fixed before the cloud platform starts.

[0009] (ii) For Debian and Ubuntu operating systems, there are three steps to configure a virtual bridge using a configuration file: 1. Select a static IP address to configure the URL, 2. Configure the URL and URL mask, 3. Select the network card to bind the virtual bridge. The overall configuration process is complicated. Summary of the invention

[0010] In order to solve the above technical problems, the present invention provides a method for fixing the kube-ovn network virtual bridge address in the Linux operating system. For the Kylin system, the virtual bridge address is not lost when the server is restarted, and the cloud platform can be used as soon as it is turned on. For other Linux operating systems, the process of fixing the virtual bridge address is simpler.

[0011] To achieve the above technical purpose, the technical solution adopted is: a method for fixing the kube-ovn network virtual bridge address in a Linux operating system, comprising the following steps: Step 1. Copy the startup script in the kube-ovn image and save it to the local directory of the k8s cluster node; Step 2: Modify the ovs module installation file so that the startup script saved in the local directory of the k8s cluster node is mapped to the ovn-ovs pod; Step 3. Modify the ovs module installation file and replace the command command from executing the startup script that comes with the kube-ovn image to executing the startup script for local mapping; Step 4. Install the k8s cluster and select the modified kube-ovn obtained in step 3 as the network plug-in. Step 5. Use kube-ovn to create a virtual bridge on the k8s cluster node and assign an address to the virtual bridge in the ovn-ovs pod. Step 6. Modify the startup script mapped to the local directory of the k8s cluster node, and add a command to assign an address to the virtual bridge between starting the ovn-controller module and starting the log monitor in the startup script.

[0012] The ovs module installation file is the ovn-ovs.yaml file.

[0013] The method for modifying the ovs module installation file in the step 2 is to add volumes and volumeMounts modules in the ovs module.

[0014] The beneficial effects of the present invention are: 1. This method solves the problem that the virtual bridge address disappears during the startup of the Kylin system, resulting in the inability to use the cloud platform immediately after startup. This method is applicable to all operating systems, not just the Kylin system. As long as the system is compatible with k8s and kube-ovn, this solution can be used. When using it, compared with configuring a fixed IP address for the virtual bridge in the system configuration file, such as configuring the bridge address under / etc / netplan in the ubuntu system, this method only requires one command: ifconfig bridge name bridge address / mask, which is simpler and requires less configuration.

[0015] 2. No additional network plugins are required. As long as kube-ovn is used, all virtual bridge configurations can be completed, reducing resource consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a schematic diagram of a solution in the prior art where multiple components of OpenStack are installed on k8s and share network cards; Figure 2 It is a flowchart of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0017] The following provides a preferred embodiment of the invention in conjunction with the accompanying drawings to elaborate on the technical solution of the present invention in detail. Here, corresponding drawings will be given to explain the present invention in detail. It should be noted in particular that the preferred embodiments described here are only used to illustrate and explain the present invention, and are not used to limit or define the present invention.

[0018] Kube-ovn is implemented by running an ovs-ovn pod on each k8s cluster node based on the ovn-ovs.yaml file (ovs module installation file) of the ovn-ovs daemonset of the ovn-ovs module. Every time the ovs-ovn pod of ovn-ovs is started (it may be a pod restart caused by deleting the pod, or a pod restart caused by restarting k8s, or a pod restart caused by booting), the ovs-ovn pod will execute the startup command . / start-ovs.sh, that is, run the start-ovs.sh script (startup script) in the kube-ovn image. The start-ovs.sh script is a file that comes with the kube-ovn image. It is the running script of the ovn module to start the ovs-ovn pod. It is responsible for starting the ovs module, starting the ovn module, connecting the ovn module and the ovs module, starting the ovn northbound database and the southbound database, and enabling the logging function. Modify the start-ovs.sh script to add a command to assign an IP address to the virtual bridge, which causes ovs-ovn to start at each boot. When the pod is restarted, the modified start-ovs.sh script will be run to assign an address to the virtual bridge. After the pod is started, the virtual bridge will have an address and the cloud platform can be started smoothly. Figure 2 As shown, the specific implementation method is: Step 1. The ovs module of kube-ovn is installed by the ovn-ovs.yaml file. First, copy the startup script that comes with the kube-ovn image and save it to the local directory of the k8s cluster node, so that each k8s cluster node can copy the start-ovs.sh script in the same path. Each k8s cluster node has a start-ovs.sh script with the same path as in the volumeMounts module to ensure that the ovn-ovs pod can find and execute commands; Step 2. Add the volumes and volumeMounts modules to the ovn-ovs.yaml file to map the start-ovs.sh script saved in the local directory of the k8s cluster node to the ovn-ovs pod. Step 3. Modify the ovn-ovs.yaml file and replace the command command from the start-ovs.sh script that executes the image with the start-ovs.sh script that executes the local mapping. Step 4. Install the k8s cluster, select kube-ovn as the network plug-in, and replace the ovn-ovs.yaml file with the modified ovn-ovs.yaml file. That is, select the modified kube-ovn obtained in step 3 as the network plug-in. Step 5: After installing the k8s cluster, use kube-ovn to create virtual network bridges on the cluster nodes. Example: ovs-vsctl add-br br-ex; ovs-vsctl add-port br-ex eth1; Step 6: Assign an address to the virtual network bridge in the ovn-ovs pod. Example: ifconfig br-ex 192.168.2.10 / 24; Step 7: Modify the start-ovs.sh script mapped to the local directory of the k8s cluster nodes. The original functions of the start-ovs.sh script mainly include starting the ovsdb and vswitchd modules, setting up ovn-sb to connect to the ovn-controller, starting the ovn-controller module, and starting the log listener. Now it is modified to: add a command to assign an address to the virtual network bridge (example: ifconfig br-ex 192.168.2.10 / 24) between starting the ovn-controller module and starting the log listener.

[0019] The above are only the preferred examples of the present invention and are not used to limit or restrict the present invention. For those skilled in the art of research or technology, various changes and modifications can be made to the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the scope of protection claimed by the present invention.

Claims

1. A method for fixing the kube-ovn network virtual bridge address in a Linux operating system, characterized in that: The following steps are involved: Step 1. Copy the startup script in the kube-ovn image and save it to the local directory of the k8s cluster node; Step 2: Modify the ovs module installation file so that the startup script saved in the local directory of the k8s cluster node is mapped to the ovn-ovs pod; Step 3. Modify the ovs module installation file and replace the command command from executing the startup script that comes with the kube-ovn image to executing the startup script for local mapping; Step 4. Install the k8s cluster and select the modified kube-ovn obtained in step 3 as the network plug-in. Step 5. Use kube-ovn to create a virtual bridge on the k8s cluster node and assign an address to the virtual bridge in the ovn-ovs pod. Step 6. Modify the startup script mapped to the local directory of the k8s cluster node, and add a command to assign an address to the virtual bridge between starting the ovn-controller module and starting the log monitor in the startup script.

2. A method for fixing the kube-ovn network virtual bridge address in a Linux operating system as claimed in claim 1, characterized in that: The ovs module installation file is the ovn-ovs.yaml file.

3. A method for fixing the kube-ovn network virtual bridge address in a Linux operating system as claimed in claim 1, characterized in that: The method for modifying the ovs module installation file in the step 2 is to add volumes and volumeMounts modules in the ovs module.

Citation Information

Patent Citations

  • Multi-level network deployment method and device, equipment and storage medium

    CN114124714A

  • K8s network bridge plug-in implementation method and device, electronic equipment and readable storage medium

    CN115622878A

  • Container network management method, container network plug-in and related equipment

    CN116132542A

  • DPU-based k8s cluster deployment method, apparatus and device, and storage medium

    CN119211022A