Support custom address broadcasting for ringpop to work in k8s #6288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed?
Current ringpop initialization is making it difficult to run ringpop in K8s like environments. Ringpop is initialized with the address that the service instance (container) is going to listen on and it gets advertised to peers. This is problematic because listen address of replicas are not unique and cannot be used to communicate peer to peer.
Local listen address (BIND_ON_IP) should be set to 0.0.0.0 and the pod's ip address (10.x.y.z) should be used to join the ring for p2p. Pod's IP address is accessible by other pods in the k8s cluster.
This PR introduces
ringpop.broadcastAddress
config which will make ringpop work in k8s environments.For example:
History-service-container-replica-1:
listens and serves on
0.0.0.0:7934
broadcasts itself to peers as
10.66.1.71
(its own pod ip)History-service-container-replica-2:
listens and serves on
0.0.0.0:7934
broadcasts itself to peers as
10.66.1.75
(its own pod ip)A headless k8s service can be used for discovery which will return list of pod ips
10.x.y.z
.This can be achieved on K8s by passing pod's IP address as an env variable.
Ringpop config would look like this:
Other misc changes:
How did you test it?