Unable start gitlabrunner with localserver

Hi everyone,

I’m currently facing an issue while trying to register my GitLab Runner. I recently migrated my system to a new server. Now I need to configure the GitLab Runner to operate with internal IP addresses (specifically, IPs in the range 192.168…).

Previously, the GitLab Runner was able to send requests to a public site successfully. However, with the new setup, GitLab Runner should send requests inside local ips.

I tried adding an IP mapping using extra_hosts = ["127.0.0.1:127.0.0.100"] in the GitLab Runner configuration. However, when I start the GitLab Runner from docker inside k8s, I encounter the following error message: status=couldn't execute POST against http://127.0.0.1:30080/api/v4/jobs/request: Post http://127.0.0.100:30080/api/v4/jobs/request: dial tcp 127.0.0.100:30080: connect: connection refused.

I have already checked the configuration file for the GitLab Runner and ensured that the URL is set to http://127.0.0.1:30080, as my GitLab instance is running on the same server. Additionally, I have verified that the GitLab instance is up and running.

Runner config:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "docker-gr"
  url = "http://127.0.0.100:30080"
  token = "TOKEN"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "docker:stable"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
    extra_hosts = ["127.0.0.1:127.0.0.100"]

Gitlab version 15.2.0 and located on 30080 port.
Also I tried to use instead 127.0.0.100 values from /etc/hosts and network_mode = "host" with localhost.

Hi @samoed

if I get it right, you have a GitLab running on a server listening on port 30080. And you are trying to register a GitLab Runner with it which is running on the same server?

Just use the IP of the server’s main interface: url = "http://192.168.x.y:30080"