minikube: DNS failure trying to build docker image in hello-minikube tutorial

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

Moved from https://github.com/kubernetes/kubernetes.github.io/issues/3596

Minikube version (use minikube version):

> minikube version
minikube version: v0.18.0

Environment:

  • OS (e.g. from /etc/os-release): MacOS 10.12.4
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName): “DriverName”: “xhyve”,
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION): “Boot2DockerURL”: “file:///Users/jabley/.minikube/cache/iso/minikube-v0.18.0.iso”,
  • Install tools: Homebrew
  • Others:
> kubectl version
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.2", GitCommit:"477efc3cbe6a7effca06bd1452fa356e2201e1ee", GitTreeState:"clean", BuildDate:"2017-04-19T22:51:55Z", GoVersion:"go1.8.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0", GitCommit:"fff5156092b56e6bd60fff75aad4dc9de6b6ef37", GitTreeState:"dirty", BuildDate:"2017-04-07T20:46:46Z", GoVersion:"go1.7.3", Compiler:"gc", Platform:"linux/amd64"}

What happened:

Trying to follow the hello-minikube tutorial:

> > minikube start --vm-driver=xhyve
Starting local Kubernetes cluster...
Starting VM...
SSH-ing files into VM...
Setting up certs...
Starting cluster components...
Connecting to cluster...
Setting up kubeconfig...
Kubectl is now configured to use the cluster.
> kubectl config use-context minikube
Switched to context "minikube".
> > kubectl cluster-info
Kubernetes master is running at https://192.168.64.5:8443

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
> eval $(minikube docker-env)
> docker build -t hello-node:v1 .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM node:6.9.2
Pulling repository docker.io/library/node
Error while pulling image: Get https://index.docker.io/v1/repositories/library/node/images: dial tcp: lookup index.docker.io on 192.168.64.1:53: read udp 192.168.64.5:48734->192.168.64.1:53: read: connection refused

What you expected to happen:

The docker build to succeed.

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

Anything else do we need to know:

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 11
  • Comments: 24 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Faced the same issue with both hyperkit and xhyve drivers.

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 macbook after updating dnsmasq config. (Strangely enough, only restarting minikube VM and dnsmasq did not work.)

If someone is still facing this issue on virtualbox, it’s a dns resolution issue. It has noting to do with minikube and can be resolved by doing:

  • minikube stop
  • VBoxManage modifyvm "minikube" --natdnshostresolver1 on
  • minikube start

The full details are mentioned here

I’ve managed to complete the hello-minikube tutorial using VirtualBox, rather than xhyve. Not sure if that helps?

Uninstalling dnsmasq let me complete the tutorial using xhyve.

In order to pull images you have to make sure that the DNS pod is running in your cluster. To do this you can run kubectl get po --all-namespaces and verify that all of the pods are in the Running state.

I had the exact same issue with the xhyve driver where the docker build would fail and where the nslookup within the minikube ssh session would fail as well. Starting minikube with the virtualbox driver works succesfully.

I also had dnsmasq running locally to configure anything .dev to resolve to localhost. After disabling and removing dnsmasq locally and starting minikube with xhyve again everything works succesfully.

Maybe this info helps?

This should be the xhyve driver issue.

minikube delete -> minikube start (don’t use --vm-driver=xhyve, by default minikube will start by using VirtualBox driver), then everything is fine.

$ cat ~/.minikube/machines/minikube/config.json | grep DriverName
    "DriverName": "virtualbox",

$ kubectl get po --all-namespaces
NAMESPACE     NAME                          READY     STATUS    RESTARTS   AGE
kube-system   kube-addon-manager-minikube   1/1       Running   0          3m
kube-system   kube-dns-910330662-sp9k0      3/3       Running   0          3m
kube-system   kubernetes-dashboard-xhm5x    1/1       Running   0          3m

$ minikube ssh
$ nslookup gcr.io
Server:    10.0.2.3
Address 1: 10.0.2.3

Name:      gcr.io
Address 1: 74.125.23.82 tg-in-f82.1e100.net