Configure MTU
In Kube-OVN, the MTU (Maximum Transmission Unit) setting is crucial for ensuring optimal network performance and avoiding packet fragmentation. The MTU defines the maximum size of a packet that can be transmitted over the network.
By default, Kube-OVN detects the MTU of the underlying physical network interface and sets the MTU for the virtual network interfaces accordingly. However, there are scenarios where you might need to customize the MTU settings for your Kube-OVN networking components.
Default MTU Behavior
Kube-OVN automatically detects the MTU of the physical network interface on the host machine, and sets the MTU for the Pod and OVS interfaces accordingly.
In overlay networks, Kube-OVN reduces the MTU to accommodate the VXLAN or Geneve encapsulation overhead. Here is how the MTU is calculated:
In underlay networks, the MTU is set to match the physical network interface MTU.
Customizing MTU Settings
MTU settings can be customized globally for overlay networks or on a per-subnet basis.
Adjusting MTU settings incorrectly can lead to network performance issues, including packet loss and fragmentation. Ensure that the MTU settings are compatible with your underlying network infrastructure before making changes.
MTU configuration changes will only take effect for newly created Pods. Existing Pods will retain their original MTU settings until they are recreated. It's recommended to plan for Pod restarts when changing MTU settings.
Global MTU Configuration
To set a global MTU for overlay networks, you can modify the command parameter of the kube-ovn-cni DaemonSet.
For example, to set the global MTU to 1400, you would update the DaemonSet as follows:
Then, add or update the --mtu=1400 parameter to the container's arguments:
The global MTU setting only affects overlay networks. For underlay networks, the MTU remains the same as the physical network interface MTU by default.
Per-Subnet MTU Configuration
You can also set the MTU for individual subnets by specifying the mtu field in the subnet configuration.
For example, to set the MTU for a specific subnet to 1450, you can use the following command:
This setting will override the global MTU setting for that particular subnet.