How to setup Envoy as a load balancer with Nexus 3

Hello all,

I’m trying to setup Envoy proxy with a Nexus 3 cluster but so far no luck. Nexus 3 offers some hints how to achieve this (not specific to any load balancer).

Has anybody got this done? Please share your experience, it doesn’t have to be with Envoy but can be with Nginx, etc.


Like this one?


I got it to work with HA proxy. Below is the configuration that worked for me, sharing it here so others can benefit as well:

# Author: Jose Vicente Nunez

    log local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/
    maxconn     4000
    user        haproxy
    group       haproxy

    stats socket /var/lib/haproxy/stats

    ssl-default-bind-ciphers PROFILE=SYSTEM
    ssl-default-server-ciphers PROFILE=SYSTEM

    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

frontend stats
    bind *:6666
    stats enable
    stats uri /stats
    stats refresh 10s
    stats admin if LOCALHOST

frontend main
    bind *:5000
    default_backend     registry
    option              forwardfor

backend registry
    mode http
    balance leastconn
    stick-table type string len 200 size 1m expire 30m
    stick on cookie(NXSESSIONID)

    option httpchk HEAD /web1 HTTP/1.0
    http-check expect ! rstatus ^5
    server  registry1 AAA.BBB.XXX.XX:5000 check cookie check
    server  registry2 AAA.BBB.YYY.YY:5000 check cookie check
    server  registry3 AAA.BBB.ZZZ.ZZ:5000 check cookie check

    option log-health-checks

    option redispatch
    timeout connect 1s
    timeout queue 5s
    timeout server 3600s

And my systemd unit, as icing on the cake :slight_smile:

# /usr/lib/systemd/system/haproxy.service
Description=HAProxy Load Balancer

Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/"
ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q
ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE
ExecReload=/usr/sbin/haproxy -f $CONFIG -c -q
ExecReload=/bin/kill -USR2 $MAINPID