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

Disable leader-election #8919

Closed
fanminshi opened this issue Aug 10, 2022 · 12 comments · Fixed by #11064
Closed

Disable leader-election #8919

fanminshi opened this issue Aug 10, 2022 · 12 comments · Fixed by #11064
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@fanminshi
Copy link

fanminshi commented Aug 10, 2022

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.

ttl := 30 * time.Second
elector, err := leaderelection.NewLeaderElector(leaderelection.LeaderElectionConfig{
Lock: &lock,
LeaseDuration: ttl,
RenewDeadline: ttl / 2,
RetryPeriod: ttl / 4,

Or simply turn it off via a command line flag.

Thanks,

@fanminshi fanminshi added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 10, 2022
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Aug 10, 2022
@k8s-ci-robot
Copy link
Contributor

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

@tao12345666333
Copy link
Member

thanks for your report.

I have opened a PR to use LeaseLock for election. #8921
It will not use configmap anymore.

@fanminshi
Copy link
Author

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

@tao12345666333
Copy link
Member

Hahaha, yes.
Should there be no election when there is only 1 replica?

@tao12345666333
Copy link
Member

Of course, adjusting the time of ttl is also a solution

@fanminshi
Copy link
Author

Should there be no election when there is only 1 replica?
yes, that should be the expected behavior.

@fanminshi
Copy link
Author

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/

@fanminshi fanminshi changed the title Allow tuning leader-election parameters or turn off it Disable leader-election Aug 12, 2022
@k8s-triage-robot
Copy link

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 10, 2022
@ensonic
Copy link
Contributor

ensonic commented Nov 10, 2022

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 10, 2022
@rikatz
Copy link
Contributor

rikatz commented Feb 28, 2024

@ensonic @fanminshi do you mind opening a PR for it?

Thanks!

@rikatz
Copy link
Contributor

rikatz commented Feb 28, 2024

/help
/good-first-issue

@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants