Sub topic 1
Why Run Your Own GitHub Actions Runners?
Prerequisites
Assume you know GitHub Actions jobs, steps, and runs-on. You should also understand Kubernetes pods, namespaces, secrets, and basic Helm commands.
Why Run Your Own GitHub Actions Runners
A GitHub Actions runner executes a workflow job. GitHub-hosted runners are convenient, but self-hosted runners can provide private network access, custom tools, special hardware, or more control over operating costs.
A self-hosted runner is a machine or pod that you manage. It can contain organization-specific software and reach internal services that GitHub-hosted runners cannot access. You must manage its security, updates, capacity, and cleanup.
Ephemeral Runners: One Job, One Clean Environment
An ephemeral runner is created for one job and then removed. Each job starts with a clean filesystem and process space. This reduces the chance that build artifacts, credentials, or compromised dependencies remain available to a later job.
Long-lived runners are faster to reuse, but their state can accumulate. A failed cleanup step might leave files or processes behind. Ephemeral runners trade some startup time for isolation and predictable behavior.
Actions Runner Controller in Context
Actions Runner Controller (ARC) is a Kubernetes operator that manages GitHub Actions runners. It watches GitHub's job demand and creates runner pods in a Kubernetes cluster. Unlike a fixed runner fleet, ARC can add runners when jobs are queued and remove them when jobs finish.
ARC's current scale-set model groups equivalent ephemeral runners behind one workflow label.
How ARC Works: Controller, Scale Set, Listener, and Runner Pods
The controller reconciles Kubernetes resources with the desired runner state. An AutoscalingRunnerSet represents the scale set and its limits. A listener communicates with GitHub, observes queued work, and requests the required number of runners. Each runner pod registers with GitHub, executes one job, and is then deleted.
Giving ARC Access to GitHub
ARC needs permission to register runners and read job information. You can provide a personal access token (PAT) with the smallest suitable scope, or use a GitHub App for centrally managed, expiring credentials. Store the credential in a Kubernetes Secret and reference that Secret from the scale-set configuration. Do not place tokens in Helm command arguments, workflow files, or container images.
Exercise
Why is an ephemeral runner safer than a long-lived runner for unrelated jobs?
Show answer
It is deleted after one job, which removes leftover files, processes, and temporary credentials before another job runs.