That post will only work if the container doesn’t have its own network configuration trying to do dhcp which will first wipe the static config from the interface passed in from LXD.
There is a guide on how to get this to work with cloud init here How to get LXD containers get IP from the LAN with routed network
Or just doing it statically as you do works fine too.