Skip to content

Gateway k3s-agent crash-loops on flannel vxlan reCreateVxlan panic (index out of range) #1668

Description

@pau-hedgehog

During env-1 mesh/l2vni release-test run 20260728-113711-release-test-default-default-ce28f3b58-pau (build ema/test-connectivity @ ce28f3b58, k3s v1.36.2+k3s1, flannel v0.28.4, gateway dataplane v0.22.0), both gateway VMs hit a repeating k3s-agent crash on the flannel vxlan backend.

Verbatim from gateway-2's journal:

Jul 28 12:17:26 gateway-2 k3s[11290]: I0728 12:17:26.083720   11290 vxlan_network.go:143] Interface flannel.1 deleted
Jul 28 12:17:26 gateway-2 k3s[11290]: I0728 12:17:26.083791   11290 vxlan_network.go:102] vxlan device missing, attempting to recreate...
Jul 28 12:17:26 gateway-2 k3s[11290]: panic: runtime error: index out of range [0] with length 0
Jul 28 12:17:26 gateway-2 k3s[11290]: goroutine 9177 [running]:
Jul 28 12:17:26 gateway-2 k3s[11290]: github.com/flannel-io/flannel/pkg/backend/vxlan.(*network).reCreateVxlan(0x196b67d3400, {0x8522398, 0x196b5868d80})
Jul 28 12:17:26 gateway-2 k3s[11290]:         /go/pkg/mod/github.com/flannel-io/flannel@v0.28.4/pkg/backend/vxlan/vxlan_network.go:217 +0xda6
Jul 28 12:17:26 gateway-2 k3s[11290]: github.com/flannel-io/flannel/pkg/backend/vxlan.(*network).Run.func3()
Jul 28 12:17:26 gateway-2 k3s[11290]:         /go/pkg/mod/github.com/flannel-io/flannel@v0.28.4/pkg/backend/vxlan/vxlan_network.go:106 +0x25
Jul 28 12:17:26 gateway-2 k3s[11290]: created by github.com/flannel-io/flannel/pkg/backend/vxlan.(*network).Run in goroutine 740
Jul 28 12:17:26 gateway-2 k3s[11290]:         /go/pkg/mod/github.com/flannel-io/flannel@v0.28.4/pkg/backend/vxlan/vxlan_network.go:105 +0x3a5
Jul 28 12:17:26 gateway-2 systemd[1]: k3s-agent.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jul 28 12:17:26 gateway-2 systemd[1]: k3s-agent.service: Failed with result 'exit-code'.

systemd auto-restarts the agent after each crash. This recurred 28 times on gateway-2 and 10 times on gateway-1 over roughly 50 minutes in this one run. Each crash also drops the agent's tunnel session to control-1 for a few seconds, visible as bursts of failed to find Session for client gateway-<N> 502s in the control-1 k3s log at matching timestamps. Workload containers (dataplane, frr) are unaffected, only the k3s-agent/kubelet process bounces.

Confirmed: flannel's reCreateVxlan indexes into an empty slice when reprogramming flannel.1 after observing it deleted, panicking.

Not confirmed: what repeatedly deletes the flannel.1 interface on the gateway node in the first place.

Ask: (1) guard against the empty-slice case in the vendored flannel reCreateVxlan path so it doesn't panic, (2) investigate what deletes the gateway's flannel.1 vxlan interface repeatedly.

Where in the attached show-tech bundle: multi-vpc-single-subnet-suite/gateway-peering-masquerade-and-port-forward-nat/gateway-2-show-tech.log (28 occurrences) and gateway-1-show-tech.log (10 occurrences), grep for panic: runtime error: index out of range. The matching tunnel-session 502s are in control-1-show-tech.log, grep for failed to find Session for client gateway-.

show-tech.tar.gz

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions