Creating Subdomains for LXD Containers
Kind of new at working with DNS.
I am running Ubuntu 18.08 in the host as well as in the container(s).
I want to access the container as amsc1.streamingworld.us, eventually also using amsc2, amsc3, etc for additional containers.
I guess I need to forward port 80/443 on the host to an HAProxy container, which will key on amsc1 and forward to the proper container? Am I right so far? Or should I have HAproxy running on the host instead of a container?
I created an A/AAAA record for amsc1. Should'nt I be able to nslookup amsc1.streamingworld.us at this point?
I also created an NS record. Do I need the NS record?
Your comments appreciated.
LXD will listen on a local socket, and each container will listen to a specific network interface. You'll want to forward ports 80 and 443 from the host to the container. HAProxy will serve as a reverse proxy that forwards traffic from the host to the containers, so HAProxy should run on the host. This link also has a step-by-step guide for configuring LXD containers with HAProxy, and may be helpful to refer to during your setup process.
Regarding your DNS entry, I'm able to obtain an IP address for your base domain but not for your other hostnames, including
$dig +short streamingworld.us 188.8.131.52 $ dig amsc1.streamingworld.us ; <<>> DiG 9.10.6 <<>> amsc1.streamingworld.us ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 11150 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
The SERVFAIL error indicates that the server isn't able to find the associated record. This is likely due to the NS entries. You will need to list Linode's name servers with your domain registrar and for your base domain, but you don't need separate entries for each hostname. More information can be seen here in the screenshot.