Simple NAD Examples - Simple NAD Examples - UG1656

Onload Operator for Kubernetes User Guide (UG1656)

Document ID
UG1656
Release Date
2024-04-26
Revision
1.0 English

The following simple NAD examples presume an interface name of bond0 and address allocation of whereabouts, but neither bonding nor a specific address allocation method are required.

You must ensure the metadata.namespace in the NAD matches the namespace of your workload pods if Multus namespace isolation is configured.

IPVLAN

apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: ipvlan-bond0
spec:
  config: |
    {
      "cniVersion": "0.3.1",
      "type": "ipvlan",
      "name": "ipvlan-bond0",
      "master": "bond0",
      "ipam": {
        "type": "whereabouts",
        "range": "198.19.0.0/16"
      }
    }

MACVLAN

apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: macvlan-bond0
spec:
  config: |
    {
      "cniVersion": "0.3.1",
      "type": "macvlan",
      "name": "macvlan-bond0",
      "master": "bond0",
      "mode": "bridge",
      "ipam": {
          "type": "whereabouts",
          "range": "198.18.0.0/16"
      }
    }

See also https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/examples/macvlan-pod.yml.