feat(mtu): auto-detect and allow override of network MTU [KS-72] - #179
Merged
Conversation
|
Note PR image published: |
There was a problem hiding this comment.
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 intotypes.Embedded. - Applies the resolved MTU to the embedded bridge CNI config (
bridgepluginmtu). - 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
--mtuflag.
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.
stevensbkang
approved these changes
Aug 4, 2026
yajith
force-pushed
the
feat/ks-72/mtu-auto-detect-override
branch
from
August 5, 2026 01:00
855c860 to
af8648d
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
network.GetNodeMTU()) and lets it be overridden via--mtu/KUBESOLO_MTU, mirroring the existing--node-ippatterncni0bridge and pod veth interfaces, fixing silent fragmentation/blackholing on hosts whose primary interface has MTU < 1500 (VPN/tunnel/PPPoE links, some cloud secondary NICs)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/resetRef: KS-72