Skip to content

Kubernetes executor can't lookup gitlab server for git fetch

Config.toml;

concurrent = 10
check_interval = 30
log_level = "debug"

[[runners]]
  name = "gitlab-shared-ci-runner"
  url = "https://gitlab.fqdn/"
  token = "..."
  executor = "kubernetes"
  environment = ["http_proxy=http://squid-proxy.kube-system.svc:3128/", "https_proxy=http://squid-proxy.kube-system.svc:3128/", "ftp_proxy=http://squid-proxy.kube-system.svc:3128/", "rsync_proxy=http://squid-proxy.kube-system.svc:3128/", "no_proxy=127.0.0.1,::1,localhost,.localdomain,.fqdn,.cluster.local"]
  [runners.cache]
  [runners.kubernetes]
    host = ""
    image = "ubuntu:16.04"
    namespace = "gitlab-dynprov"
    namespace_overwrite_allowed = ""
    privileged = false
    cpu_limit = "2"
    memory_limit = "1Gi"
    service_account_overwrite_allowed = ""
    [runners.kubernetes.volumes]

And the build log looks like;

Running with gitlab-runner 10.1.0 (c1ecf97f)
  on gitlab-shared-ci-runner (ddb6f7bc)
Using Kubernetes namespace: gitlab-dynprov
Using Kubernetes executor with image node:latest ...
Waiting for pod gitlab-dynprov/runner-ddb6f7bc-project-3-concurrent-0q6mkf to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-ddb6f7bc-project-3-concurrent-0q6mkf to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-ddb6f7bc-project-3-concurrent-0q6mkf to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-ddb6f7bc-project-3-concurrent-0q6mkf to be running, status is Pending
Running on runner-ddb6f7bc-project-3-concurrent-0q6mkf via gitlab-shared-ci-gitlab-runner-3834145963-dnc7v...
Cloning repository...
Cloning into '/aleol57/gitlab-eum'...
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.fqdn/aleol57/gitlab-eum.git/': Couldn't resolve host 'gitlab.fqdn'
ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1

But I can't replicate the error outside of said builds;

$ kubectl run --rm -it --image=gitlab/gitlab-runner-helper:x86_64-64eea86c runner-test /bin/bash
If you don't see a command prompt, try pressing enter.
bash-4.3# git clone https://gitlab.fqdn/aleol57/gitlab-eum.git
Cloning into 'gitlab-eum'...
remote: Counting objects: 214, done.
remote: Compressing objects: 100% (104/104), done.
remote: Total 214 (delta 125), reused 173 (delta 99)
Receiving objects: 100% (214/214), 69.19 KiB | 0 bytes/s, done.
Resolving deltas: 100% (125/125), done.
Checking connectivity... done.
bash-4.3#

I was able to connect successfully when adding a clone url with the IP of the server, but sadly I'm not able to provide an IP SAN for the SSL cert, so I can't use that.

Running with gitlab-runner 10.1.0 (c1ecf97f)
  on gitlab-shared-runner (5c528306)
Using Kubernetes namespace: gitlab-dynprov
Using Kubernetes executor with image node:latest ...
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Waiting for pod gitlab-dynprov/runner-5c528306-project-3-concurrent-09411v to be running, status is Pending
Running on runner-5c528306-project-3-concurrent-09411v via gitlab-shared-ci-gitlab-runner-3834145963-kh066...
Cloning repository...
Cloning into '/aleol57/gitlab-eum'...
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@1.2.3.44/aleol57/gitlab-eum.git/': SSL: no alternative certificate subject name matches target host name '1.2.3.44'
ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1