Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Next, you need to install Multus . You can do this by applying the official Multus CNI manifest from its GitHub repository. Here's the command to download and apply the Multus DaemonSet to your MicroK8s cluster:

kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/deployments/multus-daemonset-thick.yml

This will install Multus CNI as a DaemonSet across all nodes in the cluster.

Verify Multus Installation

Once installed, verify that the Multus pod is running in the kube-system namespace:

...

Look for the multus pod. The pod should be in a Running state. If it is not, inspect the logs to troubleshoot:

to get access to hw devices such as gigavision ethernet cameras.


microk8s enable multus



add a

...

NetworkAttachmentDefinition

To use Multus, you will need to define additional networks for your pods. This is done by creating a NetworkAttachmentDefinition.

Here's an example YAML file for our testbeamline it adds access to the gigavision network of our cameras. 

enp4s0f0 is the network interface that is connected with the cams
rangeStart- rangeEnd are the address that the pod can acquire (note this addresses should not be assigned to HW)


Code Block
languageyaml
titleNetwork attachement configuration
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: gigevision-network
  namespace: testbeamline
spec:
  config: '{
    "cniVersion": "0.3.0",
    "type": "macvlan

...

",
    "mode": "bridge",
    "master": "enp4s0f0", ## the ethernet adapter that you 
     
    "ipam": {
      "type": "host-local",
      "subnet": "192.168.115.0/24",
      "rangeStart": "192.168.115.220",
      "rangeEnd": "192.168.115.254",
      "routes": [
        {
          "dst": "192.168.115.0/24",
          "gw": "192.168.115.2"
        }
      ],
      "gateway": "192.168.115.2"
    }
  }'




  • Apply the NetworkAttachmentDefinition with:


    microk8s kubectl apply -f <filename>.yaml


  • Deploy Pods Using Multiple Networks

    After Multus is installed and your custom networks are defined, you can deploy pods with multiple network interfaces. Here's an example pod spec using two networks (one default and one from Multus):

    Code Block
    languageyaml
    titleTest gige camera access
    apiVersion: v1
    kind: Pod
    metadata:
      name: pod-with-multus
      namespace: testbeamline
      annotations:
        k8s.v1.cni.cncf.io/networks: gigevision-network
    spec:
      containers:
      - name: app-container
        image:  baltig.infn.it:4567/epics-containers/infn-epics-ioc:latest
        command: ["/bin/sh", "-c", "sleep 3600"]

...