ingress-nginx
ingress-nginx copied to clipboard
Allow tuning leader-election parameters or turn off it
In a single node k8s setup, there is no need to enable leader-election inside the ingress-controller. The issue with constant leader election lease renewal is that it adds unwanted writes to etcd. In return, those writes can reduce disk life-span on small and cheap edge device.
By analyzes etcd PUT operation, I noticed the following PUT within 8 minutes span.
635 PUT
634 --
73 /registry/configmaps/ingress-nginx/ingress-controller-leader
Specially, I would like to tune those parameters via command-line tool. https://github.com/kubernetes/ingress-nginx/blob/c85765a015ea6709d161eccd42ef6134981c04b4/internal/ingress/controller/status.go#L117-L124
Or simply turn it off via a command line flag.
Thanks,
@fanminshi: This issue is currently awaiting triage.
If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members by writing /triage accepted in a comment.
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.
thanks for your report.
I have opened a PR to use LeaseLock for election. https://github.com/kubernetes/ingress-nginx/pull/8921 It will not use configmap anymore.
@tao12345666333 thanks for the PR. However, the new PR will redirect writes to /registry/leases/ingress-nginx/ingress-controller-leader instead. That will not solved my problem. It will be nice to makettl := 30 * time.Second configurable over the a flag. I can put up a PR if needed.
Hahaha, yes. Should there be no election when there is only 1 replica?
Of course, adjusting the time of ttl is also a solution
Should there be no election when there is only 1 replica?
yes, that should be the expected behavior.
I think we should add a feature flag such as leader-elect=false to turn it off. kube-scheduler has the following flag.
--leader-elect Default: true
--
| Start a leader election client and gain leadership before executing the main loop. Enable this when running replicated components for high availability.
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale - Mark this issue or PR as rotten with
/lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
@ensonic @fanminshi do you mind opening a PR for it?
Thanks!
/help /good-first-issue
@rikatz: This request has been marked as suitable for new contributors.
Guidelines
Please ensure that the issue body includes answers to the following questions:
- Why are we solving this issue?
- To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
- Does this issue have zero to low barrier of entry?
- How can the assignee reach out to you for help?
For more details on the requirements of such an issue, please see here and ensure that they are met.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.
In response to this:
/help /good-first-issue
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.