Repository navigation
Closed
Labels
area/kube-proxykind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.sig/networkCategorizes an issue or PR as relevant to SIG Network.Categorizes an issue or PR as relevant to SIG Network.
Description
What happened:
Can only scale up to ~500 services on a nftables based cluster (CentOS 8+, Debian 10+) with kube-proxy.
With 1000 services, around half fails to work.
What you expected to happen:
Tested with same cluster deployment, but on Ubuntu 18.04 (that uses legacy iptables) and managed to reach 2500 services.
How to reproduce it (as minimally and precisely as possible):
- create a 100 node cluster on OS with nftables enabled (CentOS 8, Debian 10)
- create simple http deployment (nginx) with 200 replicas
- create Load Balancer services (below example): I have used 100 VIPs and 10 Ports/svc
- wait for the cluster to "stabilize"
- try curl to every svcIP:Port
apiVersion: v1
kind: Service
metadata:
name: scale-service-{{.Num}}
spec:
ports:
{{range .Ports}}
- port: {{.}}
protocol: TCP
targetPort: 8080
name: sv{{.}}
{{- end}}
selector:
app: scale-service
sessionAffinity: None
type: LoadBalancer
loadBalancerIP: {{.IP}}
Anything else we need to know?:
The iptables-save rules count on nftables reached ~400k lines when some services were unreachable.
For the non-nftables case I was able to see >1m rules.
Environment:
- Kubernetes version (use
kubectl version): 1.18.6 - Cloud provider or hardware configuration: Deployed on VMs with 4vCPU, 16G mem, 50G disk,
- OS (e.g:
cat /etc/os-release): CentOS 8.1 - Kernel (e.g.
uname -a): 4.18 - Install tools: kubeadm
- Network plugin and version (if this is a network-related bug): Cilium 1.8 with kube-proxy present, using metalLB
- Others:
Metadata
Metadata
Labels
area/kube-proxykind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.sig/networkCategorizes an issue or PR as relevant to SIG Network.Categorizes an issue or PR as relevant to SIG Network.
Activity
k8s-ci-robot commentedon Oct 29, 2020
@mskrocki: This issue is currently awaiting triage.
If a SIG or subproject determines this is a relevant issue, they will accept it by applying the
triage/acceptedlabel and provide further guidance.The
triage/acceptedlabel can be added by org members by writing/triage acceptedin a comment.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/test-infra repository.
mskrocki commentedon Oct 29, 2020
/sig network
bridgetkromhout commentedon Oct 29, 2020
Discussion of newer OS version. (At least 1.8.4 of iptables)
/assign @dcbw
mskrocki commentedon Nov 4, 2020
I see same results (only ~500 services) on:
bowei commentedon Nov 6, 2020
/assign
dcbw commentedon Nov 12, 2020
@mskrocki what specific RPM version of iptables? I would recommend iptables-1.8.4-10.el8_2.2
dcbw commentedon Nov 12, 2020
And if you have a relatively recent iptables, when you have 1000 services, could you grab iptables-save dump and attach?
mskrocki commentedon Nov 13, 2020
I have been using 1.8.4-10.el8_2.1, any guide on how I can get the 2.2 version?
I will try the test again and provide the dump later.
12 remaining items
dcbw commentedon Feb 19, 2021
So... this iptables save is 695992 lines. Which is extremely large. In the past, with just iptables (eg not iptables-nft), I've seen performance issues with iptables-restore with just 100,000 or 150,000 lines. We typically recommend setting min-sync-period to some large number of seconds (30? 60?) in cases like that.
Are you able to find out how much time iptables-restore (nft) takes to restore this 700,000 line dump?
mskrocki commentedon Feb 19, 2021
Run directly on the host:
dcbw commentedon Mar 4, 2021
@mskrocki would you be able to provide that iptables-restore ruleset for further analysis?
dcbw commentedon Mar 18, 2021
@mskrocki ping? If we can get a ruleset from iptables-restore we can figure out where the hotspots are.
mskrocki commentedon Mar 18, 2021
I dont have that one exactly. What about the one I linked above, I dont think it will be any different.
n0-1 commentedon Mar 24, 2021
Hi,
I can reproduce the failure with upstream iptables.
As for run-time, iptables-legacy restores the attached dump in 6.5min on my testing VM, iptables-nft fails after 16min. :(
Maybe the ruleset is simply too big, but of course if legacy iptables eats it iptables-nft shall do as well.
Still investigating, just a quick status update.
Cheers, Phil
dougsland commentedon Mar 26, 2021
/area kube-proxy
dcbw commentedon Apr 6, 2021
Phil and Pablo have posted patches to improve iptables-nft performance to iptables-legacy levels based on the ruleset from this issue:
https://marc.info/?l=netfilter-devel&m=161730110620551&w=2
https://marc.info/?l=netfilter-devel&m=161730896024892&w=2
n0-1 commentedon Apr 6, 2021
A fix to allow for large rulesets currently under review: https://marc.info/?l=netfilter-devel&m=161769909013299&w=2
Performance improvement applied meanwhile: https://marc.info/?l=netfilter-devel&m=161676942405027&w=2
dcbw commentedon Apr 15, 2021
While I think it was good to keep this bug open to debug/track the problem, I think we can close it now since the fixes are in nftables/iptables and are under review or already merged.
/close
k8s-ci-robot commentedon Apr 15, 2021
@dcbw: Closing this issue.
Details
In response to this:
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.
liuyuan10 commentedon Jul 20, 2022
@n0-1 @dcbw Thanks for fixing it. could you provide the version of iptables that has all the fix we talked about here?
n0-1 commentedon Jul 23, 2022
@liuyuan10 iptables v1.8.8 has all you need.