How To Luigi Ipvlan

IPVLAN

Following example shows how to create Network Attachment definition for IPVLAN

Create Network Attach Definition ipvlan type

Please copy paste the following definition update the values of your subnet and apply it to our cluster:

apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: whereabouts-ipvlan-conf-1
spec:
  config: '{
      "cniVersion": "0.3.0",
      "name": "ipvlan-conf-1",
      "type": "ipvlan",
      "master": "eth2",
      "mode": "l2",
      "ipam": {
        "type": "whereabouts",
        "range": "192.168.70.0/24",
        "range_start": "192.168.70.20",
        "range_end": "192.168.70.50",
        "gateway": "192.168.70.1"
      }
    }'

The master key value is the reference to the *second nic * in our worker nodes.

Network Attach Definition Validation ipvlan type

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

Create Pods with ipvlan interfaces

Deploy the new pods

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.

Validate Pods Creation with ipvlan interfaces

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

East-West ipvlan traffic

North-South ipvlan traffic:

Last updated

Was this helpful?