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

[WIP] Skip resize of nf_conntrack/parameters/hashsize if not necessary #44919

Conversation

robertgzr
Copy link
Contributor

What this PR does / why we need it:
Linux does not support writing to /sys/module/nf_conntrack/parameters/hashsize when the writer process is not in the initial network namespace
(https://github.com/torvalds/linux/blob/v4.10/net/netfilter/nf_conntrack_core.c#L1795-L1796).

Usually that's fine. But in some configurations such as with https://github.com/kinvolk/kubeadm-nspawn, kube-proxy is in another netns.

Therefore, check if writing in hashsize is necessary and skip the writing if not.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Release note:

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Apr 25, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @robertgzr. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot 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.

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 25, 2017
@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Apr 25, 2017
@robertgzr
Copy link
Contributor Author

/cc @alban @nhlfr

@robertgzr robertgzr changed the title Skip resize of nf_conntrack/parameters/hashsize if not necessary [WIP] Skip resize of nf_conntrack/parameters/hashsize if not necessary Apr 25, 2017
@robertgzr robertgzr force-pushed the robertgzr/kubeproxy-check-conntrack-before-write branch from fa97388 to b397e16 Compare April 25, 2017 14:08
@mikedanese mikedanese assigned thockin and bowei and unassigned lavalamp and mikedanese Apr 27, 2017
@thockin
Copy link
Member

thockin commented Apr 28, 2017 via email

@mikedanese
Copy link
Member

From linked GitHub project, looks like this is for simulating multinode during local development.

@nhlfr
Copy link

nhlfr commented May 2, 2017

@thockin From what I know, the kube-proxy's iptables rules work well inside netns - under the condition that this netns is used for simutating a node, not for isolation of kube-proxy process from the other k8s components.

@sttts @ivan4th did you have any problems with iptables in dind? Or with anything else than nf_conntrack hashsize?

@robertgzr
Copy link
Contributor Author

@thockin what @nhlfr said ^

$ kubectl --kubeconfig ./kubeadm-nspawn-0/etc/kubernetes/admin.conf get nodes
NAME               STATUS    AGE
kubeadm-nspawn-0   Ready     4m
kubeadm-nspawn-1   Ready     4m
$ kubectl --kubeconfig ./kubeadm-nspawn-0/etc/kubernetes/admin.conf -n kube-system logs kube-proxy-jl6wq
I0503 16:20:56.862763       1 server.go:230] Using iptables Proxier.
W0503 16:20:57.009737       1 proxier.go:347] clusterCIDR not specified, unable to distinguish between internal and external traffic
I0503 16:20:57.009782       1 server.go:255] Tearing down userspace rules.
I0503 16:20:57.076621       1 conntrack.go:98] Set sysctl 'net/netfilter/nf_conntrack_max' to 131072
I0503 16:20:57.076701       1 conntrack.go:52] Setting nf_conntrack_max to 131072
I0503 16:20:57.076743       1 conntrack.go:98] Set sysctl 'net/netfilter/nf_conntrack_tcp_timeout_established' to 86400
I0503 16:20:57.076814       1 config.go:119] Starting endpoints config controller
I0503 16:20:57.076890       1 conntrack.go:98] Set sysctl 'net/netfilter/nf_conntrack_tcp_timeout_close_wait' to 3600
I0503 16:20:57.094501       1 config.go:236] Starting service config controller
I0503 16:20:57.128171       1 controller_utils.go:973] Waiting for caches to sync for service config controller
I0503 16:20:57.128243       1 controller_utils.go:973] Waiting for caches to sync for endpoints config controller
I0503 16:20:57.229268       1 controller_utils.go:980] Caches are synced for endpoints config controller
I0503 16:20:57.229648       1 controller_utils.go:980] Caches are synced for service config controller

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 3, 2017
@thockin thockin added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels May 4, 2017
@thockin
Copy link
Member

thockin commented May 4, 2017

/lgtm
/approve
@k8s-bot ok to test

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 4, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: robertgzr, thockin

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue

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. 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.

None yet

9 participants