I have a dns server running at 192.168.0.19 for custom domains like .fritz.box. Having a single node cluster on k3s, Rancher was installed using a subdomain server2.fritz.box using this command:
helm install rancher-latest/rancher \
--name rancher \
--namespace cattle-system \
--set hostname=server2.fritz.box
Rancher itself shows that some services are not avaliable and the logs from cattle say server2.fritz.box is not avaliable. Since Kubernetes has its own dns system, I looked at the documentation and it seems that I need to set my .19 dns server so that Kubernetes knows how to resolve .fritz.box domains. Some questions also have similar problems like https://stackoverflow.com/questions/41448095/kube-dns-does-not-resolve-external-hosts-on-kubeadm-bare-metal-cluster
So I created the following yaml:
# https://github.com/kubernetes/kops/issues/4986
apiVersion: v1
kind: ConfigMap
metadata:
name: kube-dns
namespace: kube-system
data:
stubDomains: |
{"fritz.box": ["192.168.0.19"]}
upstreamNameservers: |
["192.168.0.19"]
Loaded with kubectl apply -f dns.yml
. Now created a busybox test pod:
~$ kubectl exec -it busybox -- ping server2.fritz.box
ping: bad address 'server2.fritz.box'
Why is this not working? And what must be done to resolve a custom dns server in Kubernetes?