|
675 | 675 | # Select kube-proxy mode |
676 | 676 | # --------------------------------------------------------------------------- |
677 | 677 | # Under Podman, use native nftables kube-proxy mode so no legacy iptables |
678 | | -# kernel modules (ip_tables, iptable_nat, etc.) are required on the host. |
679 | | -# Docker retains the default iptables mode for maximum compatibility. |
| 678 | +# kernel modules are needed for kube-proxy service routing. |
| 679 | +# |
| 680 | +# Flannel's embedded traffic manager in k3s v1.35.x still uses the iptables |
| 681 | +# binary (no nft backend compiled in). The iptables binary inside the |
| 682 | +# container is iptables-legacy, which requires the iptable_nat, iptable_filter, |
| 683 | +# and ip_tables kernel modules. Modern distributions (Fedora 43+, RHEL 10+) |
| 684 | +# no longer load these modules by default. The RPM %post scriptlet both |
| 685 | +# loads the modules immediately and installs a modules-load.d config for |
| 686 | +# persistence across reboots. The warning below covers non-RPM installs. |
| 687 | +# |
| 688 | +# Docker retains the default iptables kube-proxy mode for maximum compatibility. |
680 | 689 | EXTRA_KUBE_PROXY_ARGS="" |
681 | 690 | if [ "${CONTAINER_RUNTIME:-}" = "podman" ]; then |
682 | 691 | echo "Podman detected — using nftables kube-proxy mode" |
683 | 692 | EXTRA_KUBE_PROXY_ARGS="--kube-proxy-arg=proxy-mode=nftables" |
| 693 | + |
| 694 | + # Verify legacy iptables kernel modules are loaded on the host. |
| 695 | + # Flannel's traffic manager calls iptables-legacy for masquerade rules, |
| 696 | + # which requires iptable_nat and related modules. The RPM loads these |
| 697 | + # at install time and persists them via modules-load.d, but they may be |
| 698 | + # absent on non-RPM installs or manually configured systems. |
| 699 | + if ! cat /proc/modules 2>/dev/null | grep -q '^iptable_nat '; then |
| 700 | + echo "Warning: iptable_nat kernel module is not loaded on the host." >&2 |
| 701 | + echo " Flannel masquerade rules will fail without it." >&2 |
| 702 | + echo " Load it now with: sudo modprobe iptable_nat" >&2 |
| 703 | + echo " To persist across reboots:" >&2 |
| 704 | + echo " echo iptable_nat | sudo tee /etc/modules-load.d/openshell-flannel.conf" >&2 |
| 705 | + fi |
684 | 706 | fi |
685 | 707 |
|
686 | 708 | # Execute k3s with explicit resolv-conf passed as a kubelet arg. |
|
0 commit comments