minikube: DNS lookup not working when starting minikube with --dns-domain

Minikube version 0.19.1

Environment:

  • OS MAC OS 10.11.4
  • VM Driver virtualbox
  • ISO version minikube-1.13.1-3.iso:
  • Install tools:
  • Others:

What happened: If I start minikube with --dns-domain the dns entries that are registered are still registered with the domain cluster.local

What you expected to happen: I would expect that the dns entries are registered with domain provided in the startup parameters.

How to reproduce it (as minimally and precisely as possible): Start minikube with --dns-domain test.cluster.local do nslookup kubernetes.default.svc.test.cluster.local 10.0.0.1 -> does not work do nslookup kubernetes.default.svc.cluster.local 10.0.0.1 -> works but is not expected to work

Anything else do we need to know: To me it looks like this is caused by the hard coded cluster.local in https://github.com/kubernetes/minikube/blob/master/deploy/addons/kube-dns/kube-dns-controller.yaml

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 8
  • Comments: 22 (3 by maintainers)

Most upvoted comments

This is my work around.

# enable dns
$ minikube start
$ minikube addons enable kube-dns
$ minikube addons list
$ eval $(minikube docker-env)

$ kubectl get svc kube-dns -n kube-system
NAME       TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)         AGE
kube-dns   ClusterIP   10.96.0.10   <none>        53/UDP,53/TCP   19d

$ minikube ssh
$ sudo vi /etc/resolv.conf
# add a line in resolv.conf
# nameserver 10.96.0.10

$ nslookup kube-dns.kube-system.svc.cluster.local
Server:    10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name:      kube-dns.kube-system.svc.cluster.local
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

in your minikube VM:

Change /etc/systemd/resolved.conf From: #DNS= To: DNS=<IP of the DNS server>

then sudo systemctl restart systemd-resolved

i can reproduce it with v 1.9.0 too. The inter-pod communication doesn’t work.

minikube version: v0.25.0

kubectl apply -f registry-gateway-deployment.yml -f registry-gateway-service.yaml --record
kubectl apply -f auth-deployment.yaml -f auth-service.yaml --record

kube kubectl get pods
NAME                          READY     STATUS    RESTARTS   AGE
auth-68c7556479-7wpdn         1/1       Running   0          2h
infra-apps-6ccccd558b-wk7pb   1/1       Running   0          2h

kubectl exec auth-68c7556479-7wpdn -it – bash

I am trying to do an nslookup for the infra-apps service from the auth pod.

nslookup infra-apps.default.svc.cluster.local

nslookup: can’t resolve ‘(null)’: Name does not resolve


Name:      infra-apps.default.svc.cluster.local
Address 1: 10.98.32.142 infra-apps.default.svc.cluster.local

Looks like we need to propagate the --dns-domain flag into the dns addon. I think this should be doable on minikube start.

The issue is relevant for minikube v1.12.3. This way helped me.

minikube start --dns-domain='custom.domain' --extra-config='kubelet.cluster-domain=custom.domain'

experienced the same error with minikube + win10

my workaround (followed @gitdr suggestion):

$ minikube ssh <-- git bash windows
$ sudo su - <-- within the minikube environment
# cat << EOF > /etc/systemd/resolved.conf
> [Resolve]
> DNS=8.8.8.8
> FallbackDNS=8.8.8.8 8.8.4.4
> EOF

# systemctl restart systemd-resolved

-hth