Sub topic 13
Operating the Fleet: Images, Updates, Logs, and Failure Modes
This chapter assumes you have read the earlier chapters on ephemeral runners, just-in-time (JIT) configuration, autoscaling, isolation, and OIDC. It assumes you can read GitHub Actions workflow syntax, use a Linux shell, and reason about containers or virtual machines. Here the focus shifts from building an ephemeral fleet to keeping it healthy over months.
An ephemeral fleet removes one class of problem, which is state left behind by earlier jobs. It adds another class: you now run an image pipeline, a provisioning service, and a stream of short-lived machines. Each of these can fail in its own way.
What you operate
A fleet has four moving parts. Each one needs an owner and a way to tell whether it is working.
| Part | Job | Typical failure |
|---|---|---|
| Runner image | Holds the OS, tools, and the runner application | Stale packages, missing tool, runner version too old |
| Provisioner | Creates a runner per queued job, for example with Actions Runner Controller (ARC) or your own service | Cannot reach the GitHub API, quota exhausted, bad credentials |
| Runner host | VM, container, or node that runs one job | Out of disk, out of memory, slow startup |
| Observability | Logs and metrics from all of the above | Logs lost when the host is destroyed |
Runner images
The image is the most important thing you control. Every job starts from it, so any flaw in it is repeated on every run.
Build images, do not patch hosts
With ephemeral runners there is no long-lived host to log into and fix. Change the image instead, then roll it out. Treat the image like application code:
- Keep its definition (a Dockerfile, Packer template, or similar) in version control.
- Build it in CI on a schedule, for example weekly, and on every change to the definition.
- Tag each build with an immutable identifier such as a date or commit SHA. Do not rely on a single moving
latesttag, because you cannot roll back to something you did not name. - Scan the finished image for known vulnerabilities before it is used.
Keep the image small and the secrets out
Smaller images start faster, and startup time is paid on every job. Install only the tools your workflows need. Do not bake credentials into the image. Anyone who can run a job can read the image's filesystem, so any secret in it is exposed to every workflow allowed on that runner.
Pre-cache what is slow
Because a runner never reuses a previous job's disk, caches such as package downloads or Docker layers start empty. You can pre-install common toolchains in the image, and use the actions/cache action or a registry mirror for the rest. Pre-installing trades image size for faster jobs, so measure both.
Example: a minimal image build
This Dockerfile builds a runner image for Linux x64. It downloads a specific runner release and leaves registration to the provisioner at start time. Set RUNNER_VERSION to a current release from the actions/runner releases page.
FROM ubuntu:22.04
ARG RUNNER_VERSION
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates curl git jq make sudo \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m runner \
&& mkdir /home/runner/actions-runner \
&& chown runner:runner /home/runner/actions-runner
USER runner
WORKDIR /home/runner/actions-runner
RUN curl -fsSL -o runner.tar.gz \
"https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz" \
&& tar xzf runner.tar.gz \
&& rm runner.tar.gz
USER root
RUN ./bin/installdependencies.sh
USER runner
ENTRYPOINT ["/bin/bash", "-c", "./run.sh --jitconfig \"$JITCONFIG\""]Build it with docker build --build-arg RUNNER_VERSION=<version> -t runner-image:2026-12-04 ., and pass the JIT configuration at start as the JITCONFIG environment variable.
Updates
Three things need updating: the runner application, the image contents, and the provisioning software.
The runner application
GitHub requires the runner application to stay reasonably current. If a runner is too old, GitHub can stop assigning jobs to it, and the job stays queued with no obvious error. Self-hosted runners normally update themselves in place, but for an ephemeral runner that is wasteful and can add startup delay. The better pattern is to bake a recent release into the image and rebuild the image often. Check the release notes when you adopt a new version, and confirm in the actions/runner documentation whether your setup needs the --disableupdate option, which is only safe if you promise to rebuild on time.
The image
Rebuild on a schedule, even when nothing in your definition changed. The base OS and the packages it pulls in change underneath you. A weekly rebuild keeps security fixes flowing. Roll out the new tag to a small label first, then promote it.
A simple scheme uses two labels, such as ephemeral-canary and ephemeral. Point a few low-risk repositories at the canary label for a few days. If jobs pass, move the main label to the new image.
The provisioner
If you use ARC, it is released separately and has its own upgrade notes, including changes to custom resource definitions. Read them before upgrading, and upgrade in a non-production cluster first. Custom provisioners need the same care. Pin dependency versions, and test the "request JIT config, start host, claim job" path end to end after each change.
Logs and observability
Two logs matter, and they live in different places.
- Job logs are shown in the GitHub UI for each workflow run. They are kept by GitHub for a retention period you can configure, and they survive when the runner is gone.
- Runner diagnostic logs are written by the runner application to its
_diagdirectory on the host. They explain why a runner failed to register, lost its connection, or crashed. They vanish when an ephemeral host is destroyed.
That second point is the main observability trap of ephemeral fleets. The evidence disappears with the machine. Ship _diag files, and the host's system logs, to a central store before teardown or continuously while the job runs.
What to measure
| Signal | Why it matters |
|---|---|
| Queue time (job created to job started) | The main user-facing measure of fleet health |
| Runner start time (provision to registered) | Shows image bloat or slow hosts |
| Runners created vs. runners that claimed a job | Idle or orphaned runners waste money |
| Provisioning errors and API rate-limit responses | Early warning of scaling trouble |
| Job failure rate by image tag | Detects a bad image after a rollout |
You can read queued and in-progress jobs from the API. This command lists recent workflow runs that are waiting, which helps you compare demand with the number of runners you have started.
gh api "/repos/OWNER/REPO/actions/runs?status=queued&per_page=50" \
--jq '.total_count, (.workflow_runs[] | [.id, .name, .created_at] | @tsv)'You can also list the runners GitHub currently knows about for a repository, with their status and labels.
gh api /repos/OWNER/REPO/actions/runners \
--jq '.runners[] | [.id, .name, .status, .busy, ([.labels[].name] | join(","))] | @tsv'If this list contains many offline runners, your fleet is leaving registrations behind. See the failure modes below.
Failure modes
The table gives the symptom first, because that is how you will meet each problem.
| Symptom | Likely cause | What to check |
|---|---|---|
| Jobs stay queued, no runners start | Provisioner cannot get a JIT config, or labels in `runs-on` do not match | Provisioner logs, API errors, exact label spelling |
| Jobs stay queued while runners are online | Runner group does not allow the repository, or the runner is busy or the labels differ | Runner group access settings, `busy` flag, label list |
| Runner starts but never takes a job | JIT config expired or already used, or another runner claimed the job | Time between creating the config and starting the host |
| Runner appears offline and stays listed | Host died before the runner could remove itself | Orphan cleanup job, host crash logs |
| Job dies mid-run with no output | Out of memory, out of disk, or host reclaimed (for example a spot instance) | Host metrics, cloud event history |
| Many jobs fail right after an image rollout | A tool is missing or changed in the new image | Failure rate by image tag, roll back the tag |
| Provisioning slows or fails during busy periods | API rate limits or cloud quota reached | Rate-limit headers, quota dashboard |
Orphaned registrations and hosts
A JIT or --ephemeral runner removes its own registration after one job. That only works if the runner exits cleanly. If the host is killed, the registration can remain in the list as offline, and the host might keep running and cost money. Run a periodic cleanup that does two things:
- Deletes offline runners older than some limit, using the runner delete API.
- Destroys hosts that have run longer than your maximum job time, which should match the workflow
timeout-minutesplus a margin.
Registration races and duplicate work
A fleet that creates runners in response to events can create more runners than there are jobs, because jobs may be cancelled or taken by other runners before yours starts. Those extra runners wait idle. Give every runner a start-to-exit time limit, so an unused one removes itself instead of lingering. Also name runners uniquely, for example with a timestamp or a random suffix, because JIT registration fails if the name is already in use in the same group.
Cancelled jobs and half-finished state
If a user cancels a workflow, the runner stops the job and, being ephemeral, is then removed. Do not rely on a final step to clean up. Steps that need cleanup should use if: always() or if: cancelled(), but you should assume that a crash or forced kill skips them. The design goal is that nothing important lives on the host, so losing it costs nothing.
Resource limits
Set CPU, memory, and disk limits on containers, and size VM disks for the worst workflow, not the average one. A disk-full runner can fail in confusing ways, such as a Git checkout that stops halfway. Also set a limit on how many runners can exist at once, so a burst of pull requests cannot exhaust your cloud quota or starve other teams.
Operating habits that pay off
- Keep one document that lists the image tags in use per label and who approves a promotion.
- Alert on queue time rather than on runner count. Users feel the former.
- Rehearse a rollback: point the label back at the previous image tag and confirm that jobs pass.
- Test the failure of the GitHub API on purpose, to see that the provisioner backs off and retries instead of creating runners in a tight loop.
- Review runner group access and workflow
permissionsblocks on a regular schedule, as part of the same review that checks images.
Putting it together
A healthy ephemeral fleet looks dull. Images are rebuilt weekly with immutable tags, rolled out through a canary label, and scanned. Each job gets a fresh host that receives a single-use JIT configuration. Logs leave the host before it is destroyed. A cleanup task removes orphans. Queue time is the number everyone watches, and when it rises, the table of failure modes tells you where to look first.
Exercise
After a Friday image rollout, about a third of jobs on the ephemeral label fail within seconds with "command not found: jq". Jobs on the ephemeral-canary label, which still uses the previous image, pass. Name the likely cause, the immediate fix, and one change to the process that would have caught this before it reached the main label.
Show answer
The new image no longer contains jq, for example because a package list or base image changed. The immediate fix is to point the ephemeral label back at the previous immutable image tag, which restores service at once. The process change is to run the canary stage with repositories that use jq (or a smoke-test workflow that checks every required tool) for a few days before promoting the new tag, and to add a tool-presence check to the image build so the build fails when jq is missing. The affected share was only a third because only some workflows call jq.
Exercise
An ephemeral fleet runs on spot instances. The GitHub runner list shows dozens of runners with status offline, and the cloud bill is higher than expected. Give two likely causes and the cleanup you would add.
Show answer
Spot instances can be reclaimed before the runner exits cleanly, so the runner never removes its own registration, which leaves offline entries. Hosts may also hang or miss their exit condition and keep running while idle. Add a periodic cleanup that deletes offline runners older than a set age through the runner delete API and destroys hosts that have lived longer than the job timeout plus a margin. Also give each runner a maximum idle lifetime so an unused one shuts down on its own.