Skip to content

2026-11-18: flux2 upgrade to 2.20.0 failed with "context canceled" while helm-controller replaced itself

Kind: reference (incident report)

Severity: warning · Status: resolved · Resolved by: helm-controller retry; checked by the operator agent (#3398), no action needed · Duration: 0:00:47 from detection to resolution, 19:10:47–19:11:34 UTC · Taskbase task: #3398

Summary

Merging the Flux upgrade from chart flux2 2.19.1 to 2.20.0 (Flux 2.9.5 → 2.10.0, #1558, task #3389) made helm-controller upgrade the release that runs helm-controller. The old pod was stopped while it was still applying the release, so Helm revision 10 failed with context canceled, and the error event became task #3398. The new helm-controller (v1.7.1) took the leader lease, upgraded again and deployed revision 11 on chart 2.20.0. No rollback ran, and the operator changed nothing on the cluster. This is the failure the ops runbook describes, and #1558's upgrade evidence predicted it.

Impact

  • Services: HelmRelease flux-system/flux2 was not Ready from 19:10:47 to 19:11:34. Helm reconciliation on hetzner-mgmt paused for about 11 s (19:10:46–19:10:57) while no helm-controller held the leader lease. The same upgrade also replaced kustomize-controller, and that cancelled the harbor-preupgrade health check: a separate incident, #3397 (report).
  • Users: none noticed.
  • Data: none. All 14 *.toolkit.fluxcd.io CRDs are Established. Alert and Provider now have storedVersions ["v1beta3","v1"], as #1558's pre-flight expected.
  • Duration: from the failed revision 10 (19:10:46) to Ready=True UpgradeSucceeded on revision 11 (19:11:34).

Timeline

All times UTC, 2026-11-18.

Time Event Source
19:10:04 #1558 (chore(deps): update helm release flux2 to v2.20.0) merged to main as ce536ba3 pull request
19:10:31 kustomize-controller applies the HelmRelease with version: 2.20.0 managedFields of HelmRelease flux2
19:10:34 Revision 10 (flux2-2.20.0) created by helm-controller v1.6.4 (pod helm-controller-67ccfcb554-8nv6b) helm history flux2
19:10:36 "checking resources for changes" (37 resources) Helm log in the task
19:10:38 New ReplicaSet helm-controller-7b66ddbc78 (v1.7.1). Its pod is scheduled on worker-1 at 19:10:39 events in flux-system
19:10:40 The source-controller, kustomize-controller and notification-controller Deployments roll too. The old source-controller pod is killed at 19:10:40 events in flux-system
19:10:46 Old pod helm-controller-67ccfcb554-8nv6b killed ("Stopping container manager"). The same second: "warning: upgrade failed", revision 10 failed: context canceled events, helm history flux2
19:10:47 Detected: UpgradeFailed event sent to Taskbase, task #3398 created Flux Alert taskbase-platform, task
19:10:55 HelmChart flux-system-flux2: NoSourceArtifact, because source-controller had just been replaced events
19:10:57 New pod helm-controller-7b66ddbc78-j5rpg becomes leader lease helm-controller-leader-election
19:11:01 HelmChart pulled again (flux2 2.20.0) events
19:11:29 New pod logs "release not observed to be made for object", then runs upgrade helm-controller log
19:11:30 Revision 11 (flux2-2.20.0, Flux 2.10.0) deployed helm history flux2
19:11:34 Resolved: UpgradeSucceeded, "release in-sync with desired state" events, helm-controller log
19:24:28 #1563 (task #3391, Taskbase Alerts and Provider to notification.toolkit.fluxcd.io/v1) merged as 7dcba4bc pull request
19:26–19:32 The operator run for #3398 watches the 7dcba4bc dependency wave: 54 Kustomizations wait on "dependency … is not ready" at 19:26:46, 0 at 19:32:29 flux get kustomizations -A --status-selector ready=false

Root cause

This one is the same as on 2026-10-25. The flux2 HelmRelease (components/flux/base/helmrelease.yaml) installs Flux's own controllers, so helm-controller applies every upgrade of it to itself. Chart 2.20.0 changes the helm-controller image (v1.6.4 → v1.7.1). Kubernetes starts the new pod and then stops the old one, and the old one is the process running the Helm upgrade. When it stops, its context is cancelled and Helm marks revision 10 failed. The old controller has already stopped, so it can't run upgrade.remediation. The new controller doesn't own the failed revision ("release not observed to be made for object"), so it upgrades again. Nothing is replaced on that attempt, so it succeeds.

Recovery took 47 s here, against 16 s on 2026-10-25. The upgrade also replaced source-controller, so the HelmChart had no artifact until 19:11:01, and helm-controller's next attempt came at 19:11:29.

It has now happened on every change to the helm-controller Deployment: 2026-07-02, 2026-10-25, twice on 2026-11-07 (counted in #1558's upgrade evidence; revision 8 is still in helm history), and now 2026-11-18. It is not a fault in chart 2.20.0.

What the agent did

Only read-only commands. No write to the cluster, no suspend, no rollback, no silence. The agent followed the runbook section flux2 self-upgrade fails with context canceled, branch It has recovered. All commands ran with --context admin@mgmt-cluster (--kube-context for helm).

  1. flux get helmreleases -n flux-system showed flux2 Ready: "Helm upgrade succeeded for release flux-system/flux2.v11 with chart flux2@2.20.0".
  2. helm -n flux-system history flux2 showed revision 10 failed ("context canceled") and revision 11 deployed, flux2-2.20.0, app 2.10.0. Revision 8 (2026-11-07, flux2-2.19.1) shows the same failure.
  3. flux get kustomizations -A --status-selector ready=false and flux get helmreleases -A --status-selector ready=false both came back empty at the first check.
  4. kubectl -n flux-system get hr flux2 -o jsonpath=… showed Ready=True UpgradeSucceeded and Released=True, with one history entry (version 11, deployed 19:11:30). The spec has version: 2.20.0, the same as main.
  5. kubectl -n flux-system get events (HelmRelease flux2, helm-controller, source-, kustomize- and notification-controller) gave the timeline above.
  6. kubectl -n flux-system logs deploy/helm-controller --since=30m showed "release not observed to be made for object", then "running 'upgrade' action with timeout of 10m0s", then "release in-sync with desired state".
  7. kubectl -n flux-system get lease helm-controller-leader-election showed the holder helm-controller-7b66ddbc78-j5rpg, acquired at 19:10:57. The pod has 0 restarts.
  8. kubectl -n flux-system get deploy and flux version showed all six controllers Ready on distribution flux-2.10.0: helm-controller v1.7.1, kustomize-controller v1.10.1, source-controller v1.10.1, notification-controller v1.10.0, image-* v1.3.0.
  9. flux check, plus Established and storedVersions of the 14 *.toolkit.fluxcd.io CRDs: "all checks passed", all Established. Alert and Provider are stored as ["v1beta3","v1"] with storage version v1. Everything else is v1, and HelmRelease is v2.
  10. Roll back or forward? The release is deployed on 2.20.0, the version in Git, so Git matches the cluster. A Helm rollback to revision 9 (flux2-2.19.1) is not possible: v1 is now in the storedVersions of Alert and Provider, and the 2.19.1 chart doesn't serve it. #1558's pre-flight says roll forward only. A rollback would also replace helm-controller again in the same way. Decision: keep the upgrade.
  11. A second check of flux get kustomizations -A --status-selector ready=false (19:26:46) listed 54 Kustomizations at ce536ba3. Each one waited on "dependency … is not ready" while its dependencies applied 7dcba4bc (#1563, merged 19:24:28). The agent checked the count every 30 s, and it went down every time: 54, 50, 47, 33, 28, 23, 19, 17, 16, 11, 1, then 0 at 19:32:29. That was the normal rollout of a new revision through dependsOn, not part of this incident, and the agent changed nothing.
  12. This report, plus the occurrence count in the runbook section and on the Flux page.

Resolution and verification

At 19:32 UTC, about 21 minutes after revision 11 deployed:

  • helm -n flux-system history flux2: revision 11 deployed, flux2-2.20.0.
  • flux get helmreleases -A --status-selector ready=false and flux get kustomizations -A --status-selector ready=false: both empty. Of the 75 Kustomizations, 67 have applied main@sha1:7dcba4bc. The other 8 come from other repositories (botyard-control, emiliero, helloweekly, taskbase), and all are Ready.
  • flux check: all checks passed. The Flux controllers have run 2.10.0 since 19:10 with 0 restarts.

1558's post-merge checks expected exactly this failure ("Expect the known context canceled self-upgrade"). The other checks on that list hold: all six controllers Ready on the new tags, flux check passes, and the Taskbase Alerts and Provider are Ready (now on v1, #1563).

Follow-ups

  • 3392 (#1566): raise the Terraform flux2 pins to 2.20.0.

  • 3399 (Gitea #1564): extend the runbook section to cover health checks that kustomize-controller's replacement cancels (from #3397).

  • 3400 (owner's decision): should this self-healing event keep opening a post-merge failure task, or should a Flux-readiness alert replace it? Decided: alert first (#3435), then mute the event (#3458).

References

  • Alert: Flux UpgradeFailed error event via Alert taskbase-platform (no Alertmanager alert)
  • Taskbase task: #3398, a follow-up of #3389
  • Pull requests: #1558 (the upgrade and its upgrade evidence), #1563, and this report's pull request
  • Runbook sections: flux2 self-upgrade fails with context canceled

Open questions

  • Every change to the helm-controller Deployment has raised this event, five times so far, and each one costs an operator run. Nothing else would report a flux2 release that stays stuck: there is no Prometheus alert on Flux readiness in components/. Muting the event therefore needs a replacement signal. That is the owner's decision, #3400. Decided 2026-11-18: add a Flux-readiness alert, then mute the event. #3435 adds the Prometheus alert FluxNotReady (flux2, the flux-system Kustomization or the root Kustomization Ready=False for 10 minutes, an incident; see the runbook section). Once it is live in Prometheus, #3458 excludes context canceled for flux2 from the Taskbase Alert. Closed by #3458: flux2 moved from taskbase-platform to its own Alert taskbase-platform-flux2 with exclusionList: ['context canceled'], so the next self-upgrade raises no task.