Harvester Network

Summary

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
  • VLAN

Implementation

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.

VLAN

Harvester network-controller leverages the multus and bridge CNI plugins to implement the VLAN.

Below is a use case of the VLAN in Harvester.

Harvester Network - 图1

  • 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 can 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.

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.

Note

Modifying the default VLAN network setting will not change the existing configured host networks.

Harvester Network - 图2

  • (optional) Users can customize each node’s VLAN network configuration via going to the HOST > Network tab.

Harvester Network - 图3

  • A new VLAN network is created by going to the Advanced > Networks page and clicking the Create button.

Harvester Network - 图4

  • 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.

Note

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.

Harvester Network - 图5

  • 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:

    1. version: 1
    2. config:
    3. - type: physical
    4. name: enp1s0 # name is varies upon OS image
    5. subnets:
    6. - type: dhcp
    7. - type: physical
    8. name: enp2s0
    9. subnets:
    10. - type: DHCP