Skip to content

kernel: enable ipset hash:netport set type#793

Open
kvinwang wants to merge 1 commit into
masterfrom
kernel-ipset-netport
Open

kernel: enable ipset hash:netport set type#793
kvinwang wants to merge 1 commit into
masterfrom
kernel-ipset-netport

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

Summary

Fixes #792 — k3s/kube-router NetworkPolicy enforcement silently disabled due to missing ipset support.

Most of the netfilter ipset support requested in the issue is already enabled: CONFIG_IP_SET, CONFIG_NETFILTER_XT_SET and the hash:ip/hash:net/hash:ip,port/bitmap set types are all built as modules in dstack-docker.cfg, and the corresponding kernel-module-* packages (including xt-set) are installed into the rootfs image.

The only missing piece was the hash:net,port set type, which kube-router also creates at startup — a single missing set type is enough to make ipset save fail with Kernel error received: Invalid argument, after which kube-router skips NetworkPolicy enforcement entirely.

Changes

  • dstack-docker.cfg: add CONFIG_IP_SET_HASH_NETPORT=m
  • dstack-rootfs-base.inc: install kernel-module-ip-set-hash-netport into the rootfs

Note: built as a module (=m) rather than built-in (=y) as suggested in the issue, matching the existing ipset config style — modules listed in IMAGE_INSTALL ship in the image and are auto-loaded by the kernel on demand, so no module-loading tooling is needed in the guest.

kube-router NetworkPolicy enforcement in k3s requires the netfilter
ipset set types it creates at startup. The kernel config already
enables ipset core, xt_set and most hash/bitmap set types as modules
installed into the rootfs, but hash:netport was missing, causing
`ipset save` to fail and kube-router to silently skip policy
enforcement.

Enable CONFIG_IP_SET_HASH_NETPORT=m and install the module into the
rootfs image.

Closes #792

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables the missing Linux ipset set type needed by k3s/kube-router so Kubernetes NetworkPolicy enforcement doesn’t get silently disabled on dstack guest images.

Changes:

  • Enable CONFIG_IP_SET_HASH_NETPORT as a kernel module to support hash:net,port ipset sets.
  • Install the corresponding kernel-module-ip-set-hash-netport package into the base rootfs image so it’s available at runtime.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
os/yocto/layers/meta-dstack/recipes-kernel/linux/files/dstack-docker.cfg Adds CONFIG_IP_SET_HASH_NETPORT=m alongside existing ipset module config.
os/yocto/layers/meta-dstack/recipes-core/images/dstack-rootfs-base.inc Ships kernel-module-ip-set-hash-netport in the rootfs, matching other ipset module packaging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kernel: enable netfilter ipset (CONFIG_IP_SET + xt_set) — k3s NetworkPolicy enforcement is silently disabled without it

2 participants