2026-10-20: Runner pods get "403 Access denied" from the gateway after a backend pod is replaced¶
Kind: reference (incident report)
Severity: critical · Status: resolved (Cilium 1.20.2 carries the upstream fix; the workaround is removed, task #1434) · Resolved by: a person, by replacing the runner pod each time; for good by the Cilium upgrade (#1594) and the operator agent (#1434) · Duration: not recorded (two faults, from 2026-10-20 ~19:52 and from 2026-10-21 16:50 UTC, each until the runner pod was replaced) · Taskbase task: #1428
Summary¶
Twice in two days the in-cluster runner emilia-container-agent (namespace agent-runners) got HTTP 403 with the body Access denied from the shared gateway's Envoy for a platform host. Both times this started right after that host's backend pod had been replaced: Gitea first, Keycloak the next day. Pods in other namespaces were not affected. Replacing the runner pod fixed it at once. The cause is a Cilium 1.18.4 bug: Envoy keeps a copy of the runner pod's egress policy, and Cilium does not refresh that copy when a backend pod gets a new security identity (cilium/cilium#46821, fixed in 1.18.12).
Impact¶
- Services: the in-cluster runner only. Case 1: every request to
gitea.prod.skatzi.comfrom the runner pod got the 403, including/api/healthz. Clones failed withremote: Access denied, and Gitea logged no request. Case 2: the runner's Keycloak password login got the 403 (keycloak login as emilia-container-agent: 403: no error detail), so the pod restart-looped 35 times and the runner went offline in Taskbase. - Users: tasks assigned to the runner did not run. Nobody was alerted; a person noticed that the runner was offline.
- Data: none.
- Duration: not recorded. The faults began at about 19:52 UTC on 2026-10-20 and at 16:50 UTC on 2026-10-21. Each lasted until the runner pod was replaced.
Timeline¶
All times UTC.
| Time | Event | Source |
|---|---|---|
| 10-20 ~19:52 | The Gitea backup gate scales Gitea 0 → 1. From then on the runner pod gets the 403 for gitea.prod.skatzi.com; the same URL works from tasks-prod |
task #1428 |
| 10-20, not recorded | A person replaces the runner pod; Gitea works again | task #1428 |
| 10-21 16:44 | The Keycloak CNPG migration (platform#546, task #1379) is merged | cc9ad02 |
| 10-21 16:50 | Keycloak gets a new pod keycloak-0. The runner's Keycloak login gets the 403, and the pod restart-loops |
task #1428 |
| 10-21, not recorded | A person replaces the runner pod; the runner comes back | task #1428 |
| 10-21 17:08 | Task #1428 filed | task #1428 |
Root cause¶
The 403 is the gateway checking the runner pod's own egress policy. For a client pod on the same node as the gateway's Envoy, Envoy's cilium.l7policy filter checks the pod's egress policy against the identity of the route's backend before it forwards the request. It answers 403 with the body Access denied when the check fails (cilium/proxy cilium/l7policy.cc, denied_403_body_ and the upstream branch of decodeHeaders; cilium/bpf_metadata.cc, "Enforce pod policy only for local pods"). That is why agent-runner-platform allows the backend pods (toEndpoints), and why pods with no egress policy, like those in tasks-prod, were never affected: for a pod without enforced egress policy, Envoy gets an allow-all policy (getDirectionNetworkPolicy in pkg/envoy/xds_server.go).
Envoy's copy lists numeric identities, so it goes stale. Cilium sends Envoy each pod's policy over NPDS. Each rule lists the identities its selector matches at that moment, and a rule that matches no identity is dropped (getPortNetworkPolicyRule, same file). When a selector later gains an identity, Cilium 1.18.4 refreshes the BPF policy map, but it re-sends the NPDS policy only if the endpoint has an Envoy redirect or is the ingress endpoint:
// pkg/endpoint/bpf.go, applyPolicyMapChangesLocked, v1.18.4
updateEnvoy = updateEnvoy || hasEnvoyRedirect || e.isIngress
(source). A runner pod has no Envoy redirect: its only L7 rule is DNS, which goes to the DNS proxy, not to Envoy. So when a backend pod comes back with a new identity, the gateway keeps checking the runner against the old identity list and refuses every request. This continues until the runner's policy is rebuilt from scratch, which happens when the runner pod is replaced. Restarting the backend again does not help, because the backend keeps its new identity.
Upstream fixed this in cilium/cilium#46821, "Always propagate proxy policy incremental updates when EnvoyConfig is enabled" (commit 40fae863fc). It adds option.Config.EnableEnvoyConfig to the condition, and the chart sets enable-envoy-config whenever gatewayAPI.enabled is true. It was backported to 1.17, 1.18 and 1.19; the 1.18 backport (a2c428c299) is in v1.18.12 and later, and not in v1.18.11 (GitHub compare of the commit against the tags). hetzner-mgmt runs chart 1.18.4 (components/cilium-config/helmrelease.yaml).
Why the backends got new identities. An identity is derived from a pod's labels. A replaced pod with the same labels reuses its identity, unless the operator has garbage-collected it in the meantime: an unused identity goes after 30 minutes (identity-heartbeat-timeout, default 2 × 15m, operator/identitygc/cell.go). This fits Gitea, which the backup gate had scaled to 0. For Keycloak, the record does not say whether the new pod's labels changed or whether the StatefulSet was at 0 long enough; see Open questions.
Ruled out from the source:
- The
egressDenyCIDR rules: CIDR selectors never match Cilium-managed pods, and the gateway's onward hop is checked against the backend's pod identity, not a CIDR identity. - Stale ipcache in Envoy: Envoy resolves the backend's identity from the BPF ipcache map, which Cilium updates for every new pod. The new identity is resolved correctly; it is the policy that lacks it.
What the agent did¶
- Read
components/agent-runner/namespace/andcluster/hetzner-mgmt/agent-runners/namespace/to establish the policy. - Tried
kubectlonhetzner-mgmt: no kubeconfig for that cluster on the runner's machine, so the Hubble andcilium-dbgevidence the task asks for could not be collected. - Read the code path in Cilium v1.18.4 and cilium/proxy (sources above), and found upstream PR #46821, which describes this bug.
- Pull request for task #1428:
- adds an empty HTTP rule (
http: [{}], which allows every request) to each backend rule inagent-runner-platform. This gives the runner pods an Envoy redirect, so 1.18.4 refreshes their Envoy policy on every identity change; - adds the
agent-runnersblackbox probe; - adds the new-identity check to
verify-network-policy.sh.
- adds an empty HTTP rule (
Resolution and verification¶
Mitigated in Git, not yet verified on the cluster. After the pull request is merged, someone with cluster access runs:
Its last section labels the Gitea pod (skatzi.com/netpol-check=<time>), which gives that pod a new identity, the same trigger as the incident, without restarting Gitea. It then expects https://gitea.prod.skatzi.com/api/healthz to keep answering from the debug pod, which was started before the label was set. It removes the label afterwards. Without the workaround on Cilium 1.18.4, this check should fail with the 403.
On 2026-10-25 hetzner-mgmt ran Cilium 1.20.2 (Helm revision 5, deployed; #1594 upgraded it through 1.18.16 and 1.19.10), with enable-envoy-config: "true" in cilium-config. The 1.20.2 source sends the proxy policy update whenever option.Config.EnableEnvoyConfig is set (pkg/endpoint/bpf.go, applyPolicyMapChangesLocked), so the fix is in. For task #1434 the operator agent then:
- ran
verify-network-policy.shwith the empty HTTP rules still in place:failures: 0(17/17, including the Gitea new-identity check); - ran the same checks from a throwaway pod selected only by temporary copies of
agent-runner-baselineand ofagent-runner-platformwithout the empty HTTP rules (labelsapp.kubernetes.io/name: netpol-nohttp,skatzi.com/temp: task-1434): againfailures: 0, with Gitea answeringHTTP 200after its pod got a new identity. It deleted the temporary policies and pod afterwards; - removed the empty HTTP rules from
agent-runner-platformin Git.
The 403 itself was never reproduced on the cluster: by the time someone had access, Cilium was already past 1.18.12.
Follow-ups¶
-
1434 — upgrade Cilium on
hetzner-mgmtto 1.18.12 or later, then remove the empty HTTP rules. Done: Cilium 1.20.2 (#1594), rules removed.¶ -
1435 — run
verify-network-policy.shonhetzner-mgmtafter the merge, and record the result here and on task #1428.¶ -
1332 (the ops-agent runner) lives in
agent-runnerstoo. Its pods are selected byagent-runner-platformas long as they carryapp.kubernetes.io/name: agent-runner, so the same backend rules cover them.¶
References¶
- Alert: none fired. From now on,
ProbeFailedwithcomponent="agent-runners"(ProbeFailed). - Taskbase incident task: #1428
- Runs: not recorded
- Pull requests: platform#546 (Keycloak CNPG migration, the trigger of case 2), and the pull request of task #1428
- Runbook sections: Runner pods get "403 Access denied" from the gateway
Open questions¶
- No Hubble flows or
cilium-dbgoutput were recorded during either fault, so the stale NPDS policy is established from the source code and the matching upstream fix, not observed on the cluster. - Whether the Keycloak pod of 2026-10-21 got a new identity through changed labels or through identity garbage collection.