The node-prep script hardcodes /usr/sbin/iptables-nft for the two TCP MSS
clamping rules, but the default node image runs a kernel with no nftables
support, so those calls always fail:
$ ls /proc/net/nf_tables*
ls: cannot access '/proc/net/nf_tables*': No such file or directory
$ /usr/sbin/iptables-nft -t mangle -S
iptables v1.8.11 (nf_tables): Could not fetch rule set generation id: Invalid argument
/usr/sbin/iptables resolves through alternatives to the backend the image is
actually set up for -- legacy in kindest/node -- and the same two rules apply
cleanly through it. On an image whose kernel does carry nftables, alternatives
selects nft, so naming iptables is strictly more portable than naming a
specific backend.
Because nodePrepScript runs under set -e and these are its last two lines, the
failure aborts node prep and surfaces the accumulated stdout of the commands
that already succeeded, which is why the reported error names a sysctl that
worked rather than the command that failed.
Fixes apple#2120
Fixes #2120
Summary
Use the node image's configured
iptablesalternative for the two TCP MSS clamping rules instead of hard-codingiptables-nft.The original failure is specific to installations that still boot a kernel without nftables support. Container upgrades can retain an existing pre-1.0 guest kernel because
container system startdoes not replace a kernel that is already installed. On the retainedvmlinux-6.12.28-153kernel, node preparation aborts when the hard-codediptables-nftcommands fail.The current recommended Kata 3.32.0 kernel (
vmlinux-6.18.35-197-debug) hasCONFIG_NF_TABLES=y; with that kernel, the existingiptables-nftcommands work and an unmodified Container 1.4.1 completescontainer k8s create. This corrects the earlier interpretation that the failure was a Container 1.3.1 regression.Why this change is still useful
kindest/nodeselects an iptables backend during its entrypoint and updates/etc/alternatives/iptablesbefore node preparation runs. On the retained kernel, it selectsiptables-legacy, which works. Calling/usr/sbin/iptablesrespects that node-image decision and lets node preparation work with retained or deliberately selected kernels rather than assuming nftables is available.Appending
|| truewould also prevent the abort, but it would silently omit the MSS clamping rules. This change keeps the rules and only removes the backend assumption.The separate upgrade-path improvement discussed in #2120 would be to detect an outdated Container-managed default kernel and notify or prompt the user without silently replacing a deliberately selected custom kernel.
Evidence
On Container 1.4.1 with the retained
vmlinux-6.12.28-153kernel:Both TCPMSS rules apply successfully through
/usr/sbin/iptables.After installing the recommended kernel:
kindest/node:v1.35.5reportsCONFIG_NF_TABLES=y,iptables-nft -t mangle -Ssucceeds, and an unmodifiedcontainer k8s create --cpus 2 --memory 4gcompletes successfully.Verification
swift build --product containerswift build --target k8scontainer k8s createwas reproduced failing on the retained kernel and succeeding after switching to the recommended kernel.Environment: macOS 27.0, Apple silicon, Container 1.4.1, node image
docker.io/kindest/node:v1.35.5.