'Gitlab Runner Failed to register
I have a gitlab instance with a public IP set up and running. However, trying to add a gitlab-runner fails, because the reverse lookup for the runner does not seem to work as intended. When registering the runner, I can see an incoming POST request with HTTP status 200 on nginx on the gitlab instance
1.2.3.4 - - [09/Oct/2021:21:41:51 +0200] "POST /api/v4/runners HTTP/1.1" 200 179 "-" "gitlab-runner 14.3.2 (14-3-stable; go1.13.8; linux/amd64)"
but the runner registration fails.
sudo gitlab-runner --debug register --non-interactive --url https://gitlab.example.org/ --registration-token asdasdasdasd --executor shell --tag-list shared --run-untagged=true --locked=false --access-level=not_protected
Runtime platform arch=amd64 os=linux pid=2488 revision=e0218c92 version=14.3.2
Checking runtime mode GOOS=linux uid=0
Running in system-mode.
Dialing: tcp gitlab.example.org:443 ...
ERROR: Registering runner... failed runner=LQ_-Gq-k status=200 OK
PANIC: Failed to register the runner. You may be having network problems.
The message is a bit misleading...
How to show what happens in gitlab after the connection was made? I mean the HTTP response is officially a 200.
The runner runs behind a NAT and has no public IP, but the gitlab instance has. The route and DNS settings are working to be able to resolve the runner.
Solution 1:[1]
I use the ddns, so that you need to resolve the domain name by editing the hosts file, in my case is ubuntu:
/etc/hosts
add the ip address of your gitlab server ip, like this:
192.168.2.180 yourgitlab.yourdomain.com
then, execute the gitlab-runner register again, it should be successful.
sudo gitlab-runner register --url https://<yourgitlab.yourdomain.com> --registration-token <your token>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | pjiaquan |
