How to use a private DNS with k3s #7822
-
Trying to configure k3s to use my private dns server Using ubuntu 22.04 with systemd based DNS. The only way i could get it running is defining a apiVersion: v1
kind: ConfigMap
metadata:
name: coredns-custom
namespace: kube-system
data:
custom.server: |
myprivatedomain.tld:53 {
forward . 10.10.0.243
} Is there a better way to deal with this issue? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 22 replies
-
It does, unless the host's resolv.conf includes an invalid upstream, in which case it uses 8.8.8.8. If you want to point k3s at an alternative upstream, the easiest way is to create a custom resolv.conf, and point k3s at it with the |
Beta Was this translation helpful? Give feedback.
-
@brandond you have answered this way several times, but there is more to it:
Right now, the only way i could "fix" it is using apiVersion: v1
kind: ConfigMap
metadata:
name: coredns-custom # this is the name of the configmap you can overwrite with your changes
namespace: kube-system
data:
custom.server: |
prviatedomain.tld:53 {
forward . <provate DNS IP>
} which i would need to do for every private-domain i need to follow. Happy to understand your POV better |
Beta Was this translation helpful? Give feedback.
-
Thank you for elaborating and thank you for helping! Considering that ubuntu LTS is one of the official k8s distros and k3s not supporting the default cloud-init based installation is something that i really consider is a issue. I understood why you cannot use the default resolv.conf it and i also understand that most probably less people use a private DNS (thus e.g. like throwing an error on start is not desired). To reduce the amount of issues for that questions (there are a couple already), tell people why the syst. Not just a generic "if it is invalid" - this would help reducing the amount of issues opened in k3s (probably) i really would wish there would be a more elegant way to work with that issue. The only one i can think of technically is either
|
Beta Was this translation helpful? Give feedback.
-
This is interesting, this is my
It is never used by k3s. Is the
Ubuntu 20.04/22.04 based setups which are e.g. booted using cloud-init (kind of common for setting up k3s/rke2) come with the describe systemd based dns setup. The statement you made about |
Beta Was this translation helpful? Give feedback.
-
You're welcome to do whatever you think would help people find it best! |
Beta Was this translation helpful? Give feedback.
-
If anybody is in need, i created a little helm chart to fix this issue, see https://github.com/EugenMayer/helm-charts/tree/main/charts/coredns-private-dns-fix |
Beta Was this translation helpful? Give feedback.
-
I wanted to add a case that isn't covered by the customer /etc/resolv.conf which is using a local resolver such as dnsmasq. in that case we are forced to put in the private DNS since the /etc/resolv.conf shows 127.0.0.1. |
Beta Was this translation helpful? Give feedback.
It's right there in the page you linked...
The doc doesn't call this out, but it you point …