Sub topic 4
How ARC works: controller, scale set, listener, and runner pods
This chapter assumes you know basic Kubernetes objects (pods, namespaces, secrets, deployments), can use kubectl, and understand why ephemeral runners are useful. You will learn which components ARC runs, where each one lives, and how a queued job turns into a runner pod. The next chapters install these components, so this one stays conceptual and uses read-only kubectl commands for inspection.
The four moving parts
ARC (Actions Runner Controller) is built from custom resources and controllers. A custom resource is an API object you add to Kubernetes. A controller is a program that watches such objects and changes the cluster to match them.
| Component | Kind | Where it runs | Job |
|---|---|---|---|
| Controller manager | Deployment | Controller namespace (for example `arc-systems`) | Watches ARC custom resources and creates, updates, and deletes the objects that implement them |
| Runner scale set | `AutoscalingRunnerSet` resource | Runner namespace (for example `arc-runners`) | Declares one pool of runners: target repository or organization, min and max counts, pod template |
| Listener | `AutoscalingListener` resource and a pod | Controller namespace | Holds a connection to GitHub and reports how many runners the queue needs |
| Runner pods | `EphemeralRunner` resource and a pod | Runner namespace | Runs exactly one job, then disappears |
Between the scale set and the runner pods sits one more resource, the EphemeralRunnerSet. It acts like a ReplicaSet for runners: it holds a desired replica count and creates that many EphemeralRunner objects.
Where each piece lives
Two Helm charts produce two sets of objects. Installing the controller chart creates the controller Deployment and the custom resource definitions. Installing the scale set chart creates one AutoscalingRunnerSet in the runner namespace, plus a service account, roles, and secrets that support it.
The listener pod runs in the controller namespace, not in the runner namespace. The controller creates it after it sees a new AutoscalingRunnerSet. Keeping it there separates the component that talks to GitHub from the pods that run untrusted workflow code.
flowchart TDThe diagram below shows the ownership chain among the resources.
Solid arrows show creation and ownership. The dashed arrow shows the listener changing the desired count on the EphemeralRunnerSet.
The life of one job
Follow a single job from push to cleanup.
- A workflow with
runs-on: <scale-set-name>is triggered. GitHub queues the job against that scale set. - The listener already has an open HTTPS long-poll connection to GitHub's message queue for that scale set. It receives a message saying a job is available, along with statistics such as the number of jobs assigned to the scale set.
- The listener computes a desired runner count and patches the
EphemeralRunnerSetreplicas field. - The
EphemeralRunnerSetcontroller creates newEphemeralRunnerobjects to reach that count. - For each
EphemeralRunner, the controller asks GitHub for a just-in-time (JIT) runner configuration. This is a one-use registration token bundle for a single runner. The controller stores it in a secret and creates a pod that mounts it. - The runner container starts and registers itself with the JIT configuration. GitHub hands the waiting job to it.
- The job runs. When it finishes, the runner process exits.
- The controller sees the exit, deletes the
EphemeralRunnerand its pod, and removes the runner from GitHub. The listener reports the job as completed and the count drops.
How the listener decides the count
The listener does not create pods. It only sets a number. In simplified form, the desired replica count is the minimum runners plus the number of jobs assigned to the scale set, capped at the maximum:
desired = min(maxRunners, minRunners + assignedJobs)Examples with minRunners: 1 and maxRunners: 5:
| Assigned jobs | Desired runners | Reason |
|---|---|---|
| 0 | 1 | The minimum keeps one idle runner warm |
| 3 | 4 | Minimum plus jobs |
| 10 | 5 | Capped at the maximum, the other jobs wait in the queue |
Treat the formula as a model, not a contract. The exact calculation is internal to the listener and can change between ARC versions. The chapter on scaling covers tuning these limits.
Why this design is pull-based
The listener makes only outbound HTTPS calls to GitHub. You do not expose a webhook endpoint or open any inbound port. Your cluster needs egress to GitHub's API and Actions service hosts, and that is all.
This also explains a failure property. GitHub holds the queue, so a job waits there if ARC is down or at its limit. When the listener reconnects, it sees the current statistics and corrects the count. No job is lost because a webhook was missed.
What each component does when it fails
- Controller down: no new resources are reconciled. The listener and existing runner pods keep running, and running jobs finish. Scaling changes and cleanup of finished runners stop until the controller returns.
- Listener pod down: the controller notices the missing pod and recreates it. During the gap, no replica changes are made, so queued jobs wait.
- Runner pod fails before registering: the
EphemeralRunnercontroller retries creation a limited number of times, then marks the runner failed. A failed runner does not run your job, so you see queued jobs that never start. - Config change on the scale set: changes such as a new
githubConfigUrlor secret cause the controller to tear down and recreate the listener. In-flight jobs on existing runner pods are not affected.
Inspecting the architecture on a live cluster
Once ARC is installed, you can see every layer with kubectl. These commands assume the namespaces arc-systems and arc-runners used in this tutorial.
# Controller and listener pods
kubectl get pods -n arc-systems
# Scale set definition and its listener
kubectl get autoscalingrunnersets.actions.github.com -n arc-runners
kubectl get autoscalinglisteners.actions.github.com -n arc-systems
# Runner set and the runners it currently owns
kubectl get ephemeralrunnersets.actions.github.com -n arc-runners
kubectl get ephemeralrunners.actions.github.com -n arc-runners
# Runner pods themselves
kubectl get pods -n arc-runnersWith minRunners: 0 and no jobs, expect the arc-systems namespace to show the controller pod and one listener pod, and the arc-runners namespace to show no pods. When a job queues, ephemeralrunners entries and runner pods appear. When the job finishes, they disappear again.
Common misunderstandings
- "The controller talks to GitHub to watch the queue." It talks to GitHub to create JIT configs and remove runners. The listener watches the queue.
- "Runner pods run in the controller namespace." They run in the namespace where you installed the scale set. The listener is the only per-scale-set pod in the controller namespace.
- "Idle runners are reused." Each runner takes one job and exits. With
minRunnersabove zero, the controller keeps fresh, unused runners waiting, not used ones. - "One controller means one pool." One controller can serve many scale sets, each with its own
AutoscalingRunnerSet, listener, and name. Workflows pick a pool by that name.
Exercise
A scale set has minRunners: 2 and maxRunners: 6. Five jobs are assigned to it. Using the simplified model, how many runners does the listener ask for, and which resource does it change? Also, in which namespace does the listener pod run?
Show answer
The desired count is min(6, 2 + 5) = 6, because 7 exceeds the maximum. The listener patches the replicas field of the EphemeralRunnerSet, which then creates EphemeralRunner objects and pods. The listener pod runs in the controller namespace (for example arc-systems), not in the runner namespace.
Exercise
The controller pod crashes while three jobs are running. What happens to those jobs, and what stops working until the controller recovers?
Show answer
The three jobs keep running, because the runner pods and the listener are separate pods that do not depend on the controller process for execution. While the controller is down, no new EphemeralRunner or pod is created, listener recreation and cleanup of finished runners pause, and config changes are not applied. Queued jobs wait in GitHub's queue until the controller returns.