I am replacing OpenVZ with LXD on many nodes. I have a setup that has been discussed here before:
lxdbr0 -> 192.168.122.1
Each container gets its own static IP, outbound route is 192.168.122.1, then on the host node, I use ipv4.address and ipv4.route to add the IP to the container. If I move the container, the route goes with the container. All good so far!
New wrinkle: I have some containers that use Keepalived to pass a floating IP between two containers on different hosts. In OpenVZ, I have a script that connects to the host (192.168.122.1 in this case) and adds the IP address as a venet to the container. It is automatically picked up by the host and announced as a kernel route to the network.
In LXD, I can add the IP address inside the container, my problem is routing. If I connect to the host and add a static route, the route stays up even if the IP moves to another container (on another host) and/or the original container goes down. Same if I use ipv4.routes to the container’s config.
I realize I could put frr or zebra inside the container and announce it that way, but I was hoping to avoid that and run it on the host.