How to use External DNS

I am trying to use CloudFlare DNS service.

Suppose that my domain name is mydomainname.com, and my load balancer has name lb.

I setup External CloudFlare DNS with the root domain (need more explaination on this keyword) to “mydomainname.com”.

When I check my CloudFlare DNS manager, I see a new A record with name lb.stack.mydomainname. I wonder why it does not have the “.com” at the end.

Anyway, I proceed to setup my CNAME to point to “lb.stack.mydomainname”, and it cannot resolve the DNS at all.

The point is, there is no instruction on how one is suppose to use this External DNS Service. I think more doc/example with details (such as saying “suppose your domain name is yourname.com”) would be very valuable.

Hi,
when oyu setup a load balancer, you should have a A record on the cloudflare DNS manager which point to
lb.stack.environment.mydomainname.com
but displayed in the manager page as
lb.stack.environment
(.mydomainname.com is implicit on the cloudflare page).

you don’t have to setup manually some DNS entries, for containers/tacks/environments created by rancher.
It seems weird that no environment appears in the A record.
for more clarity, rename your environment as test, qa, production, or another meaningful label.

hope it helps,

Charles.

It still does not work for me.

In my case, I have a domain name “domainname.com”. I have my service running in a container at port 9000. I want my service to be accessible at “www.domainname.com”, and “domainname.com”.
I have my load balancer “lb” listening on port 80, and forward traffic to port 9000.
When I deploy the CloudFlare External DNS, I can see an A record with the name “lb.dev.env”. Accessing “http://lb.dev.env.domainname.com” will render my website correctly.

However, when I specify my request host in the target service in the load balancer, i.e. setting up www.domainname.com on port 80 to point to my service on port 9000, I cannot access my service any longer, not on “http://www.domainname.com”, not on “http://lb.dev.env.domainname.com”. So I try to manually setup CNAME www in CloudFlare, and that does not help.

Could you point out if I miss anything?

@nlhkh

However, when I specify my request host in the target service in the load balancer, i.e. setting up www.domainname.com on port 80 to point to my service on port 9000. I cannot access my service any longer, not on “http://www.domainname.com”, not on “http://lb.dev.env.domainname.com

to clarify - do you set up hostname routing rule so all the requests for “www.domainname.com” would go to target service listening on port 9000? If so, accessing “http://lb.dev.env.domainname.com” wouldn’t work as the requested host doesn’t match “www.domainname.com” defined on the rule.

So I try to manually setup CNAME www in CloudFlare, and that does not help.

Have you set www.domainname.com to http://lb.dev.env.domainname.com cname, and it didn’t work? Wonder if the final request hitting the LB host/port, has “lb.dev.env.domainname.com” in the request. If that is true, you can try setting up host name routing rules rendering lb traffic to have “lb.dev.env.domainname.com” as a requested host.

I figured out the problem.

Here are 2 mistakes that I made:

  1. In CloudFlare, Rancher External DNS created an A record with name “container.stack.env”. I then have to create CNAME (or other types of record) to point to “container.stack.env.domain.com”, but instead I thought I only need the A record name part, i.e. pointing to “container.stack.env”, which cannot resolve to an ip address.

  2. I also configure SSL, but I forgot that I have to configure the port to be 443 instead of 80. Putting SSL on port 80 blocks everything!

Thank you for your help! :slight_smile:

@nlhkh :slight_smile: glad everything got resolved