Skip to content

Conversation

afbjorklund
Copy link
Contributor

@afbjorklund afbjorklund commented Sep 29, 2025

Error when running with kernel from Kata Containers:

    can't initialize ip6tables table `filter':
    Table does not exist (do you need to insmod?)
    Perhaps ip6tables or your kernel needs to be upgraded.

This happens also in Apple Containers. Fallback to ipv4 only.
The alternative is building a custom kernel, with full support.

This fixes the kind create cluster error that was encountered in:


Assuming that user has redirected from nft to legacy, that is.

update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

Got some other error, when trying to create with default iptables.

# docker network create -d=bridge -o com.docker.network.bridge.enable_ip_masquerade=true -o com.docker.network.driver.mtu=1500 kind
Error response from daemon: Failed to Setup IP tables: Unable to enable NAT rule:  (iptables failed: iptables --wait -t nat -I POSTROUTING -s 172.18.0.0/16 ! -o br-b505b0155599 -j MASQUERADE: Warning: Extension MASQUERADE revision 0 not supported, missing kernel module?
iptables v1.8.10 (nf_tables): Could not fetch rule set generation id: Invalid argument
 (exit status 4))
  • Container 0.4.1
  • Linux 6.12.28

https://github.com/apple/container/blob/main/docs/tutorial.md

https://github.com/kata-containers/kata-containers/releases/tag/3.17.0

  • Ubuntu 24.04.3 LTS
  • Docker 28.4.0 CE

Here is the regular Ubuntu kernel, for reference:

CONFIG_IP_NF_IPTABLES=m
CONFIG_IP6_NF_IPTABLES=m

CONFIG_NF_NAT_MASQUERADE=y
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP6_NF_TARGET_MASQUERADE=m

And here is the Kata Containers kernel, no IPv6:

# zgrep IPTABLES /proc/config.gz
CONFIG_IP_NF_IPTABLES_LEGACY=y
CONFIG_IP_NF_IPTABLES=y
# CONFIG_IP6_NF_IPTABLES is not set

# zgrep MASQUERADE /proc/config.gz
CONFIG_NF_NAT_MASQUERADE=y
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_MASQUERADE=y

Error when running with kernel from Kata Containers:
    can't initialize ip6tables table `filter':
    Table does not exist (do you need to insmod?)
    Perhaps ip6tables or your kernel needs to be upgraded.

This happens also in Apple Containers. Fallback to ipv4 only.
The alternative is building a custom kernel, with full support.
@k8s-ci-robot k8s-ci-robot requested a review from aojea September 29, 2025 16:40
@k8s-ci-robot k8s-ci-robot added the area/provider/docker Issues or PRs related to docker label Sep 29, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 29, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @afbjorklund. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 29, 2025
@BenTheElder
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 29, 2025
@BenTheElder
Copy link
Member

Thanks for the PR!

The alternative is building a custom kernel, with full support.

You can disable ipv6 in the docker daemon settings? I think that's the best fix, though kind should gracefully handle this, I do worry the error messages will keep shifting but ... 🤷‍♂️

@afbjorklund
Copy link
Contributor Author

afbjorklund commented Sep 29, 2025

You can disable ipv6 in the docker daemon settings?

I tried disabling in daemon.json, but it doesn't change.

{
    "ipv6": false
}

There seems to be some open Docker tickets, about this.

"I think there's a misunderstanding here due to misleading docs: the daemon's ipv6 flag doesn't disable ipv6 daemon-wide, but it only controls the availability of IPv6 on the default bridge network."

So I disabled it system-wide, with sysctl (procps).

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1

But still got that error, when creating the "kind" network.

@aojea
Copy link
Contributor

aojea commented Sep 29, 2025

it seems the daemon has an option to disable the ip6tables

https://docs.docker.com/engine/daemon/ipv6/#docker-in-docker

Alternatively, use daemon option --ip6tables=false to disable ip6tables for the containerized Docker Engine

@BenTheElder
Copy link
Member

Interesting, thanks.

// TODO: this is fragile, and only necessary due to docker enabling ipv6 by default
// even on hosts that lack ip6tables setup.
// Preferably users would either have ip6tables setup properly or else disable ipv6 in docker
const dockerIPV6TablesError = "Error response from daemon: Failed to Setup IP tables: Unable to enable NAT rule: (iptables failed: ip6tables"
Copy link
Member

Choose a reason for hiding this comment

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

We should maybe rename and clarify this one versus the new error. That shouldn't block fixing the bug though

Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 29, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 29, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: afbjorklund, BenTheElder

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 29, 2025
@BenTheElder
Copy link
Member

/hold cancel
IMO we can iterate on nits, let's land the bug fix

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 3, 2025
@k8s-ci-robot k8s-ci-robot merged commit 81b000c into kubernetes-sigs:main Oct 3, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/docker Issues or PRs related to docker cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants