2026-11-04: GitHub push mirror run failed on a 401 while Gitea's database was down¶
Kind: reference (incident report)
Severity: warning · Status: resolved · Resolved by: operator agent · Duration: 0:55 from detection to resolution, 17:45–18:40 UTC (fault from 17:30 UTC) · Taskbase task: #2500
Summary¶
During the worker-3 stall of the same afternoon, Gitea kept
running but could not reach its database. The push mirror CronJob's 17:30 run,
gitea/github-push-mirror-29896890, called Gitea four seconds before the database was back. Gitea could
not look up the token and answered 401 Unauthorized, so the Job failed. The next runs succeeded, but
the failed Job stayed and kept KubeJobFailed firing until the operator deleted it.
Impact¶
- Services: one run of the push mirror reconciler (
components/gitea/push-mirror) failed. The GitHub push mirror itself was not affected: the runs from 17:45 on found it healthy, last updated at 18:27:14. - Users: none noticed; the alert is a warning.
- Data: none.
- Duration: the Job failed at 17:30:05.
KubeJobFailedfired from 17:45:33 and was resolved at 18:40:25, when Prometheus had nokube_job_failedseries for the Job and Alertmanager had noKubeJobFailedalert.
Timeline¶
All times UTC, 2026-11-04.
| Time | Event | Source |
|---|---|---|
| 17:17:17 | Gitea logs its first database error; worker-3, which runs gitea-postgresql-0, has stopped answering (#2490) |
worker-3 report |
| 17:22:57 | gitea-postgresql-0 is recreated on worker-1 and waits for its volume |
pod creationTimestamp |
| 17:29:59 | gitea-postgresql-0 container started |
pod containerStatuses |
| 17:30:00 | CronJob creates github-push-mirror-29896890 (pod on worker-3) |
Job annotation cronjob-scheduled-timestamp |
| 17:30:01–02 | Gitea: userFromToken: dial tcp 10.111.180.68:5432: connect: connection refused, then GET /api/v1/repos/Skatzi/platform/push_mirrors?limit=50 … 401 Unauthorized |
Gitea log |
| 17:30:02 | Job pod exits 1 with urllib.error.HTTPError: HTTP Error 401: Unauthorized |
pod log, containerStatuses |
| 17:30:05 | Job fails: BackoffLimitExceeded (backoffLimit: 0) |
Job status.conditions |
| 17:30:06 | Gitea's last database error, connection refused |
Gitea log |
| 17:30:09 | gitea-postgresql-0 Ready |
pod conditions |
| 17:45:02 | Next run's GET …/push_mirrors answers 200 OK; also at 18:00:05, 18:15:02 and 18:30:02 |
Gitea log |
| 17:45:33 | Detected: KubeJobFailed (job_name=github-push-mirror-29896890, fingerprint a14ffa663ecb3f23) starts firing |
Alertmanager |
| 17:46:34 | Taskbase incident #2500 created | Taskbase |
| ~18:38 | operator agent confirms the alert is active and not silenced, and finds the cause (What the agent did) |
this report |
| 18:39:41 | Operator deletes the failed Job | kubectl delete job |
| 18:40:25 | Resolved: no kube_job_failed series for the Job, and Alertmanager has no KubeJobFailed alert |
Prometheus and Alertmanager API |
Root cause¶
When worker-3 stalled (#2490), the taint manager evicted gitea-postgresql-0. Its replacement on worker-1
waited for the Hetzner volume until 17:29:32 and was Ready at 17:30:09. Gitea itself ran on worker-2 the
whole time, so its Service had a backend, but every request that needs the database failed. For a token
request that failure is a 401. Gitea's OAuth2.Verify cannot read the token
(userFromToken: … connection refused), and apiAuth treats the request as unauthenticated.
The push mirror reconciler (components/gitea/push-mirror/reconcile-push-mirror.py) already waits up to
GITEA_WAIT_SECONDS while Gitea cannot be reached, a retry added after the
2026-10-25 incident (#1591). That retry
covers only URLError, a connection that fails. An HTTPError is re-raised at once, so that a wrong
token fails the run. A database outage behind a running Gitea looks like a wrong token, and the run
failed on its first call (backoffLimit: 0).
The CronJob keeps failed Jobs (failedJobsHistoryLimit: 3, ttlSecondsAfterFinished: 86400), and a later
success does not remove them, so KubeJobFailed would have fired for up to 24 hours. The window comes
back whenever Gitea's database is down while Gitea is up, for example a worker stall like #2490 or a
PostgreSQL restart. #2507 makes the reconciler wait through it.
What the agent did¶
The agent followed the ops runbook section KubeJobFailed for a Job that Flux applies,
case CronJob-created Jobs,
"a one-off window that is already over".
kubectl -n monitoring port-forward svc/alertmanager-operated 19093:9093, thencurl -sG .../api/v2/alerts --data-urlencode 'filter=alertname="KubeJobFailed"': one alert,active, forgitea/github-push-mirror-29896890, with nosilencedByorinhibitedBy./api/v2/silenceshad no active silence.kubectl -n gitea get jobs,cronjobsanddescribe job: the Job isFailed 0/1and is owned byCronJob/github-push-mirror. The 18:30 rungithub-push-mirror-29896950isComplete 1/1.kubectl -n gitea logs github-push-mirror-29896890-nlmqn: the firstGET /push_mirrorsfailed withHTTPError: HTTP Error 401: Unauthorized. The Job'sstatus.conditionsshowBackoffLimitExceededat 17:30:05.kubectl -n gitea get externalsecret:github-mirror-tokenisSecretSynced, and the Secret was last written on 2026-10-21, so the token had not changed. Later runs with the same token succeeded.kubectl -n gitea logs gitea-645cd4459d-dnjb7 --since-time=…: databaseconnection refusederrors from 17:17:34 to 17:30:06 (the first database error, ani/o timeoutat 17:17:17, is in the worker-3 report), and at 17:30:01–02userFromToken: … connection refusedfollowed by the401for the Job's request.kubectl -n gitea get pod gitea-postgresql-0: created 17:22:57, started 17:29:59, Ready 17:30:09. The cause is the #2490 database outage, which was over.kubectl -n gitea get cronjob github-push-mirror:lastSuccessfulTime18:30:05, later than the failure. Gitea's log shows200 OKforpush_mirrorsat 17:45, 18:00, 18:15 and 18:30, and the 18:30 run logs "push mirror … is healthy, last update 2026-11-04T18:27:14Z".flux get kustomizations -Aandflux get helmreleases -Awith--status-selector ready=falselisted nothing, andhttps://gitea.prod.skatzi.com/api/healthzreturned 200.- Write:
kubectl -n gitea delete job github-push-mirror-29896890at 18:39:41. Exit 0. The Job and itsErrorpod are gone, and the Job mounted only its script ConfigMap, so it held no data. - Polled Prometheus (
kube_job_failed{namespace="gitea",job_name="github-push-mirror-29896890"} > 0) and Alertmanager every 30 s: no series and noKubeJobFailedalert at 18:40:25. - Created follow-up #2507 and opened this report's pull request.
No Git change was needed to fix the cause, no Kustomization or HelmRelease was suspended or reconciled, and no silence was set.
Resolution and verification¶
- Alertmanager:
/api/v2/alerts?filter=alertname="KubeJobFailed"returns[], and there is noGiteaPushMirrorFailingalert. The only active alert isWatchdog. - Prometheus:
kube_job_failed{namespace="gitea",job_name="github-push-mirror-29896890"} > 0returns no series. flux get kustomizations -A --status-selector ready=falseandflux get helmreleases -A --status-selector ready=falselist nothing.helm -n gitea history gitea: revision 7 isdeployed, chartgitea-12.7.0.deployment/giteaandstatefulset/gitea-postgresqlare 1/1 Ready.
Follow-ups¶
-
2507 — when the first API call gets a 401 or 5xx and Gitea's
within/api/healthzis not healthy, retry it¶GITEA_WAIT_SECONDS; a wrong token with a healthy Gitea still fails the run. -
2498 (from #2490) — the act runner memory overcommit that stalled worker-3.¶
-
2540 — not part of this incident: at 18:42:48, after this one was resolved, seven pod sandboxes on¶
worker-2 were killed and recreated. Gitea answered 503 until 18:44:46, and Flux was Ready again at 18:47:53. The agent saw this while checking the state after its fix and changed nothing. #2540's report points to Talos's OOM controller, during an agent run; that is not confirmed until #2546 reads the node's logs.
References¶
- Alert:
KubeJobFailed,gitea/github-push-mirror-29896890on hetzner-mgmt; runbook - Taskbase incident task: #2500 (the database outage: #2490)
- Runs: the
operatorrun of #2500 on 2026-11-04 - Pull requests: this report's pull request
- Runbook sections:
KubeJobFailedfor a Job that Flux applies: CronJob-created Jobs
Open questions¶
none