Gitlab Runner in Kubernetes Could not resolve host

10/1/2019

I have deployed a Gitlab Runner in our Kubernetes Cluster with the Helm Chart

Now i try to build a image with kaniko. But the runner can not resolve the url of my gitlab server:

Running with gitlab-runner 12.3.0 (a8a019e0)
on gitlab-runner-gitlab-runner-d7996895b-7lpnh nY2nib3b
Using Kubernetes namespace: gitlab
Using Kubernetes executor with image gcr.io/kaniko-project/executor:debug ...
Waiting for pod gitlab/runner-ny2nib3b-project-2-concurrent-0w2ffw to be running, status is Pending
Running on runner-ny2nib3b-project-2-concurrent-0w2ffw via gitlab-runner-gitlab-runner-d7996895b-7lpnh...
Fetching changes...
Initialized empty Git repository in /builds/my-repo/.git/
Created fresh repository.
fatal: unable to access 'https://gitlab-ci-token:[MASKED]@XXX.XY:8443/my-repo.git/': Could not resolve host: XXX.XY
ERROR: Job failed: command terminated with exit code 1

When i connect to the pod and try nslookup XXX.XY:

nslookup: can't resolve 'XXX.XY': Name does not resolve

I have already solved some problems but here I have no idea. DNS works in other PODs.

Edit:

on a working busybox pod the output of nslooup is

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

Name:      google.de
Address 1: 2a00:1450:4001:816::2003 fra16s07-in-x03.1e100.net
Address 2: 172.217.18.3 fra15s28-in-f3.1e100.net
-- micha
dns
gitlab
gitlab-ci
gitlab-ci-runner
kubernetes

2 Answers

10/10/2019

With us it was a DNS configuration problem. The nodes were not configured correctly and Alpine seems to follow the standard a bit more closely than others.

I have looked at the /etc/resolve.conf file of the not working PODs. The Problem was the last (wrong) Domain under "search".

-- micha
Source: StackOverflow

10/4/2019

If you are using v12.3.0, then you ran into a bug: https://gitlab.com/gitlab-org/charts/gitlab-runner/issues/96

-- aries1980
Source: StackOverflow