Skip to content
Latchkey

How to Autoscale GitLab Runners With the Autoscaler and Fleeting

GitLab now autoscales via the Runner Autoscaler and fleeting plugins; the old docker-machine executor is deprecated.

The GitLab Runner docker-machine autoscaling is deprecated. Its replacement is the GitLab Runner Autoscaler with fleeting plugins that provision cloud instances (AWS, GCP, Azure) on demand. You configure [runners.autoscaler] with a plugin, capacity, and idle policy so instances scale with pipeline load.

Steps

  • Install a fleeting plugin for your cloud (for example fleeting-plugin-aws).
  • Configure [runners.autoscaler] with the plugin, capacity_per_instance, and a scale policy.
  • Set an idle count and idle time so instances scale down when pipelines are quiet.

config.toml

Terminal
[[runners]]
  executor = "docker-autoscaler"
  [runners.autoscaler]
    plugin = "aws"
    max_use_count = 1        # ephemeral: one job per instance
    capacity_per_instance = 1
    [[runners.autoscaler.policy]]
      idle_count = 1
      idle_time = "20m0s"
    [runners.autoscaler.plugin_config]
      name = "gitlab-runner-asg"
      region = "us-east-1"

Gotchas

  • docker-machine autoscaling is deprecated; new setups should use the autoscaler with fleeting.
  • Set max_use_count = 1 for ephemeral one-job-per-instance behavior, mirroring GitHub ephemeral runners.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →