You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
Nodes with identical hostnames using the default cluster_listen ipv4:port fail to join a cluster because serf expects node names to be unique, and the code for get_node_name does not generate unique names in these conditions:
Why this is a problem:
I use docker to spin up multiple instances of kong containers that live behind a load balancer. Those instances are brought up as members of the same pool and, as such, are given the same hostname; /etc/hosts on each instance is configured to resolve that hostname to localhost. ipv4 addresses are not assigned to these instances until runtime, so I wish to use kong's default cluster_listen ip:port (0.0.0.0:7946). Unfortunately, in this case get_node_name will return the same name for each node in my cluster, resulting in all but one node failing to join the cluster.
At the moment, my container grabs the node's local ipv4 address at runtime and appends it to kong.yml file for cluster_listen before starting up kong. But it would be nice to have this working out of the box.
Version/Platform:
I am running Kong version 0.8.1 in Docker.
Suggested fix:
Just as the first local non-loopback address is used to advertise a node's presence to other nodes when the cluster_listen ipv4 address is 0.0.0.0, first local non-loopback address could be used to calculate the node's name. There is no reason two nodes in the same cluster should have the same non-loopback ipv4 address, so this would be unique.
The text was updated successfully, but these errors were encountered:
Summary:
Nodes with identical hostnames using the default
cluster_listen
ipv4:port fail to join a cluster because serf expects node names to be unique, and the code forget_node_name
does not generate unique names in these conditions:https://github.com/Mashape/kong/blob/997561b42c27d5917f261065d9b1f5e99079e337/kong/tools/cluster.lua#L6
Why this is a problem:
I use docker to spin up multiple instances of kong containers that live behind a load balancer. Those instances are brought up as members of the same pool and, as such, are given the same hostname; /etc/hosts on each instance is configured to resolve that hostname to localhost. ipv4 addresses are not assigned to these instances until runtime, so I wish to use kong's default
cluster_listen
ip:port (0.0.0.0:7946). Unfortunately, in this caseget_node_name
will return the same name for each node in my cluster, resulting in all but one node failing to join the cluster.At the moment, my container grabs the node's local ipv4 address at runtime and appends it to kong.yml file for
cluster_listen
before starting up kong. But it would be nice to have this working out of the box.Version/Platform:
I am running Kong version 0.8.1 in Docker.
Suggested fix:
Just as the first local non-loopback address is used to advertise a node's presence to other nodes when the
cluster_listen
ipv4 address is 0.0.0.0, first local non-loopback address could be used to calculate the node's name. There is no reason two nodes in the same cluster should have the same non-loopback ipv4 address, so this would be unique.The text was updated successfully, but these errors were encountered: