We are using the below Envoy load balancing YAML file. It is working but it is NOT randomly distributing requests across nodes 1, 2, and 3. In our use case, we have high load coming from a single source IP address (customer server). We want to distribute the traffic across the nodes like so:
Request 1 -> Node 1
Request 2 -> Node 2
Request 3 -> Node 3
Request 4 -> Node 1
However, this is what is happening:
Request 1 -> Node 1
Request 2 -> Node 1
Request 3 -> Node 1
Request 4 -> Node 1
After a LONG time (minutes), it will eventually start sending some traffic to Node 2, but then only to node 2. Again, note that all requests are coming from one client IP.
We are using Random below but also round robin does the same thing. So our question is: how to fix this? This feels like a huge bug as it is basically not actually load balancing. Any guidance would be appreciated. We are using the latest version of Envoy.
static_resources:
listeners:
- name: listener_http
address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.filters.network.tcp_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: destination
cluster: http_cluster
- name: listener_https
address:
socket_address:
address: 0.0.0.0
port_value: 443
filter_chains:
- filters:
- name: envoy.filters.network.tcp_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: destination2
cluster: https_cluster
clusters:
- name: http_cluster
connect_timeout: 30s
type: strict_dns
dns_lookup_family: V4_ONLY
lb_policy: random
load_assignment:
cluster_name: http_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: node1.mydomain.com
port_value: 80
- endpoint:
address:
socket_address:
address: node2.mydomain.com
port_value: 80
- endpoint:
address:
socket_address:
address: node3.mydomain.com
port_value: 80
- name: https_cluster
connect_timeout: 30s
type: strict_dns
dns_lookup_family: V4_ONLY
lb_policy: random
load_assignment:
cluster_name: https_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: node1.mydomain.com
port_value: 443
- endpoint:
address:
socket_address:
address: node2.mydomain.com
port_value: 443
- endpoint:
address:
socket_address:
address: node3.mydomain.com
port_value: 443