I am testing LXD for Virtual Router Redundancy Protocol using keepalived and haproxy. To test the service, I am using webserver as the target application server.
Below is a list of the applicable IPs and nodes:
host machine: 192.168.1.117
Floating IP=192.168.1.240
haproxy-01:192.168.1.245
haproxy-01:192.168.1.246
webserver-01: 192.168.1.238
webserver-01: 192.168.1.239
Everything worked ok when I setup with vagrant and virtualbox. I am more keen on deploying using LXD. But when I setup with LXD, everything work as expected inside haproxy-01 or haproxy-02.
From the lxd host, everything works ok except connection via the floating IP.
The floating IP is unreachable when pinged from outside haproxy LXC containers and cannot curl to the haproxy nor to webservers.
haproxy-01 configuration:
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
daemon
maxconn 2000
defaults
log global
mode http
option dontlognull
retries 3
option redispatch
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend vrrp-request
bind *:80
default_backend nodes
backend nodes
mode http
stats enable
stats auth admin:admin
stats uri /haproxy?stats
balance roundrobin
option httpchk
option forwardfor
option http-server-close
server webserver-01 192.168.1.238:80 check
server webserver-02 192.168.1.239:80 check
keepalived config:
vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
weight 2
}
vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 51
priority 101
virtual_ipaddress {
192.168.1.240
}
track_script {
chk_haproxy
}
}
Below is a network profile (each node has seperate based on same template):
lxc profile show routed_192.168.1.245
config:
user.network-config: |
version: 2
ethernets:
eth0:
addresses:
- 192.168.1.245/32
nameservers:
addresses:
- 8.8.8.8
search: []
routes:
- to: 0.0.0.0/0
via: 192.168.1.1
on-link: true
description: Default LXD profile
devices:
eth0:
ipv4.address: 192.168.1.245
nictype: routed
parent: wlp2s0
type: nic
name: routed_192.168.1.245
used_by:
- /1.0/instances/haproxy-01
LXD version is 5.10.
I hope someone can guide me to resolve this issue.