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.
As of version 0.2.0, Harvester supports two kinds of networks:
- management network
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.
- 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 switch.
- VMs within the same VLAN is able to communicate with each other, while the VMs within different VLANs can't.
- The external switch ports connected with the hosts or other devices(such as 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 to enable VLAN and input a valid default physical NIC name for the VLAN.
The first physical NIC name of each Harvester node always defaults to eth0. 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.
- (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 agent option 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