minikube: virtualbox: external DNS does not work within guest VM

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Minikube version (use minikube version): v0.18.0

Environment:

  • OS (e.g. from /etc/os-release): OSX 10.12.4
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName): virtualbox
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION): minikube-v0.18.0.iso
  • Install tools:
  • Others:

What happened: DNS doesn’t work in a container when run within my minikube cluster. I can ping hosts by IP address so there is internet connectivity. Also, if I run the container outside the cluster, pinging by hostname works.

What you expected to happen: DNS should work

How to reproduce it (as minimally and precisely as possible): Run a container and try to ping a host on the Internet by name, e.g. google.com.

Anything else do we need to know: Can’t use the xhyve driver because of #1452 (so I haven’t tested whether this affects clusters using the xhyve driver)

About this issue

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

Most upvoted comments

@boosh I had same problem with Vbox driver. After few hours of test and debug, I found out that the DNS was not well managed by Vbox and was causing that error. I am using minikube version: v0.19.0

What I did to fix the issue was that : activate natdnshostresolver1 on the host. First stop the VM minikube and type the following command : VBoxManage modifyvm "VM name" --natdnshostresolver1 on After, you can start the VM and it should be working

Source for info: https://forums.virtualbox.org/viewtopic.php?f=7&t=50368

Hope it will help you. Good luck

I am facing same issue with --vm-driver=none where a Pod fails to establish connection with the server running on web. Exact error string: Get https://<the-server-name>.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers). I am waiting for any solution, suggestion, workaround. I tried deploying CoreDNS but it didn’t help.

minikube version: v0.24.0 kubectl version: Client: 1.9.3 Server: 1.8.0

For now a simple workaround (tested with Hyper-V, but should work for OSX, Linux), try the following:

  • Start minikube
  • Ensure that the kube-dns addon is enabled: minikube addons enable kube-dns
  • SSH into minikube: minikube ssh
  • Add one google DNS IP in /etc/resolv.conf (nameserver 8.8.8.8 on a new line) -> vi or another editor : sudo vi /etc/resolv.conf
  • Save the /etc/resolv.conf file: :x or :wq for vi
  • Try ping google.ca while still in a Minikube SSH session, and if that works, you’re done…

I just encountered the same issue running:

  • K8s: v1.6.4
  • Minikube: v0.20.0

The VBoxManage command listed above expressly remedied the problem.