Skip to content

fix: install ipvsadm for kube-vip load balancing with nftables proxy#13325

Open
isumitsolanki wants to merge 1 commit into
kubernetes-sigs:masterfrom
isumitsolanki:issue-13321
Open

fix: install ipvsadm for kube-vip load balancing with nftables proxy#13325
isumitsolanki wants to merge 1 commit into
kubernetes-sigs:masterfrom
isumitsolanki:issue-13321

Conversation

@isumitsolanki

Copy link
Copy Markdown
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:

ipvsadm and IPVS kernel modules were only installed when kube_proxy_mode was ipvs. When using kube_proxy_mode: nftables with kube-vip control plane load balancing enabled, ipvsadm was not installed even though kube-vip uses IPVS for local forwarding on control plane nodes.

This PR introduces a shared ipvs_required variable and uses it consistently for:

  • ipvsadm package installation (system_packages)
  • IPVS kernel module loading (kubernetes/node)
  • IPVS table cleanup during reset (reset)

ipvs_required is true when:

  • kube-proxy uses IPVS (kube_proxy_mode: ipvs and kube_proxy_remove: false), or
  • kube-vip control plane load balancing is enabled (kube_vip_enabled and kube_vip_lb_enable) with a non-masquerade forwarding method (kube_vip_lb_fwdmethod != masquerade)

kube_vip_lb_enable is also added to kubespray_defaults so it is available during bootstrap when system_packages runs.

Which issue(s) this PR fixes:

Fixes #13321

Special notes for your reviewer:

Per triage on the issue, IPVS packages are gated on kube_vip_lb_enable, not just kube_vip_enabled. Users need both kube_vip_enabled: true and kube_vip_lb_enable: true for ipvsadm to be installed when kube_proxy_mode is nftables. With kube_vip_lb_fwdmethod: masquerade, ipvsadm is intentionally not installed since that mode uses iptables.

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Sumit Solanki <sumit.solanki@ibm.com>
@kubernetes-prow kubernetes-prow Bot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. labels Jun 24, 2026
@kubernetes-prow kubernetes-prow Bot requested review from guoard and yankay June 24, 2026 06:26
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: isumitsolanki
Once this PR has been reviewed and has the lgtm label, please assign mzaian for approval. For more information see the Code Review Process.

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

Details 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

@kubernetes-prow kubernetes-prow Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 24, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @isumitsolanki. 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.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

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.

Details

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.

@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 24, 2026
@yankay

yankay commented Jun 24, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@yankay yankay requested a review from Copilot June 24, 2026 11:27
@kubernetes-prow kubernetes-prow Bot 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 Jun 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes missing IPVS tooling setup when using kube-vip control plane load balancing together with kube_proxy_mode: nftables, by introducing a shared ipvs_required toggle and using it across package install, kernel module loading, and reset cleanup paths.

Changes:

  • Add ipvs_required to central defaults and use it to gate IPVS-related behavior.
  • Install ipvsadm based on ipvs_required instead of only kube_proxy_mode: ipvs.
  • Use ipvs_required to control IPVS module loading and IPVS table cleanup during reset.

Reviewed changes

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

File Description
roles/system_packages/vars/main.yml Gates ipvsadm installation on the new shared ipvs_required variable.
roles/reset/tasks/main.yml Gates IPVS table cleanup during reset on ipvs_required.
roles/kubespray_defaults/defaults/main/main.yml Introduces ipvs_required logic and adds a default for kube_vip_lb_enable.
roles/kubernetes/node/tasks/main.yml Gates IPVS-related kernel module loading on ipvs_required.

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

Comment on lines +40 to +41
# Install IPVS packages/modules when kube-proxy uses IPVS or kube-vip control plane load balancing uses IPVS (local forwarding).
ipvs_required: "{{ (kube_proxy_mode == 'ipvs' and not kube_proxy_remove) or (kube_vip_enabled | bool and kube_vip_lb_enable | bool and kube_vip_lb_fwdmethod != 'masquerade') }}"
Comment on lines 102 to 105
# kube-vip
kube_vip_enabled: false
kube_vip_lb_enable: false
kube_vip_lb_fwdmethod: local
@tico88612

Copy link
Copy Markdown
Member

Do we really need to add ipvs_required var? What's the reason for making this change?

@tico88612

Copy link
Copy Markdown
Member

BTW this should not release-note-none, please write the release note.

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

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ipvsadm is not installed if I use kube-vip and kube_proxy_mode=nftables.

4 participants