Minikube: Failed DNS lookup using xhyve driver

Created on 7 Jun 2017  Â·  6Comments  Â·  Source: kubernetes/minikube

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

Minikube version (use minikube version): v0.19.1

Environment:

  • OS (e.g. from /etc/os-release): OSX 10.12.4
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName): xhyve
  • 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 lookup fails while using xhyve although works out-of-the-box using virtualbox.

What you expected to happen:
DNS lookups should work using xhyve as well.

How to reproduce it (as minimally and precisely as possible):

minikube start \
  --vm-driver xhyve
minikube ssh -- nslookup www.google.com

Anything else do we need to know:

I think it's the same as #1541 or very similar.

cxhyve kinbug

Most helpful comment

If anyone runs to this issue, it might be related to the fact that dnsmasq is running on your host. As this was the issue in my case.

All 6 comments

Do you see DNS pods if you run kubectl get pods --all-namespaces

Very strange, I was retesting this today and all of the sudden it works...

To answer your question, as the vm was not able to resolve any addresses, nothing was downloaded, so all containers were in ContainerCreating.

$ minikube start \
  --vm-driver xhyve
Starting local Kubernetes v1.6.4 cluster...
Starting VM...
Moving files into cluster...
Setting up certs...
Starting cluster components...
Connecting to cluster...
Setting up kubeconfig...
Kubectl is now configured to use the cluster.

$ minikube ssh -- nslookup www.google.com
Server:    10.0.2.3
Address 1: 10.0.2.3

Name:      www.google.com
Address 1: 172.217.22.100 fra15s18-in-f4.1e100.net
Address 2: 2a00:1450:4001:81d::2004 fra15s18-in-x04.1e100.net

If anyone runs to this issue, it might be related to the fact that dnsmasq is running on your host. As this was the issue in my case.

I have the same symptoms, no dns in xhyve vm, so all pods in ContainerCreating state. FWIW I don't have dnsmasq running my host (mac-sierra). Minikube v0.19.0

Looks like dnsmasq was refusing connections on the Host IP address(in this case 192.168.64.1) assigned by minikube.

➜  ~ minikube ssh
$ docker search alpine
Error response from daemon: Get https://index.docker.io/v1/search?q=alpine&n=25: dial tcp: 
lookup index.docker.io on 192.168.64.1:53: read udp 192.168.64.30:33718->192.168.64.1:53: 
read: connection refused

Configuring dnsmasq to specifically listen on the minikube host IP address did the trick for me. Add the following 2 lines in your dnsmasq.conf.

➜  ~ vim /usr/local/etc/dnsmasq.conf
# If you want dnsmasq to listen for DHCP and DNS requests on
#  by address (remember to include 127.0.0.1 if you use this.)
# Repeat the line for more than one interface.
#listen-address=
listen-address=192.168.64.1
listen-address=127.0.0.1

You will need to restart your system after updating dnsmasq config.
(Strangely enough, only restarting minikube VM and dnsmasq did not work.)

sometimes it seems the bridge interface goes missing after running minikube stop

  1. verify dnsmasq is running

    sudo lsof -ni:53
    
  2. try running dnsmasq manually by looking at the launch command -

    defaults read /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
    

    and run dnsmasq

    sudo /usr/local/opt/dnsmasq/sbin/dnsmasq --keep-in-foreground -C /usr/local/etc/dnsmasq.conf
    
    dnsmasq: failed to create listening socket for 192.168.64.1: Can't assign requested address
    

I had to start minikube first to ensure the bridge interface existed, then dnsmasq would run and dns from within the minikube instance worked again...

Was this page helpful?
0 / 5 - 0 ratings