Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Customizing coredns on k3s to point a domain directly to the cluster loadbalancer

I'm trying to add a rewrite to coredns to point a domain to the cluster loadbalancer (so that the request for that domain gets redirected back into the cluster). I can't seem to find a way to affect k3s' coredns configuration. Is there a way to change it?

(This is to work around https://github.com/jetstack/cert-manager/issues/1292#issuecomment-757283796 where a pod tries to contact another service in the cluster via a DNS name that points to the router's IP, which fails due to how NAT works.)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It is possible to configure CoreDNS to mapping one domain to another domain by adding rewrite rule. Suppose you have domain example.com and you want that domain to point to google.com domain.

To do this in CoreDNS, you can use the rewrite plugin.

Configuration of CoreDNS is stored in coredns ConfigMap in kube-system namespace. You can edit it using:

root@kmaster:~# kubectl edit cm coredns -n kube-system

Just add one rewrite rule, like in the example below:

apiVersion: v1
data:
  Corefile: |
    .:53 {
        errors
        health
        rewrite name example.com google.com # mapping example.com to google.com
        ready
...

Next you need to reload CoreDNS, to use new configuration. You may delete coredns Pod (coredns is deployed as Deployment, so new Pod will be created) or you can send it a SIGUSR1 to tell it to reload graceful.

Finally we can check how it works:

root@kmaster:~# kubectl run -it --rm --image=infoblox/dnstools:latest dnstools
dnstools# host -t A google.com
google.com has address 172.217.21.238
dnstools# host -t A example.com
example.com has address 172.217.21.238

You can find more information about rewrite plugin in Coredns rewrite documentation.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!