<p>I am following Linode's tutorials on using helm to deploy to Linode Kubernetes Engine (LKE) and I have reached <a href="https://youtu.be/wLHegOz_aR4?t=661" rel="nofollow noreferrer">the section on configuring external DNS</a> which uses <a href="https://artifacthub.io/packages/helm/bitnami/external-dns" rel="nofollow noreferrer">bitnami's external-dns package</a> to configure a domain on Linode's DNS servers.</p>
<p>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.</p>
<p>The logs from the external-dns show</p>
<blockquote>
<p>time=&quot;2022-01-01T14:45:10Z&quot; level=info msg=&quot;Creating record.&quot; action=Create record=juicy type=CNAME zoneID=1770931 zoneName=mydomain.com</p>
<p>time=&quot;2022-01-01T14:45:11Z&quot; level=info msg=&quot;Creating record.&quot; action=Create &gt; record=juicy type=TXT zoneID=1770931 zoneName=mydomain.com</p>
<p>time=&quot;2022-01-01T14:45:11Z&quot; level=error msg=&quot;Failed to Create record: [400] [name] Record conflict - CNAMES must be unique&quot; action=Create record=juicy type=TXT zoneID=1770931 zoneName=mydomain.com</p>
</blockquote>
<p>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.</p>
<p>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'</p>

PimpShanti
<p>It appears this is due to <em>external-dns</em> applying some logic which <a href="https://github.com/kubernetes-sigs/external-dns/blob/master/docs/faq.md#can-i-force-externaldns-to-create-cname-records-for-elbalb" rel="nofollow noreferrer">detects if the target is an Elastic Load Balancer</a>.</p>
<p>After creating the CNAME alias, <em>external-dns</em> is then trying to create a TXT Record with the same hostname, which is failing because this is not allowed. To get around this, <em>external-dns</em> provides a <a href="https://github.com/kubernetes-sigs/external-dns/blob/master/docs/faq.md#im-using-an-elb-with-txt-registry-but-the-cname-record-clashes-with-the-txt-record-how-to-avoid-this" rel="nofollow noreferrer"><code>--txt-prefix</code> flag</a> which allows you to prefix the TXT hostname with a string, thus making it different from the newly-created CNAME record.</p>
<p>Arguably, <em>external-dns</em> 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 <a href="https://github.com/kubernetes-sigs/external-dns/issues/2499" rel="nofollow noreferrer">on GitHub</a>.</p>
<p>If you're following Linode's excellent tutorial and/or you're installing <em>external-dns</em> with helm, the <code>--txt-prefix</code> flag needs to be set at installation:</p>
<pre><code>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
</code></pre>
<p>(<em>namespace</em> and other values are included to match the Linode tutorials)
The rest of the tutorial can then be followed as is.</p>
