4

Dear StackOverflow community!

I am trying to run the https://github.com/GoogleCloudPlatform/microservices-demo locally on minikube, so I am following their development guide: https://github.com/GoogleCloudPlatform/microservices-demo/blob/master/docs/development-guide.md

After I successfully set up minikube (using virtualbox driver, but I tried also hyperkit, however the results were the same) and execute skaffold run, after some time it will end up with following error:

Building [shippingservice]...
Sending build context to Docker daemon    127kB
Step 1/14 : FROM golang:1.15-alpine as builder
 ---> 6466dd056dc2
Step 2/14 : RUN apk add --no-cache ca-certificates git
 ---> Running in 0e6d2ab2a615
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: DNS lookup error
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: DNS lookup error
ERROR: unable to select packages:
  git (no such package):
    required by: world[git]
Building [recommendationservice]...
Building [cartservice]...
Building [emailservice]...
Building [productcatalogservice]...
Building [loadgenerator]...
Building [checkoutservice]...
Building [currencyservice]...
Building [frontend]...
Building [adservice]...
unable to stream build output: The command '/bin/sh -c apk add --no-cache ca-certificates git' returned a non-zero code: 1. Please fix the Dockerfile and try again..

The error message suggest that DNS does not work. I tried to add 8.8.8.8 to /etc/resolv.conf on a minikube VM, but it did not help. I've noticed that after I re-run skaffold run and it fails again, the content /etc/resolv.conf returns to its original state containing 10.0.2.3 as the only DNS entry. Reaching the outside internet and pinging 8.8.8.8 form within the minikube VM works.

Could you point me to a direction how can possible I fix the problem and learn on how the DNS inside minikube/kubernetes works? I've heard that problems with DNS inside Kubernetes cluster are frequent problems you run into.

Thanks for your answers!

Best regards, Richard

trebi
  • 433
  • 1
  • 5
  • 14
  • What versions of `minikube` and `scaffold` do you use? I want to try to reproduce it on my machine – moonkotte May 12 '21 at 08:19
  • skaffold: v1.23.0, minikube: v1.18.1 – trebi May 12 '21 at 09:32
  • Was it just the `shippingservice` image that failed? Does it work if you try minikube's `docker` driver? There have been issues with VirtualBox DNS previously (https://github.com/kubernetes/minikube/issues/3606). – Brian de Alwis May 13 '21 at 15:37

2 Answers2

3

Tried it with docker driver, i.e. minikube start --driver=docker, and it works. Thanks Brian!

trebi
  • 433
  • 1
  • 5
  • 14
2

Sounds like issue was resolved for OP but if one is using docker inside minikube then below suggestion worked for me.

Ref: https://github.com/kubernetes/minikube/issues/10830

minikube ssh
$>sudo vi /etc/docker/daemon.json
# Add "dns": ["8.8.8.8"]
# save and exit
$>sudo systemctl restart docker
Anand
  • 73
  • 7
  • I want this to work so bad.. doesn't update /etc/resolv.conf though, which keeps getting overwritten if I update it with vi. – Trey Mack May 24 '22 at 15:00