Skip to content

feat(mtu): auto-detect and allow override of network MTU [KS-72] - #179

Merged
yajith merged 1 commit into
developfrom
feat/ks-72/mtu-auto-detect-override
Aug 5, 2026
Merged

feat(mtu): auto-detect and allow override of network MTU [KS-72]#179
yajith merged 1 commit into
developfrom
feat/ks-72/mtu-auto-detect-override

Conversation

@yajith

@yajith yajith commented Aug 3, 2026

Copy link
Copy Markdown
Member
  • Auto-detects the network MTU of the interface backing the node IP (network.GetNodeMTU()) and lets it be overridden via --mtu/KUBESOLO_MTU, mirroring the existing --node-ip pattern
  • Applies the resolved MTU to the embedded bridge CNI's cni0 bridge and pod veth interfaces, fixing silent fragmentation/blackholing on hosts whose primary interface has MTU < 1500 (VPN/tunnel/PPPoE links, some cloud secondary NICs)
  • In container run mode, creates a dedicated Docker network (kubesolo[-<name>]-net) sized to the same MTU, since Docker has no per-container MTU knob and an existing network's MTU is immutable — keeps the outer container network and inner CNI bridge in lockstep across install/upgrade/reset

Ref: KS-72

@yajith
yajith requested a review from stevensbkang as a code owner August 3, 2026 09:20
@linear

linear Bot commented Aug 3, 2026

Copy link
Copy Markdown

KS-72

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Note

PR image published: portainerci/kubesolo:pr-179

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds MTU auto-detection (with optional override) and propagates the resolved MTU into the embedded bridge CNI configuration; additionally introduces a dedicated Docker network in container run mode intended to keep the container’s outer network MTU aligned with the inner CNI MTU.

Changes:

  • Introduces MTU detection/override resolution (network.GetNodeMTU / network.ResolveMTU) and threads the resolved MTU into types.Embedded.
  • Applies the resolved MTU to the embedded bridge CNI config (bridge plugin mtu).
  • In container run mode, creates/maintains a per-instance Docker bridge network with an MTU option and runs the container attached to that network; documents the new --mtu flag.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
types/types.go Extends embedded runtime configuration with MTU + “specified” tracking.
types/const.go Adds DefaultMTU fallback constant for detection failures.
internal/runtime/network/mtu.go Implements MTU selection aligned with node IP selection and override resolution semantics.
internal/runtime/network/mtu_test.go Adds unit tests for MTU selection and override behavior.
internal/runtime/network/ip.go Refactors IPv4 classification to share logic with MTU selection.
internal/core/embedded/load.go Plumbs MTU into CNI config generation/writing.
internal/core/embedded/embedded.go Passes embedded MTU into CNI config loading.
internal/core/embedded/embedded_riscv64.go Passes embedded MTU into CNI config loading (riscv64 variant).
internal/core/embedded/config.go Sets bridge plugin mtu field in generated embedded CNI config.
internal/config/flags/flags.go Adds --mtu / KUBESOLO_MTU flag to the main kubesolo binary (kingpin flags).
internal/cli/service/container.go Adds per-instance Docker network creation/recreate on MTU change and attaches the container to it.
internal/cli/config/config.go Adds MTU flag plumbing into generated container CMD args.
internal/cli/cmd_install.go Adds --mtu flag to the installer/ctl CLI (cobra flags).
docs/installation/flags.md Documents the new --mtu flag and env var.
docs/configuration/cni.md Documents embedded CNI MTU auto-detection and the --mtu override reference.
cmd/kubesolo/main.go Resolves MTU during bootstrap, warns on failures/IPv6-minimum, and stores MTU in embedded config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/cli/service/container.go
@yajith
yajith force-pushed the feat/ks-72/mtu-auto-detect-override branch from 855c860 to af8648d Compare August 5, 2026 01:00
@yajith
yajith merged commit a3e7dd6 into develop Aug 5, 2026
20 checks passed
@yajith
yajith deleted the feat/ks-72/mtu-auto-detect-override branch August 5, 2026 02:02
KubeSolo's embedded bridge CNI always used the kernel default MTU of
1500 for cni0 and pod veth interfaces, with no way to detect or adjust
it. On hosts whose primary interface has a reduced MTU (VPN/tunnel/
PPPoE links, some cloud secondary NICs), pod traffic built at 1500
would silently fragment or blackhole on egress.

Add network.GetNodeMTU()/ResolveMTU() (mirroring the existing
--node-ip pattern) to auto-detect the MTU of the interface backing the
node IP, with a --mtu/KUBESOLO_MTU override. Thread the resolved value
into the embedded CNI bridge config. In container run mode, also
create a dedicated Docker network sized to the same MTU (Docker has no
per-container MTU knob and an existing network's MTU is immutable), so
the outer container network and inner CNI bridge stay in lockstep.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants