Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid printing some service comments in iptables rules #65755

Merged
merged 1 commit into from
Jul 8, 2018

Conversation

wojtek-t
Copy link
Member

@wojtek-t wojtek-t commented Jul 3, 2018

According to some profiles, with large number of endpoints in the system, comments mentioning the service in appropriate iptables rules may be responsible for 40% of all iptables contents.

Given that ~70% of memory usage of kube-proxy seems to be because of generated iptables rules, the overall saving may be at the level of 30% or so.

OTOH, we sacrifise a bit understandability of iptables, but this PR only changes some of iptables that contribute to the most painful rules.

@thockin @danwinship @dcbw - thoughts?

Ref #65441

@wojtek-t wojtek-t added sig/network Categorizes an issue or PR as relevant to SIG Network. sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. labels Jul 3, 2018
@k8s-ci-robot
Copy link
Contributor

@wojtek-t: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 3, 2018
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 3, 2018
@wojtek-t wojtek-t added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 3, 2018
@thockin
Copy link
Member

thockin commented Jul 3, 2018

aww, I use this all the time.

I guess it seems like a reasonable tradeoff... We probably should add the flag.

@wojtek-t
Copy link
Member Author

wojtek-t commented Jul 4, 2018

aww, I use this all the time.
I guess it seems like a reasonable tradeoff... We probably should add the flag.

Another option that I just came up with is to make it depend on the size of iptables. If they are small, we don't really care. And we can just avoid adding those comments in very large iptables.
Let me do that.

@wojtek-t
Copy link
Member Author

wojtek-t commented Jul 4, 2018

@thockin - changed. PTAL if that is acceptable for you.

@wojtek-t
Copy link
Member Author

wojtek-t commented Jul 4, 2018

/test pull-kubernetes-e2e-kops-aws

@wojtek-t
Copy link
Member Author

wojtek-t commented Jul 4, 2018

/retest

@dcbw
Copy link
Member

dcbw commented Jul 6, 2018

Just a bit worried about debugability here; when the number of rules is > 1000, how would I match up a given rule with a specific service?

@thockin
Copy link
Member

thockin commented Jul 6, 2018

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 6, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: thockin, wojtek-t

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

@wojtek-t
Copy link
Member Author

wojtek-t commented Jul 7, 2018

Just a bit worried about debugability here; when the number of rules is > 1000, how would I match up a given rule with a specific service?

With big enough iptables (maybe we should tune this number), I'm not sure they are super debuggable anyway... In the worst case, it's possible to connect pods with services and their ips and probably add those comments offline. Maybe a script for that is what we should also add?

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 65882, 65896, 65755, 60549, 65927). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 28e78ec into kubernetes:master Jul 8, 2018
@wojtek-t wojtek-t deleted the optimize_kube_proxy branch July 5, 2019 06:04
odinuge added a commit to odinuge/kubernetes that referenced this pull request Dec 18, 2019
This will make "appendServiceCommentLocked" do what it looks like it
does. The current implementation is just plain dead code, as the
append func does not edit in place.

As discussed in the original PR, we could create a new flag to allow the
user to enable the comments when needed. This will increase the size of
the iptables rules, but not the way they work.

Original PR:
kubernetes#65755
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. 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. release-note-none Denotes a PR that doesn't merit a release note. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants