Gitlab Runner on K8S - CE

I try to install a GitlabRunner with helm. So far so good. The Pod raises but can’t register to my gitlab instance.

The Problem is that the domain gitlab.somehost.com is only available for a certain part of ipadresses. So when the runner tries to register with its domainname, it failes since the underlying node-ip addresses are not static and not allowed to access externally.

I’ve tried to rewrite it with hostAliases to its internal IP, which would work, but the registration always tries to go over the external IP.

This is my values.yaml

gitlabUrl: https://gitlab.somehost.com/
runnerRegistrationToken: "xxxyyyxxxyyyzzz"
concurrent: 10
checkInterval: 30
clusterWideAccess: false
metrics:
  enabled: true

executor: kubernetes 
name: gitlabrunner-001
## privileged ist deprecated. Bei Zeiten mal Google Kaniko testen
privileged: true
hostAliases:
  - ip: "10.164.0.110"
    hostnames:
    - "gitlab.somehost.com"

## Configuration for the Pods that the runner launches for each new job
##
runners:
  # runner configuration, where the multi line strings is evaluated as
  # template so you can specify helm values inside of it.
  #
  # tpl: https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function
  # runner configuration: https://docs.gitlab.com/runner/configuration/advanced-configuration.html
  config: |
    [[runners]]
      [runners.kubernetes]
        image = "ubuntu:16.04"
        extra_hosts="gitlab.somehost.com:10.164.0.110"]

This is what the logs says:

2021-04-29 17:02:12.008 CEST e[0;m
2021-04-29 17:02:42.010 CESTe[31;1mERROR: Registering runner... failed e[0;m e[31;1mrunnere[0;m=nkTBPD3Y e[31;1mstatuse[0;m=couldn't execute POST against https://gitlab.somehost.com/api/v4/runners: Post https://gitlab.somehost.com/api/v4/runners: dial tcp 108.90.99.101:443: i/o timeout
2021-04-29 17:02:42.010 CESTe[31;1mPANIC: Failed to register the runner. You may be having network problems.e[0;m
2021-04-29 17:02:47.015 CESTRegistration attempt 2 of 30
2021-04-29 17:02:47.062 CESTRuntime platform e[0;m arche[0;m=amd64 ose[0;m=linux pide[0;m=41 revisione[0;m=7f7a4bb0 versione[0;m=13.11.0
2021-04-29 17:02:47.064 CESTe[0;33mWARNING: Running in user-mode. e[0;m
2021-04-29 17:02:47.064 CESTe[0;33mWARNING: The user-mode requires you to manually start builds processing:e[0;m
2021-04-29 17:02:47.064 CESTe[0;33mWARNING: $ gitlab-runner run e[0;m
2021-04-29 17:02:47.064 CESTe[0;33mWARNING: Use sudo for system-mode: e[0;m
2021-04-29 17:02:47.064 CESTe[0;33mWARNING: $ sudo gitlab-runner... e[0;m

I’m running the latest version of gitlab-ce and the runner.

I must confess, I am still quite new to Kubernetes. Likewise in Helm. My previous runners that simply ran as Docker containers never had any problems! :slight_smile:

Thanks for advice and some hints.

– Tom