Configuring Multi-NIC Virtual Machine
Use Kube-OVN together with Multus to provide multi-NIC support for virtual machines
Prerequisites
- Alauda Container Platform version must be v4.1.0 or higher.
- Kube-OVN is used as the CNI.
- Alauda Container Platform Networking for Multus is installed
Procedure
Create Secondary Network
-
Create NetworkAttachmentDefinition
Execute the following command on the cluster control node:
Parameters:
- name: The name of NetworkAttachmentDefinition.
- namespace: The namespace of NetworkAttachmentDefinition, Must use the same namespace as the virtual machine.
- provider: The
<name>.<namespace>.ovnof the current NetworkAttachmentDefinition. Kube-OVN will use this information to find the corresponding Subnet resource. Note that the suffix must be set to ovn.
-
Create a Kube-OVN Subnet
If using Kube-OVN as a secondary network interface, the provider should be set to the corresponding NetworkAttachmentDefinition's
<name>.<namespace>.ovn, and must end with the ovn suffix.Execute the following command on the cluster control node:
Parameters:
- name: The name of subnet.
- provider: The provider of NetworkAttachmentDefinition.
- cidrBlock: The subnet cidr.
- gateway: The gateway address.
- excludeIps: The set reserved IP will not be automatically allocated. For example, it can be used as the IP address for computing components' fixed IP.
Create a Multi-NIC Virtual Machine
-
Create Virtual Machine via UI
-
Switch to YAML view and add another nic to virtual machine
Add new interface under
spec.template.spec.domain.devices.interfacesAdd new network under
spec.template.spec.networksThe networkName is the name of NetworkAttachmentDefinition.
Configure Network For New NIC
After the virtual machine starts, you need to enter the virtual machine and manually configure the network for the newly added nic.
Hotplug Network Interfaces
Hotplugging and unplugging network interfaces into a running Virtual Machine is supported
Hotplug is supported for interfaces using the virtio model connected through bridge binding or SR-IOV binding.
Hot-unplug is supported only for interfaces connected through bridge binding.
-
Adding an interface to a running VM
Use kubectl edit to modify the virtual machine's YAML configuration
-
Removing an interface from a running VM
Use kubectl edit to modify the virtual machine's YAML configuration