kubernetes-sigs / controller-runtime

Repo for the controller-runtime subproject of kubebuilder (sig-apimachinery)
Apache License 2.0
2.38k stars 1.11k forks source link

[issue] regarding horizontal scaling for operators #2836

Open ragarwalll opened 1 month ago

ragarwalll commented 1 month ago

when we deploy any operator, lets say I have scaled upto 2 replicas. The watcher will basically watch the specified path/resources in both the replicas right?

If yes, this in turn means that it might happen that both "reconciles" would be called in both pod, right? So, my question here is how do I manage efficiency for operators. In recent weeks, one of the operators I build is taking heavy traffic and I am looking for addressing this issue is the right way.

Can you please suggest how do I approach this issue in the best possible way?

troy0820 commented 3 weeks ago

You can use leader election which can prevent this.