Using multiple network interfaces on k3s

968 Views Asked by At

I'm sort of a newbie in k3s I know that in kubernetes, the multus plugin allows to to have multiple network interfaces attached to a pod, is there a way to have the same result with k3s?

There is this guide to install the plugin on k3s but I did not manage to make it work, has anyone succeded? https://gist.github.com/janeczku/ab5139791f28bfba1e0e03cfc2963ecf

2

There are 2 best solutions below

0
Nitin Bhat On

Update cni bin path i.e /var/lib/rancher/k3s/data/current/bin and cni config path i.e /var/lib/rancher/k3s/agent/etc/cni/net.d in Daemonset of Multus and it should work.

Daemon set should look like

  • name: cni hostPath: path: /var/lib/rancher/k3s/agent/etc/cni/net.d
  • name: cnibin hostPath: path: /var/lib/rancher/k3s/data/current/bin

Logs on multus before updating Daemonset

kubectl logs kube-multus-ds-knpjs -n kube-system -p
Defaulted container "kube-multus" out of: kube-multus, install-multus-binary (init)
2023-11-07T17:23:05Z [verbose] multus-daemon started
2023-11-07T17:25:05Z [error] failed to find the primary CNI plugin: failed to find the cluster master CNI plugin: could not find a plugin configuration in /host/etc/cni/net.d
2023-11-07T17:25:05Z [error] failed to create the configuration manager for the primary CNI plugin: failed to find the cluster master CNI plugin: could not find a plugin configuration in /host/etc/cni/net.d

Logs on multus after updating Daemonset

kubectl logs kube-multus-ds-49h4j -n kube-system
Defaulted container "kube-multus" out of: kube-multus, install-multus-binary (init)
2023-11-07T17:30:56Z [verbose] multus-daemon started
0
maiximnoize On

a simple logical does the trick, without needing to tinker in the multus repo:

ln -s  /var/lib/rancher/k3s/agent/etc/cni/net.d /etc/cni/net.d