Skip to content

A Failed EphemeralRunner keeps its scale set slot until someone deletes it, and a transient 403 is enough to cause it #4718

Open

Description

@JoaoManierii

Checks

Controller Version

0.13.1 (same code in 0.15.0 and on master at 5aed393)

Deployment Method

ArgoCD

Checks

  • This isn't a question or user support case (For Q&A and community support, go to Discussions).
  • I've read the Changelog before submitting this issue and I'm sure it's not due to any recently-introduced backward-incompatible changes

To Reproduce

1. Run a runner scale set (ours: GKE 1.35, controller 0.13.1, maxRunners 4).
2. Make one runner pod create fail with a 403 Forbidden whose message does not contain "exceeded quota:".
   Ours came from transient API server throttling (ENHANCE_YOUR_CALM), the same case as #4712.
   Any other Forbidden takes the same path, so a Pod Security Admission rejection should reproduce it on demand:
   label the runner namespace pod-security.kubernetes.io/enforce=restricted, queue one job, then remove the label.
   We have not tried this variant.
3. The EphemeralRunner goes to phase Failed, reason InvalidPod, with no pod.
4. Remove the cause. New runners are created normally, but the Failed one stays and counts as current:
   with N jobs assigned, the set runs N-1 runners and one job waits.
5. Delete the Failed EphemeralRunner by hand. The set creates the missing runner within seconds and the waiting job starts.

Describe the bug

#4712 covers why a transient 403 marks an EphemeralRunner Failed (the IsForbidden branch retries only exceeded quota:). This issue is about what the Failed runner does to the scale set afterwards. That part turned a few seconds of API throttling into hours of waiting jobs for us.

scaleTotal() counts failed runners as current capacity, and has done so since #3371:

func (s *ephemeralRunnersByState) scaleTotal() int {
return len(s.pending) + len(s.running) + len(s.failed)
}

The EphemeralRunnerSet reconciler compares that total with Spec.Replicas. While scaling it deletes only finished runners, and scale-down picks from pending and running. Failed runners are deleted only by cleanUpEphemeralRunners(), which runs when the set is being deleted, when its runner spec revision changes, or when the set is Outdated. So a Failed runner holds one slot until someone deletes it. Nothing reports it: the controller logs current equal to desired while no runner exists for the assigned job.

#3685 reported this and was closed after 0.12 started restarting failed pods with back-off. In #4258 the remaining Failed state was described as reserved for a wrong pod definition. A 403 from a throttled API server is not a wrong pod definition, but it takes that path.

What happened on our side (controller 0.13.1):

  • Between 2026-10-13 01:27Z and 2026-10-14 00:31Z, four runners in four scale sets failed with ENHANCE_YOUR_CALM. The pod template was fine and created pods before and after. Each runner stayed Failed until we deleted it by hand.
  • On the scale set with maxRunners 4, the runner failed at 00:31:21Z and we deleted it at 12:12:55Z, so it held the slot for about 11.7 hours. When a single job was assigned, the controller logged pending=0 running=0 failed=1 and then current=1 desired=1, and created no runner. That happened in 43 separate stretches, more than 2 hours in total.
  • At 11:50:30Z the listener asked for 0 runners and the controller logged Deleting ephemeral runners (scale down), but the Failed runner is not a scale-down candidate, so it stayed.
  • After the manual delete, the next assigned job got a runner within 2 seconds.

Full controller and listener logs for that window, with org, repository and workflow names redacted: https://gist.github.com/JoaoManierii/d241bfa31f6651152eb32b6cf091bb8b

Describe the expected behavior

A transient API error should not produce a Failed runner, and a Failed runner should not hold a slot indefinitely. In order of how much each would have helped us:

  1. Retry Forbidden errors that come from a failing backend (gRPC ResourceExhausted, Unavailable or DeadlineExceeded in the message) the way exceeded quota: is retried since Handle resource quota on status forbidden by retrying #4305: requeue after 30s while the runner is younger than 10 minutes, then delete it so the set re-creates it. Retry transient Forbidden errors on ephemeral runner pod creation #4711 implemented this with a test before its author closed it in favor of EphemeralRunner marked Failed (InvalidPod) on a transient 403 from a throttled API server, and keeps its runner slot #4712.
  2. Stop counting a Failed runner in scaleTotal() once it is older than a back-off (say 10 minutes). It can stay for inspection, and a broken spec would still fail, at a bounded rate.
  3. Record an event or a status field on the EphemeralRunnerSet while it counts Failed runners as current, so the lost capacity shows up without listing EphemeralRunners.

We can run a build with any of these in our cluster and report back, and we can send a PR for whichever approach a maintainer prefers.

Additional Context

# values.yaml: nothing relevant, this is controller behavior.
# Environment: GKE 1.35.6 with a zonal control plane. gha-runner-scale-set-controller 0.13.1,
# official chart, deployed with Argo CD.
#
# Workaround we run now: a CronJob every 5 minutes that deletes EphemeralRunners with
# status.phase == Failed older than 5 minutes in the runner namespaces
# (RBAC: get, list, delete on ephemeralrunners.actions.github.com).
#
# Where our throttling came from, in case it helps other GKE users:
# over two days the API server rejected 2,747 writes with ENHANCE_YOUR_CALM, from many clients
# (kube-scheduler, cloud-controller-manager, kubelet leases, this controller).
# The largest no-op writer was prometheus-operator 0.82. It watches every Opaque Secret, so each
# runner JIT config Secret that ARC creates and deletes triggered a full Prometheus and Alertmanager
# sync, 370-490 writes/min at peak. Excluding the runner namespaces with
# prometheusOperator.secretFieldSelector (metadata.namespace!=<runner namespace>) took that to 0.
# We have had no ENHANCE_YOUR_CALM and no Failed runners since 2026-10-14.

Controller Logs

# Full logs (org, repository and workflow names redacted):
# https://gist.github.com/JoaoManierii/d241bfa31f6651152eb32b6cf091bb8b
#   1-controller-pod-create-failures.log    the four pod-create failures, with stack traces
#   2-controller-secops-set-2026-10-14.log  every controller line for the maxRunners 4 set, 00:25Z to 12:20Z
#   3-listener-secops-set-2026-10-14.log    the listener of that set, same window

# Key lines (controller 0.13.1, stack traces removed).
# The four pod-create failures:
{"severity":"error","ts":"2026-10-13T01:27:17Z","logger":"EphemeralRunner","message":"Failed to create a pod due to unrecoverable failure","version":"0.13.1","ephemeralrunner":{"name":"arc-runner-agent-7xdrb-runner-xj8jn","namespace":"arc-runners"},"error":"pods \"arc-runner-agent-7xdrb-runner-xj8jn\" is forbidden: rpc error: code = ResourceExhausted desc = stream terminated by RST_STREAM with error code: ENHANCE_YOUR_CALM"}
{"severity":"error","ts":"2026-10-13T13:41:33Z","logger":"EphemeralRunner","message":"Failed to create a pod due to unrecoverable failure","version":"0.13.1","ephemeralrunner":{"name":"arc-runner-default-5spn6-runner-4cvh8","namespace":"arc-runners"},"error":"pods \"arc-runner-default-5spn6-runner-4cvh8\" is forbidden: rpc error: code = ResourceExhausted desc = stream terminated by RST_STREAM with error code: ENHANCE_YOUR_CALM"}
{"severity":"error","ts":"2026-10-13T17:25:12Z","logger":"EphemeralRunner","message":"Failed to create a pod due to unrecoverable failure","version":"0.13.1","ephemeralrunner":{"name":"arc-runner-qg-nj88d-runner-jfkrh","namespace":"arc-runners-privileged"},"error":"pods \"arc-runner-qg-nj88d-runner-jfkrh\" is forbidden: rpc error: code = ResourceExhausted desc = stream terminated by RST_STREAM with error code: ENHANCE_YOUR_CALM"}
{"severity":"error","ts":"2026-10-14T00:31:21Z","logger":"EphemeralRunner","message":"Failed to create a pod due to unrecoverable failure","version":"0.13.1","ephemeralrunner":{"name":"arc-runner-secops-97h4b-runner-8kjsn","namespace":"arc-runners"},"error":"pods \"arc-runner-secops-97h4b-runner-8kjsn\" is forbidden: rpc error: code = ResourceExhausted desc = stream terminated by RST_STREAM with error code: ENHANCE_YOUR_CALM"}

# The maxRunners 4 set right after its runner failed: a job is assigned and no runner is created
{"severity":"info","ts":"2026-10-14T00:32:11Z","logger":"EphemeralRunnerSet","message":"Ephemeral runner counts","version":"0.13.1","ephemeralrunnerset":{"name":"arc-runner-secops-97h4b","namespace":"arc-runners"},"pending":0,"running":0,"finished":0,"failed":1,"deleting":0}
{"severity":"info","ts":"2026-10-14T00:32:11Z","logger":"EphemeralRunnerSet","message":"Scaling comparison","version":"0.13.1","ephemeralrunnerset":{"name":"arc-runner-secops-97h4b","namespace":"arc-runners"},"current":1,"desired":1}

# Same set 11 hours later: the listener asks for 0, scale down runs, the Failed runner stays
{"severity":"info","ts":"2026-10-14T11:50:30Z","logger":"EphemeralRunnerSet","message":"Ephemeral runner counts","version":"0.13.1","ephemeralrunnerset":{"name":"arc-runner-secops-97h4b","namespace":"arc-runners"},"pending":0,"running":0,"finished":0,"failed":1,"deleting":0}
{"severity":"info","ts":"2026-10-14T11:50:30Z","logger":"EphemeralRunnerSet","message":"Scaling comparison","version":"0.13.1","ephemeralrunnerset":{"name":"arc-runner-secops-97h4b","namespace":"arc-runners"},"current":1,"desired":0}
{"severity":"info","ts":"2026-10-14T11:50:30Z","logger":"EphemeralRunnerSet","message":"Deleting ephemeral runners (scale down)","version":"0.13.1","ephemeralrunnerset":{"name":"arc-runner-secops-97h4b","namespace":"arc-runners"},"count":1}

# First job after the Failed runner was deleted by hand at 12:12:55Z: a runner is created right away
{"severity":"info","ts":"2026-10-14T12:14:39Z","logger":"EphemeralRunnerSet","message":"Ephemeral runner counts","version":"0.13.1","ephemeralrunnerset":{"name":"arc-runner-secops-97h4b","namespace":"arc-runners"},"pending":0,"running":0,"finished":0,"failed":0,"deleting":0}
{"severity":"info","ts":"2026-10-14T12:14:39Z","logger":"EphemeralRunnerSet","message":"Scaling comparison","version":"0.13.1","ephemeralrunnerset":{"name":"arc-runner-secops-97h4b","namespace":"arc-runners"},"current":0,"desired":1}
{"severity":"info","ts":"2026-10-14T12:14:39Z","logger":"EphemeralRunnerSet","message":"Creating new ephemeral runners (scale up)","version":"0.13.1","ephemeralrunnerset":{"name":"arc-runner-secops-97h4b","namespace":"arc-runners"},"count":1}

Runner Pod Logs

# No runner pod was created, so there are no pod logs. Controller and listener logs are in the gist above.
# Each EphemeralRunner had phase Failed, reason InvalidPod, and status.message
# "Failed to create the pod: <error from the controller log above>" until we deleted it.

Activity

  1. added
    bug
    needs triage
    gha-runner-scale-set
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggha-runner-scale-setneeds triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions