fix(sysctl-tuner): size the host route MTU for encrypted node traffic #161
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/host-route-mtu"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Cilium runs
encrypt-node: true, so host-to-host traffic (nvme-tcp replication, kubelet, etcd) goes throughcilium_wg0(MTU 1355). The dhcpcd route to the private network keeps the interface MTU (1450), so the host builds 1450-byte segments; each one plus WireGuard framing is larger than 1450 and the kernel fragments it.Measured 2026-09-01:
Ip: FragOKs3.8 billion,ReasmFails14kmss:1398 pmtu:1450; the control plane (NodeEncryption OptedOut) shows 0 fragmentsPod routes are fine (
mtu 1305); only the host routes are wrong. Jumbo frames are not available on Hetzner cloud networks.Change
The
sysctl-tunerDaemonSet gets aroute-mtucontainer. It reads its own CiliumNode once a minute (getonly, new ServiceAccount + one-rule ClusterRole) to learn if the node encrypts, and every 5 s:ip route show proto dhcphides theprotoword, andip route changewithout it would flip the route toproto boot);srcis the node's own address (status.hostIP), so the public default route, on-link routes, Cilium's routes and operator static routes are never touched;mtuto thecilium_wg0MTU on encrypting nodes, and back to the interface MTU on opted-out nodes (the control plane) or whencilium_wg0is gone.It reconciles because the private interface belongs to dhcpcd 10 (
hc-net-ifup@enp7s0), which puts the interface MTU back on the route at every rebind, and dhcpcd has no knob for a route MTU below the interface MTU. Until the CiliumNode has been read once it does nothing; after that the last good read stands through API outages.Wiring:
hostPID+ privileged soipand sysfs come from the host throughnsenter --target=1 --mount --net(the image has no iproute2);system-node-criticalso node pressure cannot evict the reconciler; a memory limit and no CPU limit (a CFS quota throttles every pass and paints the throttling dashboard red for nothing).Guard
tests/host-route-mtu-contract.shruns the real inline script under fakensenter/ip/curl/sleepand asserts the exactip route changeargv in ten cases: encrypting, converged, opted-out, API unreachable, API answers garbage, API lost after a good read (state stands, only two reads in 13 passes),cilium_wg0gone, route without anmtuword, kernel state words (linkdown dead) stripped, and a clean exit within 5 s of SIGTERM. The fakes check their own calls:ipis only reachable through nsenter with the host namespaces,curlmust present-f, the CA, the bearer token and this node's CiliumNode URL. The CiliumNode answer is parsed withyq -p=json(the same binary in pipeline-tools and the admission image, which has no jq); an empty or bad answer keeps the last good read. Wired intotests/check.sh; green locally and inside the admission image (2026-09-02).Mutation-checked: 22 manifest mutations each turn the test red (widened RBAC, wrong target MTU, opted-out read as encrypting, unreadable/empty/failed read as key 0, YAML parse instead of JSON, assume-unencrypted at start, CiliumNode read every pass, 30 s route pass, dropped
proto dhcporsrcfilter, foreground sleep, CPU limit back, priority class removed, unprivileged, no hostPID, nsenter without--net, curl without-f, keptmtu/linkdownwords).Verify after deploy
kubectl -n sysctl-tuner logs ds/sysctl-tuner -c route-mtushowsnode encryption: yesand oneroute mtu 1355 (was 1450)line per worker; the control plane logsnode encryption: noand changes nothingss -tinon :8420 / :6443 showspmtu:1355;Ip: FragOKsin/proc/net/snmpstops climbingmtu 1450,FragOKsstill 0sysctl-tunerhttps://claude.ai/code/session_01LeVatedQ4sCA1u6LHjo7B5
b7fc634ca10a1d98a05b