Creating Network Attachment Definitions

Multus uses network attachment definitions (NADs) accessed with Kubernetes annotations to connect to multiple networks. NADs make it possible to attach multiple network interfaces to your pods.

This is an example of a NAD definition:

apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: vlan-1
  namespace: matrixx
spec:
  config: '{
    "cniVersion": "0.3.1",
    "name": "vlan-1",
    "type": "bridge",
    "bridge": "br200",
    "isDefaultGateway": false,
    "forceAddress": false,
    "ipMasq": false,
    "hairpinMode": false,
    "ipam": {
      "type": "host-local",
      "subnet": "192.168.2.0/24",
      "rangeStart": "192.168.2.201",
      "rangeEnd": "192.168.2.250",
      "routes": [
        { "dst": "0.0.0.0/0" }
      ],
      "gateway": "192.168.2.1"
    }
  }'

Install the NAD with a command like the following:

kubectl create -f filename.yaml

View NADs with a command like the following:

kubectl get network-attachment-definitions --namespace matrixx

The following example output shows four NADs:

NAME             AGE
vlan-conf-1      5d7h
vlan-conf-2      5d7h 
vlan-conf-3      33h
vlan-conf-4      33h