If what AI suggested doesn't work
You might think that you can configure CoreDNS to forward requests for some specific domain to some other DNS server, like this:
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns-custom
namespace: kube-system
data:
test1.override: |
forward example.com 1.1.1.1
But unfortunately, this won't work, because of the way how these *.overrides work.
They are included at the end of CoreDNS's main config file.
Unfortunately, in k3s, this file first says forward . /etc/resolv.conf - i.e. forward everything...
and since forward statements are processed in the order they are listed,
your forward statement is effectively ignored.
The way how you do it is:
-
First, look at the existing CoreDNS config file (it starts with
.:53 {and ends with}\nimport /etc/coredns/custom/*.server) -
Then, you write a new server block, like this (and add it to the
data:part of yourcoredns-customConfigMap):test2.server: | example.com:53 { forward . 1.1.1.1 }
This means that you now create a new server, and all requests are forwarded to the mentioned DNS server. Nice!
Source: it was mentioned in this github issue.