Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring VLAN Support

By default, Kube-OVN uses Geneve to encapsulate cross-host traffic and abstracts a virtual overlay network from the infrastructure. In addition, Kube-OVN supports the VLAN function since version 1.2.0. In scenarios sensitive to performance and throughput, an underlay network in VLAN mode is supported. The container network can be directly connected to physical switches through the VLAN to achieve better performance and throughput.

To use the VLAN mode, a host must have a NIC dedicated for the container network. The NIC port on the switch must work in trunk mode to allow 802.1Q data packets to pass through. Currently, Geneve or VLAN is a global option, and all containers must work in the same mode.

The VLAN mode requires that an independent NIC is provided for the Kube-OVN container network. The VLAN mode is not recommended for a single network plane.

The following is an example of configuring VLAN support:

  1. Modify the installation script.

    In the script, set NETWORK_TYPE to VLAN and VLAN_INTERFACE_NAME to the corresponding host NIC, and deploy the cluster in the original mode.

  2. Create a VLAN.
    1
    kubectl create -f vlan.yaml
    

    Create the following VLAN:

    vim vlan.yaml
    apiVersion: kubeovn.io/v1
    kind: Vlan
    metadata:
      name: product
    spec:
      vlanId: 10
  3. Create a namespace.
    1
    kubectl create -f namespace.yaml
    

    Create the following namespace:

    vim namespace.yaml
    apiVersion: v1
    kind: Namespace
    metadata:
      name: product
      labels:
        name: product
  4. Create subnets and bind them to the VLAN.
    1
    kubectl create -f subnet.yaml
    

    The command will create the following subnets. Multiple subnets can be bound to the same VLAN.

    vim subnet.yaml
    apiVersion: kubeovn.io/v1
    kind: Subnet
    metadata:
      name: product
    spec:
      cidrBlock: 10.100.0.0/16
      default: false
      gateway: 10.100.0.1
      gatewayType: distributed
      natOutgoing: true
      vlan: product
      namespaces:
        - product
  5. Create a pod.

    Run the following command to deploy the nginx pod in the namespace created in 3 and allocate IP addresses to the pod in the corresponding VLAN:

    1
    kubectl run samplepod --image=nginx --namespace=product