Multus CNI is a container network interface (CNI) plugin for K8s that enables attaching multiple network interfaces to pods. Normally, when you deploy a pod, it will have single interface. so using Multus, you will be able to attach multiple interfaces to pod. This post explains how to install the Multus package onto a Tanzu Kubernetes (workload) cluster and use it to create pods with multiple network interfaces.
For example, Antrea or Calico as the primary CNI, and a secondary interface such as macvlan.
- Bootstrap machine with the following installed: Tanzu CLI, kubectl installed as mentioned here
- Tanzu Kubernetes Grid management cluster and workload cluster running on vSphere, Amazon EC2, or Azure, with the package repository installed. For this demo, I have deployed TKG on Azure.
In TMC Console: Catalog > select the workload cluster (capv-workload in my case) from drop down and click on multus-cni
- Click on Install Package which can be found on top right side of the page
- Name the Installed package as : capv-workload-multus and click NEXT
- Package install resources: Leave to Default and click NEXT
- Configure values: Leave to Default
- Install Package
In TMC Console: Clusters > capv-workload > Add-ons > Installed > check if the package (multus-cni.tanzu.vmware.com) is succeeded and healthy
- connect to workload cluster node(s) and check for the file macvlan under directory /opt/cni/bin
- Create a CRD specification. For example, create a file with name as multus-cni-crd.yaml that specifies a NetworkAttachmentDefinition named macvlan-conf, which configures a macvlan CNI:
- Create test pod with config as below:
- Once the pod is created, it will have three network interfaces (including loop back interface) as shown below. net1 is the new interface created via multus-cni.