-
Notifications
You must be signed in to change notification settings - Fork 23
Use LB hostnames as weighted CNAME targets #182
Comments
@mikenairn @roivaz FYI |
as we cannot mix CNAMEs and A records for a weighted DNS record. When a mix is required, we could generate a (or use a premade e.g. nip.io) CNAME for the IP address we want to include, allowing the mix to function. Most likely, the ideal approach is to always convert A records to CNAMEs in this manner, so that if a CNAME is required later it can be added. |
this is the DNSRecord resource we want to create
|
This makes sense for hostname only scenarios, but since you can't mix CNAME and A records with the same host (#182 (comment)) do we want to consider creating a CNAME and A record for IP addresses and make that the default in all cases:
|
I see so this would only be needed if there was a mix of hosts and IPs. If it was all IPs we would just use A records, if it was all hosts we would just use CNAME as I outlined. This |
Or just do it all the time for IP addresses, we could always create CNAME records for the managed host instead of doing different things if we happen to have a mix. hostname -> create CNAME, ip -> create dedicated A record and CNAME |
yeah although that doubles the amount of records we need for hosts that already have IPs and doubles the number of look ups as each time a CNAME is encountered it triggers a fresh query |
Maybe, but the CNAMEs could have a fairly large TTL i would say. As for the number of records, yes you are increasing them, but not by much really. We would essentially be creating an lb CNAME per gateway. If it has multiple IPs, that could just be a single A record with multiple values rather than multiple A records since we don't need to worry about balancing those ips. We probably wouldn't want an ip specific A record, but a generated one:
In this scenario you'd actually be reducing the record count as currently we create a record per IP. |
Ah I see so we would have a unique host per gateway, as you say a LB host that we put all the IPs under then CNAME to each lb host with a weighted record. So we have 1 A record per gateway and multiple CNAMES to that gateway for each host. I like it. The LB host would really just be a place holder DNSName we would never expect that to be used in a HTTPRoute for example. Will go with this structure for all the things |
So with discussion with @mikenairn, @philbrookes I think your idea is the one we will go with. IE we will set up a DNS name for an IP and CNAME to that and any none IP we will just CNAME to |
This is covered now under the DNSPolicy and DNSRecord proposals. @mikenairn is including this in his work for geo #219 |
Problem
Currently if we hit a LB with a hostname, we resolve the IP addresses and use those as A records. This works but this is not ideal as if the IPs behind that hostname change we wont pick them up.
While we can add a watch for IP changes, this should probably not be the default behaviour as it has some drawbacks
Solution
If all the clusters for a given gateway are using LB with hostnames, we should default to structuring the DNS records to be multiple weighted CNAMES
If there is a mix of clusters where a gateway has been deployed with some using an IP as the LB and some using a hostname, we will have to fall back to using just A records as you cannot mix weighted record types (at least in AWS)
Note:
Note
I have tested this on AWS but we would want to also figure out what is possible with Azure and Google DNS.
Note: currently our GetAddress method, only works with IPs so this will need to be changed to deal with hosts also
The text was updated successfully, but these errors were encountered: