fix(bootstrap): use iptables-nft backend for flannel on Podman#26
Merged
maxamillion merged 1 commit intoLobsterTrap:midstreamfrom Apr 8, 2026
Merged
Conversation
On modern distributions (Fedora 43+, RHEL 10+) that ship only nf_tables without legacy iptable_nat/iptable_filter kernel modules, flannel's masquerade rules fail because the container's iptables alternative points to iptables-legacy by default. Register the k3s-bundled xtables-nft-multi as a higher-priority iptables alternative via update-alternatives so flannel uses the nf_tables kernel path. This eliminates the dependency on legacy iptables kernel modules while preserving compatibility with older hosts that still have them. Replaces the previous approach of warning about missing iptable_nat and requiring users to manually load legacy kernel modules. Validated on Fedora 43 with SELinux Enforcing, firewalld active, and zero legacy iptables modules loaded.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
Summary
On modern distributions (Fedora 43+, RHEL 10+) that ship only nf_tables without legacy
iptable_nat/iptable_filterkernel modules, the openshell gateway fails to start because flannel's masquerade rules crash with:Root Cause
The cluster container's
/usr/sbin/iptables→/etc/alternatives/iptables→iptables-legacy, which requires theiptable_natkernel module. While kube-proxy was already correctly set to--proxy-mode=nftablesfor Podman, flannel's embedded traffic manager still calls/usr/sbin/iptablesfor masquerade rules, hitting the legacy path.Fix
Register the k3s-bundled
xtables-nft-multi(/usr/bin/aux/xtables-nft-multi) as a higher-priority iptables alternative viaupdate-alternativesin the entrypoint script. This redirects flannel's iptables calls to the nft backend, which uses thenf_tableskernel module (always available on modern distros) instead of the legacyiptable_natmodule.update-alternatives --install \ /usr/sbin/iptables iptables /usr/bin/aux/xtables-nft-multi 20 \ --follower /usr/sbin/ip6tables ip6tables /usr/bin/aux/xtables-nft-multi \ --follower /usr/sbin/iptables-save iptables-save /usr/bin/aux/xtables-nft-multi \ --follower /usr/sbin/iptables-restore iptables-restore /usr/bin/aux/xtables-nft-multi \ --follower /usr/sbin/ip6tables-save ip6tables-save /usr/bin/aux/xtables-nft-multi \ --follower /usr/sbin/ip6tables-restore ip6tables-restore /usr/bin/aux/xtables-nft-multiPriority 20 beats the existing
iptables-legacyat priority 10, soupdate-alternativesauto-selects the nft backend. All follower symlinks switch atomically.This also removes the previous workaround of warning users to manually
modprobe iptable_nat.Related Issue
Fixes gateway startup failure on Fedora 43 (and any nftables-only host) when running via Podman from the COPR package.
Changes
deploy/docker/cluster-entrypoint.sh: For Podman runtime, registerxtables-nft-multias a higher-priority iptables alternative before starting K3s. Remove theiptable_natkernel module warning check.Testing
Validated end-to-end on an ephemeral Fedora 43 Linode instance:
iptables --versioninside containerv1.8.11 (nf_tables)✅subnet.envChecklist
CONTAINER_RUNTIME=podman)