With such a setup, the individual containers should still be able to get access to the Internet.
That is, the haproxy setup and the iptables rules should not affect in any way the networking of the individual containers.
The only thing I can think of, is if you setup
ufw on the host and somehow it blocks DNS for the containers.
Run the following to see the full list of
iptables rules on the host.
sudo iptables -L
sudo iptables -t nat -L
Also, check that the containers that cannot resolve, do have an IP address. Because if you do not have IP addresses either, then they did not get their DHCP configuration from LXD at all.