GitLab实例及跨主机Runner部署问题:调度器无法分配作业求助
Hey there, let's work through this scheduler issue you're hitting with your GitLab Runners. I’ve dealt with similar headaches before, so here’s a step-by-step breakdown to get your jobs running:
Verify Runner status & connectivity
First, confirm your runners are actually online and able to talk to your GitLab instance. Head to your GitLab instance's Admin Area > Runners page to check if both your shell and docker runners show as "Active". On the runner hosts themselves, rungitlab-runner statusto make sure the service is up, andgitlab-runner verifyto test the connection to GitLab. If a runner is offline, double-check network rules (firewalls, proxies) and that the registration token you used is still valid.Check tag matching & runner locks
Even if you specified tags in your YAML, make sure they’re an exact case-sensitive match with the tags assigned to your runners. For example,docker-runnervsDocker-Runnerwon’t work. Also, check if the runner is marked as Locked—locked runners can only execute jobs for specific projects, so if your project isn’t linked to it, the scheduler can’t assign jobs. You can toggle this setting in the runner’s details page in GitLab.Inspect runner resource limits & configuration
For the shell runner: Check if the host has enough CPU/memory to handle the job, and that thegitlab-runneruser has proper permissions to clone repos and execute your pipeline scripts.
For the docker runner: Ensure the Docker daemon is running (systemctl status docker) and that there’s enough disk space/container resources. Also, check yourconfig.toml(usually at/etc/gitlab-runner/config.toml)—theconcurrentsetting dictates how many jobs the runner can handle at once; if it’s set to 0 or a number lower than your pending jobs, new tasks will get stuck.Dig into logs for specific errors
Logs are your best friend here:- On your GitLab server, check
/var/log/gitlab/gitlab-rails/production.logfor scheduler-related errors (like permission issues or invalid runner registration data). - On each runner host, look at
/var/log/gitlab-runner/gitlab-runner.log—this will show if the runner is receiving job requests, or if there’s a failure when trying to pick up a job (e.g., Docker image pull errors, shell execution permissions).
- On your GitLab server, check
Re-register the runner (as a last resort)
If all else fails, sometimes runner configurations get corrupted. Unregister the problematic runner withgitlab-runner unregister --name <runner-name>, then re-register it usinggitlab-runner register, making sure to input the correct GitLab instance URL, registration token, tags, and executor type (shell/docker).
Start with the first two checks—most of the time, the issue is a simple misconfiguration like a mismatched tag or an offline runner. Let me know if you spot something specific in the logs!
内容的提问来源于stack exchange,提问作者Isabel Román

