I am following Linode's tutorials on using helm to deploy to Linode Kubernetes Engine (LKE) and I have reached the section on configuring external DNS which uses bitnami's external-dns package to configure a domain on Linode's DNS servers.
When I try to annotate my service, using exactly the same command as in the video, it results in a CNAME alias and no A/TXT Records.
The logs from the external-dns show
time="2022-01-01T14:45:10Z" level=info msg="Creating record." action=Create record=juicy type=CNAME zoneID=1770931 zoneName=mydomain.com
time="2022-01-01T14:45:11Z" level=info msg="Creating record." action=Create > record=juicy type=TXT zoneID=1770931 zoneName=mydomain.com
time="2022-01-01T14:45:11Z" level=error msg="Failed to Create record: [400] [name] Record conflict - CNAMES must be unique" action=Create record=juicy type=TXT zoneID=1770931 zoneName=mydomain.com
These logs imply that external-dns is first creating a CNAME record (which isn't required/wanted at all) and then attempting to create a TXT record which uses the same hostname as the newly-created CNAME, which obviously isn't allowed. And it is clearly not attempting to create the A Record at all.
I would really appreciate any info about why this might be happening and what I can do to correct it. For clarity, the desired result is one A Record and one TXT Record, both with the hostname 'juicy'
CodePudding user response:
It appears this is due to external-dns applying some logic which detects if the target is an Elastic Load Balancer.
After creating the CNAME alias, external-dns is then trying to create a TXT Record with the same hostname, which is failing because this is not allowed. To get around this, external-dns provides a --txt-prefix flag which allows you to prefix the TXT hostname with a string, thus making it different from the newly-created CNAME record.
Arguably, external-dns does not need to switch from A Record to CNAME in this instance because Linode's Load Balancers have IP addresses, not domain names. An issue has been raised on GitHub.
If you're following Linode's excellent tutorial and/or you're installing external-dns with helm, the --txt-prefix flag needs to be set at installation:
helm install external-dns bitnami/external-dns \
--namespace external-dns --create-namespace \
--set provider=linode \
--set linode.apiToken=$LINODE_API_TOKEN \
--set txtPrefix=your-prefix-string
(namespace and other values are included to match the Linode tutorials) The rest of the tutorial can then be followed as is.
CodePudding user response:
You can create the A record in route-53 i am not sure you are on which cloud or so.
in document search for aws.preferCNAME you can see in deployment that's where changes need to be configured.
External DNS will create the A record also please check your deployment configuration.
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: external-dns
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: external-dns
spec:
containers:
- name: external-dns
image: registry.opensource.zalan.do/teapot/external-dns:v0.3.0-beta.0
imagePullPolicy: Always
args:
- --domain-filter=$(DOMAIN_FILTER)
- --source=service
- --source=ingress
- --provider=aws
env:
- name: DOMAIN_FILTER
valueFrom:
configMapKeyRef:
name: external-dns
key: domain-filter
there could be chances, --aws-prefer-cname line with CNAME config which is making external DNS force to create CNAME instead of A record.
Remove CNAME config and check by default it will create the A record.
