How To Luigi Macvlan

MacVLAN type definition

Create Network Attach-Definition macvlan type

apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: macvlan-conf-1
spec:
  config: '{
      "cniVersion": "0.3.0",
      "name": "macvlan-conf-1",
      "type": "macvlan",
      "master": "eth1",
      "mode": "bridge",
      "ipam": {
        "type": "whereabouts",
        "range": "192.168.60.0/24",
        "range_start": "192.168.60.20",
        "range_end": "192.168.60.50",
        "gateway": "192.168.60.1"
      }
    }'

The master key value is the reference to the *_second nic *_in our worker nodes.

Network Attach Definition Validation macvlan type

Let’s validate our work by listing and describing our new Network Attach Definition

Pod Definitions with 2 interfaces

In order for pods to be created with an additional nic, and the same principle applies for adding more than two NICs to the pod, the pod definition should be called with network annotations making reference to the Network Attach Definition(s) please use the following pods definitions to create a testbed.

Create Pods with mcvlan interfaces

Deploy the new pods

Validate Pods Creation with macvlan interfaces

Let’s validate your work by confirming that the pods got created with an additional interface by doing the following commands:

Connectivity Testing

East-West macvlan traffic

North-South macvlan traffic:

Last updated

Was this helpful?