Harvester is built on Kubernetes, which uses CNI as an interface between network providers and Kubernetes pod networking. Naturally, we implement the Harvester network based on CNI. Moreover, the Harvester UI integrates the Harvester network to provide a user-friendly way to configure networks for VMs.
Implmentations of the network includes: - Management network - VLAN
Harvester adopts flannel as the default CNI to implement the management network. It's an internal network, which means the user can only access the VM's management network within its cluster nodes or pods.
Below is a use case of the VLAN in Harvester.
- The Harvester network-controller uses a bridge for a node and a pair of veth for a VM to implement the VLAN. The bridge acts as a switch to forward the network traffic from or to VMs and the veth pair is like the connected ports between VMs and the switch.
- VMs within the same VLAN can communicate with each other, while the VMs within different VLANs can't.
- The external switch ports connected to the hosts or other devices (such as the DHCP server) should be set as trunk or hybrid type and permit the specified VLANs.
- Users can use VLAN with
PVID(default 1) to communicate with any normal untagged traffic.
Enabling VLAN in the Harvester UI¶
Enable VLAN via going to Setting > vlan and inputting a valid default physical NIC name for the VLAN.
It is recommended to choose a separate NIC for the VLAN other than the one used for the management network (the one selected during the Harvester installation) for better network performance and isolation.
Modifying the default VLAN network setting will not change the existing configured host networks.
Harvester supports configuring bond interfaces but it can only be created during PEX Boot installation. Refer here for an example.
(optional) Users can customize each node's VLAN network configuration via going to the HOST > Network tab.
A new VLAN network is created by going to the Advanced > Networks page and clicking the Create button.
The network is configured when the VM is created.
Only the first network interface card will be enabled by default. Users can either choose to use a management network or VLAN network.
You will need to select the
Install guest agentoption in the Advanced Options tab to get the VLAN network IP address from the Harvester UI.
Users can choose to add one or multiple network interface cards. Additional network interface card configurations can be set via cloud-init network data. For example:
version: 1 config: - type: physical name: enp1s0 # name is varies upon OS image subnets: - type: dhcp - type: physical name: enp2s0 subnets: - type: DHCP