Hello,
before I switched to K8S, I was using Rancher 1.x as my private coud platform. They had a very simple leader detection algorith. I'd like to discuss if that would also work for K8S, so that we could maybe simplify the election code a lot (and removing the requirement to have write access to the cluster API).
The algorithm is just:
get a list of running instances
the instance with the lowest serial number is the leader
This works because these serial numbers are always ascending, so if the leader instance terminates, the next instance becomes the leader.
On K8S we could use the resourceVersion which also seems to be strictly ascending. That means after querying a service endpoint, we could directly decide who the leader is.
Hello, before I switched to K8S, I was using Rancher 1.x as my private coud platform. They had a very simple leader detection algorith. I'd like to discuss if that would also work for K8S, so that we could maybe simplify the election code a lot (and removing the requirement to have write access to the cluster API).
The algorithm is just:
This works because these serial numbers are always ascending, so if the leader instance terminates, the next instance becomes the leader.
On K8S we could use the resourceVersion which also seems to be strictly ascending. That means after querying a service endpoint, we could directly decide who the leader is.
What do you think about this?