Sub topic 9
Scaling with minRunners and maxRunners
This chapter covers how a runner scale set grows and shrinks, and how minRunners and maxRunners set the limits. It assumes you have installed the controller and a scale set with Helm, and that you can read a values file and use kubectl.
How scaling works
The listener pod for each scale set keeps a long-poll connection to GitHub. GitHub reports how many jobs are assigned to the scale set. The listener patches the EphemeralRunnerSet with a desired replica count. The controller then creates or deletes EphemeralRunner resources, and each one becomes a runner pod.
The target count is calculated roughly like this:
desired runners = min(maxRunners, max(minRunners, assigned jobs))Because runners are ephemeral, a pod that finishes its job is deleted. The controller does not reuse it. Scaling down therefore happens as jobs finish. No separate cool-down timer is involved.
The two settings
minRunnersis the number of runners kept alive when the queue is empty. The default is0.maxRunnersis the upper bound on concurrent runners. Jobs beyond this limit stay queued in GitHub until a runner is free.
githubConfigUrl: "https://github.com/<your-org>/<your-repo>"
githubConfigSecret: pre-defined-secret
minRunners: 2
maxRunners: 10Apply a change with helm upgrade:
helm upgrade arc-runner-set \
--namespace arc-runners \
-f values.yaml \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-setLatency versus cost
The two settings trade job start time against spend.
| Setting | Effect on latency | Effect on cost |
|---|---|---|
| `minRunners: 0` | Each job waits for a pod to schedule, pull its image, and register. | No idle pods. Nodes can scale to zero. |
| `minRunners: N` (N > 0) | The first N jobs start almost at once. | N pods use resources all the time. |
| Low `maxRunners` | Jobs queue during bursts. | Spend is capped. |
| High `maxRunners` | Bursts run in parallel. | Spend can spike, and the cluster needs capacity. |
Warm runners are idle pods that keep their CPU and memory reserved. If your cluster autoscaler adds nodes only when pods are pending, a cold start also includes node provisioning time. This can take minutes. Set minRunners to cover your typical working-hours load, and choose maxRunners from your cluster capacity and your budget.
Watching it happen
Run the watch command in one terminal, then trigger several workflow runs in another:
kubectl get pods -n arc-runners --watchWith minRunners: 2, two runner pods are already Running before any job starts. As you queue more jobs, new pods appear up to maxRunners. When jobs end, the pods terminate until the count returns to the minimum.
Common errors
- Jobs stay queued although capacity exists. Check that
maxRunnersis not lower than your expected concurrency. Also check thatruns-onmatches the installation name. - Pods stay
Pending. The scale set requested pods that the cluster cannot place. Check requests, node capacity, and quotas. - Cost is higher than expected. Idle warm runners count the whole time. Review
minRunners. - A values change has no effect. You must run
helm upgrade. Editing the file alone changes nothing.
Exercise
Your team's builds are slow to start at 9:00 each morning, but the cluster is nearly idle overnight. You want fast starts without paying for many idle pods. Which setting do you change, and what trade-off do you accept?
Show answer
Raise minRunners to a small number that covers the morning's first jobs, then run helm upgrade. The trade-off is that those warm pods use CPU and memory around the clock, including overnight. Keep maxRunners at a level that still caps spend during bursts.