Sub topic 4
How ARC works: controller, scale set, listener, and runner pods
This chapter assumes you know basic Kubernetes objects (pods, namespaces, custom resources) and have read the earlier chapters on ephemeral runners and what ARC is. It explains the moving parts you will install in the next chapters, so you can reason about what happens when a job is queued.
The four components
ARC is a Kubernetes operator. It adds custom resources to your cluster and runs controllers that turn those resources into pods. Four pieces matter:
- Controller manager. One deployment, installed once per cluster in its own namespace (for example
arc-systems). It watches the ARC custom resources and creates or deletes the pods that implement them. - Runner scale set. An
AutoscalingRunnerSetcustom resource, created by thegha-runner-scale-setHelm chart. It holds your configuration: the GitHub URL, the credentials secret,minRunners,maxRunners, and the runner pod template. You can install many scale sets, each in its own namespace. - Listener. A pod the controller starts for each scale set. It opens a long-poll HTTPS connection to GitHub and asks for work for that scale set. It runs in the controller's namespace, not in the runner namespace.
- Ephemeral runner pods. The pods that run your jobs. Each one registers with GitHub, runs exactly one job, and is deleted.
The controller chart and the scale set chart are separate. The controller is shared. Scale sets are per team, per repository, or per organization.
What happens when a job is queued
The listener is the only component that talks to GitHub about job demand. The cluster never needs an inbound connection from GitHub, because the listener makes outbound requests only.
In words:
- A workflow job with a matching
runs-onlabel is queued. - GitHub reports the job count to the listener on its open connection.
- The listener computes the number of runners needed and patches the desired replica count on an
EphemeralRunnerSet. The count is the pending jobs plusminRunners, capped atmaxRunners. - The controller sees the new count and creates
EphemeralRunnerresources. Each becomes a pod. - The pod registers as a just-in-time runner, receives one job, and finishes.
- The controller deletes the pod. The listener lowers the count as demand drops.
Resources you can inspect
The scale set creates a chain of custom resources. Each level owns the next, so you can trace a problem down the chain.
| Resource | Created by | Purpose |
|---|---|---|
| `AutoscalingRunnerSet` | Scale set Helm chart | Your desired configuration |
| `AutoscalingListener` | Controller | Describes the listener pod for the scale set |
| `EphemeralRunnerSet` | Controller | Holds the current desired runner count |
| `EphemeralRunner` | Controller | One runner, backed by one pod |
You can list them with kubectl:
kubectl get autoscalingrunnersets,ephemeralrunnersets,ephemeralrunners -n arc-runners
kubectl get autoscalinglisteners -n arc-systemsWhy this design matters
- No inbound access. Only outbound HTTPS from the listener and runners is required.
- Clean state per job. Because each pod handles one job, no files or processes carry over between jobs.
- Separation of duties. The listener decides how many runners are needed. The controller decides how to make them. The scale set resource only describes intent.
Exercise
A scale set is configured with minRunners: 2 and maxRunners: 10. Five jobs are queued. How many runners does the listener request, and which component creates the pods?
Show answer
The listener requests 7 runners (5 pending jobs plus 2 minimum), which is under the cap of 10. It patches the EphemeralRunnerSet replica count. The controller manager then creates the EphemeralRunner resources and their pods.