Open d-kuro opened 4 years ago
Some considerations about this request:
The coordination.k8s.io/LeaseLock
resource kind has only been around only since Kubernetes v1.13, which means K8s v1.13 will become a minimum requirement for Argo CD.
Running multiple controllers will cause the application controller's prometheus metric endpoint to become inconsistent depending on which instance was hit during scraping. If we allow multiple controllers to run, then the metrics will likely need to be sent and cached to redis instead of in-memory like they are currently.
Supporting leader election allows multiple controllers to work at the same time
+1
+1
which means K8s v1.13 will become a minimum requirement for Argo CD
I think we should be fine with that by now :)
+1
Hi. I believe this would be nice. There's a significant issue currently in maintaining a HA application set controller
I see that the 3.0.0 advertises LEADER_ELECTION_IDENTITY environment variable. I'll look into this and see if this is a solution. If this is the case, perhaps we can close this
@d-kuro the applicationset controller does support leader election. Are we able to close this issue?
Summary
argocd-application-controller supports leader election.
Motivation
Running multiple Kubernetes Controllers causes a conflict. Supporting leader election allows multiple controllers to work at the same time, which indicates that the controller will be highly available. You can also use a rolling update for the controller's deployment strategy.
Actually controller-manager, scheduler, cluster-autoscaler, etc. support leader election.
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/ https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/ https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca
Proposal
Add the following to the options of arogcd-applicaton-controller.
leader-elect
leader-elect-lease-duration
leader-elect-renew-deadline
leader-elect-retry-period
leader-elect-resource-lock
All seconds are default values. https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/tools/leaderelection/leaderelection.go#L111
Also, change the number of replicas for the argocd-application-controller in the install manifest of HA configuration to 2. and change the Deployment strategy to a rolling update.
See below for a code sample of leader election. https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/client-go/examples/leader-election
I can create a Pull Request for this enhancement issue.