Page MenuHomeVyOS Platform

VyOS can't work as expected at k8s platform
Open, NormalPublicBUG

Description

When set vyos into the k8s platform, but the MACVLAN can not be recoineged by the system that will cause configuration failed.

root@localhost:~# kubectl get nodes -owide 
NAME        STATUS   ROLES                       AGE   VERSION        INTERNAL-IP    EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION   CONTAINER-RUNTIME
localhost   Ready    control-plane,etcd,master   41h   v1.27.3+k3s1   192.168.2.34   <none>        Debian GNU/Linux 12 (bookworm)   6.1.0-17-amd64   containerd://1.7.1-k3s1
root@localhost:~# 
1. VyOS yaml:
root@localhost:~# cat 5.sh 
#!/bin/bash
set -v 
date

controller_node=`kubectl get nodes --no-headers  -o custom-columns=NAME:.metadata.name| grep control-plane`
worker_node=`kubectl get nodes --no-headers  -o custom-columns=NAME:.metadata.name| grep worker2`

cat <<EOF | kubectl apply -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: macvlan-whereabouts-public
spec:
  config: '{
      "cniVersion": "0.3.0",
      "name": "whereaboutsexample",
      "type": "macvlan",
      "master": "enp2s0",
      "mode": "bridge"
    }'
EOF

cat <<EOF | kubectl apply -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: macvlan-whereabouts-private
spec:
  config: '{
      "cniVersion": "0.3.0",
      "name": "whereaboutsexample",
      "type": "macvlan",
      "master": "enp3s0",
      "mode": "bridge"
    }'
EOF

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: vyos
  annotations:
    k8s.v1.cni.cncf.io/networks: macvlan-whereabouts-public@eth1, macvlan-whereabouts-private@eth2
spec:
  containers:
  - name: vyos
    image: 192.168.2.100:5000/vyos/vyos:1.4.9
    command: ["/sbin/init"]
    volumeMounts:
    - name: lib-muodules
      mountPath: /lib/modules
    securityContext:
      privileged: true
  volumes:
  - name: lib-muodules
    hostPath:
      path: /lib/modules
  nodeName: ${worker_node}
EOF
root@localhost:~#

it should be here.https://github.com/vyos/vyos-1x/blob/f33657534fb6e5253a88a04aa57fee6341b92a87/python/vyos/ethtool.py#L24. there is no such driver for MACVLAN

vyos@vyos# ip a 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 fe80::200:ff:fe00:0/64 scope link 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host proto kernel_lo 
       valid_lft forever preferred_lft forever
2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
4: eth0@if71: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1480 qdisc noqueue state UP group default 
    link/ether e2:24:b8:1e:d3:15 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.16.20.5/32 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::e024:b8ff:fe1e:d315/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever
5: eth1@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 92:c2:7c:79:ad:50 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::90c2:7cff:fe79:ad50/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever
6: eth2@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether ae:cd:93:f4:30:0a brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::accd:93ff:fef4:300a/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever
7: pim6reg@NONE: <NOARP,UP,LOWER_UP> mtu 1452 qdisc noqueue state UNKNOWN group default qlen 1000
    link/pimreg 
[edit]
vyos@vyos# 

root@vyos:~# ethtool -i eth1
driver: macvlan
version: 0.1
firmware-version: 
expansion-rom-version: 
bus-info: 
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
root@vyos:~# su vyos
cvyos@vyos:/root$ configure 
s[edit]
vyos@vyos# set interfaces ethernet 
Possible completions:
 > ethN                 Ethernet interface name   
 >                          //  there is no eth1 and eth2

      
[edit]
vyos@vyos# set interfaces ethernet

Details

Difficulty level
Easy (less than an hour)
Version
VyOS 1.4-rolling-202403030008
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Feature (new functionality)

Event Timeline

Interfaces aren't added on boot because mac address is locally administered: https://github.com/vyos/vyos-1x/blob/current/src/helpers/vyos-interface-rescan.py#L60

Raised this issue before with @jestabro as also seen with VyOS as VM.

Interfaces aren't added on boot because mac address is locally administered: https://github.com/vyos/vyos-1x/blob/current/src/helpers/vyos-interface-rescan.py#L60

Raised this issue before with @jestabro as also seen with VyOS as VM.

No sure it's related with the ticket.

vyos@gwx:~$  show interfaces 
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface        IP Address                        S/L  Description
---------        ----------                        ---  -----------
eth0             172.20.20.4/24                    u/u  
                 2001:172:20:20::4/64                   
eth1             -                                 u/u  
eth1.5           10.1.5.1/24                       u/u  
eth1.8           10.1.8.1/24                       u/u  
eth1.9           10.1.9.1/24                       u/u  
lo               127.0.0.1/8                       u/u  
                 ::1/128                                
vyos@gwx:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 fe80::200:ff:fe00:0/64 scope link 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth1.5@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether aa:c1:ab:d1:66:d1 brd ff:ff:ff:ff:ff:ff
    inet 10.1.5.1/24 brd 10.1.5.255 scope global eth1.5
       valid_lft forever preferred_lft forever
    inet6 fe80::a8c1:abff:fed1:66d1/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1.8@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether aa:c1:ab:d1:66:d1 brd ff:ff:ff:ff:ff:ff
    inet 10.1.8.1/24 brd 10.1.8.255 scope global eth1.8
       valid_lft forever preferred_lft forever
    inet6 fe80::a8c1:abff:fed1:66d1/64 scope link 
       valid_lft forever preferred_lft forever
4: eth1.9@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether aa:c1:ab:d1:66:d1 brd ff:ff:ff:ff:ff:ff
    inet 10.1.9.1/24 brd 10.1.9.255 scope global eth1.9
       valid_lft forever preferred_lft forever
    inet6 fe80::a8c1:abff:fed1:66d1/64 scope link 
       valid_lft forever preferred_lft forever
34: eth0@if35: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:14:14:04 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.20.20.4/24 brd 172.20.20.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2001:172:20:20::4/64 scope global nodad 
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe14:1404/64 scope link 
       valid_lft forever preferred_lft forever
44: eth1@if45: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether aa:c1:ab:d1:66:d1 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::a8c1:abff:fed1:66d1/64 scope link 
       valid_lft forever preferred_lft forever
vyos@gwx:~$ 

but with veth driver, we can see there still with adminirator-mac address. but it can be word well.
Viacheslav triaged this task as Normal priority.Mar 15 2024, 2:30 PM