SOLVED: Errors when registering runner on kubernetes

I have GitLab running in a docker container and behind a reverse proxy providing https termination.
K3S is running on the same local network as Docker. You will see below I have tried connecting the runner to GitLab via the Reverse proxy and directly to the GitLab docker container.

In my Gitlab runner values.yaml file I have tried setting the gitlabUrl to the Reverse Proxy address

I get the following error

Registration attempt 9 of 30
Runtime platform                                    arch=amd64 os=linux pid=271 revision=dcfb4b66 version=15.10.1
WARNING: Running in user-mode.                     
WARNING: The user-mode requires you to manually start builds processing: 
WARNING: $ gitlab-runner run                       
WARNING: Use sudo for system-mode:                 
WARNING: $ sudo gitlab-runner...                   
                                                   
Merging configuration from template file "/configmaps/config.template.toml" 
Token specified trying to verify runner...         
WARNING: If you want to register use the '-r' instead of '-t'. 
ERROR: Verifying runner... is removed               runner=<Redacted>
PANIC: Failed to verify the runner. You may be having network problems. 

If I point gitlabUrl directly to the GitLab docker container on the http port. I get the following error

Registration attempt 7 of 30
Runtime platform                                    arch=amd64 os=linux pid=197 revision=dcfb4b66 version=15.10.1
WARNING: Running in user-mode.                     
WARNING: The user-mode requires you to manually start builds processing: 
WARNING: $ gitlab-runner run                       
WARNING: Use sudo for system-mode:                 
WARNING: $ sudo gitlab-runner...                   
                                                   
Merging configuration from template file "/configmaps/config.template.toml" 
Token specified trying to verify runner...         
WARNING: If you want to register use the '-r' instead of '-t'. 
ERROR: Verifying runner... is removed               runner=<Redacted>
PANIC: Failed to verify the runner. You may be having network problems. 

If point gitlabUrl directly to the GitLab docker container on the https port. I get the following error

Registration attempt 1 of 30
Runtime platform                                    arch=amd64 os=linux pid=13 revision=dcfb4b66 version=15.10.1
WARNING: Running in user-mode.                     
WARNING: The user-mode requires you to manually start builds processing: 
WARNING: $ gitlab-runner run                       
WARNING: Use sudo for system-mode:                 
WARNING: $ sudo gitlab-runner...                   
                                                   
Created missing unique system ID                    system_id=r_Guvonxie29Yo
Merging configuration from template file "/configmaps/config.template.toml" 
Token specified trying to verify runner...         
WARNING: If you want to register use the '-r' instead of '-t'. 
ERROR: Verifying runner... failed                   runner=<Redacted> status=couldn't execute POST against https://192.168.1.158:20534/api/v4/runners/verify: Post "https://192.168.1.158:20534/api/v4/runners/verify": dial tcp 192.168.1.158:20534: connect: connection refused
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
 
Configuration (with the authentication token) was saved in "/home/gitlab-runner/.gitlab-runner/config.toml" 
Runtime platform                                    arch=amd64 os=linux pid=6 revision=dcfb4b66 version=15.10.1
Starting multi-runner from /home/gitlab-runner/.gitlab-runner/config.toml...  builds=0
WARNING: Running in user-mode.                     
WARNING: Use sudo for system-mode:                 
WARNING: $ sudo gitlab-runner...                   
                                                   
There might be a problem with your config based on jsonschema annotations in common/config.go (experimental feature):
jsonschema: '/runners/0/kubernetes/pull_policy' does not validate with https://gitlab.com/gitlab-org/gitlab-runner/common/config#/$ref/properties/runners/items/$ref/properties/kubernetes/$ref/properties/pull_policy/$ref/type: expected array, but got null
 
Configuration loaded                                builds=0
Metrics server listening                            address=:9252 builds=0
[session_server].listen_address not defined, session endpoints disabled  builds=0
Initializing executor providers                     builds=0
WARNING: Checking for jobs... failed                runner=<Redacted> status=couldn't execute POST against https://192.168.1.158:20534/api/v4/jobs/request: Post "https://192.168.1.158:20534/api/v4/jobs/request": dial tcp 192.168.1.158:20534: connect: connection refused

Any idea what might be going wrong?

1 Like

I solve the issue. In my case I put the Runner token in the wrong place in the values.yaml file.

I put it in runnerToken but it should have been added to runnerRegistrationToken

1 Like