abiosoft / abiosoft/colima

col0 interface does not get address from DHCP

Abierto
#939 9 comentarios 7 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
30.8k
Forks
613
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Description

When runnig colima with `-k --network-address`, sometimes k3s fails to boot because it cannot bind to an IP.
```
> colima start -k --network-address
...
INFO[0030] starting ... context=kubernetes
Job for k3s.service failed because the control process exited with error code.
See "systemctl status k3s.service" and "journalctl -xeu k3s.service" for details.

> colima ssh

$ sudo journalctl -xeu k3s
...
Dec 15 19:16:06 colima k3s[4356]: time="2023-12-15T19:16:06Z" level=fatal msg="starting kubernetes: preparing server: init cluster datastore and https: listen tcp: lookup --advertise-address: Try again"
Dec 15 19:16:06 colima systemd[1]: k3s.service: Main process exited, code=exited, status=1/FAILURE

$ sudo journalctl -xb | grep "advertise-address"
Dec 15 21:36:33 colima k3s[2193]: time="2023-12-15T21:36:33Z" level=info msg="Running kube-apiserver --advertise-address= --advertise-port=6443 --allow-privileged=true --anonymous-auth=false ...

$ ip a | grep col0 -A6
3: col0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether xxxx brd ff:ff:ff:ff:ff:ff
inet6 xxxx/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 2591904sec preferred_lft 604704sec
inet6 xxxx/64 scope link
valid_lft forever preferred_lft forever
4: docker0: mtu 1500 qdisc noqueue state DOWN group default
```

As you can see, kube does not start because it cannot bind to an address - the arg value is blank during startup. `col0` interface is also missing `ipv4` inet that should be provided by DHCP. Running `colima start -k --network-address=false` works just fine. The issue is the same for `vz` / `qemu`.

What is weird is the fact that this issue occurs only sometimes and only for some developers. For example, on my machine it works as it should.

A workaround is to add a static address to the `col0` interface and reset kube.
Via a provision script:
```
> colima stop && colima start -k=false

> yq -i '
.provision[0].mode = "system",
.provision[0].script = "ip address add 192.168.107.2/24 brd 192.168.107.255 scope global dev col0"
'\
~/.colima/default/colima.yaml

> colima k reset && colima stop && colima start -k
```

Also, some devs have multiple vmnet bridges on their host and some don't. If there is no bridge with `192.168.107.x` inet, one has to use the default bridge's address range with `192.168.106.x` in the static ip setup for it to work.

```
> ifconfig
vmenet0: flags=8963 mtu 1500
ether xxxx
media: autoselect
status: active
bridge100: flags=8a63 mtu 1500
options=3
ether xxxx
inet 192.168.106.1 netmask 0xffffff00 broadcast 192.168.106.255
inet6 xxxx%bridge100 prefixlen 64 scopeid 0x19
inet6 xxxx prefixlen 64 autoconf secured
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x0
member: vmenet0 flags=3
ifmaxaddr 0 port 24 priority 0 path cost 0
nd6 options=201
media: autoselect
status: active
vmenet1: flags=8963 mtu 1500
options=60
ether xxxx
media: autoselect
status: active
bridge101: flags=8a63 mtu 1500
options=63
ether xxxx
inet 192.168.107.1 netmask 0xffffff00 broadcast 192.168.107.255
inet6 xxxx%bridge101 prefixlen 64 scopeid 0x1b
inet6 fxxxx prefixlen 64 autoconf secured
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x0
member: vmenet1 flags=10803
ifmaxaddr 0 port 26 priority 0 path cost 0
nd6 options=201
media: autoselect
status: active
```

### Version

colima version 0.6.7
git commit: ba1be00e9aec47f2c1ffdacfb7e428e465f0b58a

runtime: docker
arch: aarch64
client: v24.0.7
server: v24.0.7
limactl version 0.19.0
qemu-img version 8.1.3

### Operating System

- [ ] macOS Intel <= 13 (Ventura)
- [ ] macOS Intel >= 14 (Sonoma)
- [ ] Apple Silicon <= 13 (Ventura)
- [X] Apple Silicon >= 14 (Sonoma)
- [ ] Linux

### Output of `colima status`

_No response_

### Reproduction Steps

The issue occurs seemingly at random and is not deterministic whatsoever.

### Expected behaviour

Colima should start with kube and external IP.

### Additional context

_No response_

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.