Skip to content

2026-10-25: flux2 upgrade to 2.19.1 failed with "context canceled" while helm-controller replaced itself

Kind: reference (incident report)

Severity: warning · Status: resolved · Resolved by: operator agent (no action needed; helm-controller retried on its own) · Duration: ~0:00:19 from detection to resolution, 13:36:24–13:36:43 UTC · Taskbase task: #1617

Summary

Merging the Flux upgrade from chart flux2 2.18.2 to 2.19.1 (Flux 2.8.3 → 2.9.5, #756, task #1583) made helm-controller upgrade the release that runs helm-controller. The upgrade replaced helm-controller's own Deployment. The old pod was stopped while it was still applying the release, so Helm revision 4 failed with context canceled, and the error event became task #1617. The new helm-controller pod took the leader lease 15 s later, upgraded again and deployed revision 5 on chart 2.19.1. No rollback ran, and the operator changed nothing on the cluster.

Impact

  • Services: HelmRelease flux-system/flux2 was not Ready from 13:36:24 to 13:36:40. Helm reconciliation on hetzner-mgmt paused for about 15 s while no helm-controller held the leader lease. Every Kustomization and every other HelmRelease stayed Ready.
  • Users: none noticed.
  • Data: none. The Flux CRDs kept their storedVersions. All 14 are Established.
  • Duration: from the failed revision 4 (13:36:24) to the deployed revision 5 (13:36:40, in sync at 13:36:43).

Timeline

All times UTC, 2026-10-25.

Time Event Source
13:34:15 #756 (chore(deps): update helm release flux2 to v2.19.1) merged to main merge commit 76a535c
13:36:10 helm-controller (v1.5.3, pod helm-controller-5d6f5c7df5-zsxj8) starts the upgrade to flux2@2.19.1 Helm log in the task
13:36:11 Revision 4 (flux2-2.19.1) created helm history flux2
13:36:13 "checking resources for changes" (37 resources) Helm log in the task
13:36:15 New ReplicaSet helm-controller-6444fb5679 (v1.6.4) and pod helm-controller-6444fb5679-n92lv created events in flux-system
13:36:24 Old pod helm-controller-5d6f5c7df5-zsxj8 killed ("Stopping container manager"). The same second: "warning: upgrade failed", revision 4 failed: context canceled events, helm history flux2
13:36:24 Detected: UpgradeFailed event sent to Taskbase, task #1617 created at 13:36:25 Flux Alert taskbase-platform, task
13:36:39 New pod becomes leader. It reads revision 4 as "release not observed to be made for object" and runs upgrade again lease helm-controller-leader-election, helm-controller log
13:36:40 Revision 5 (flux2-2.19.1, Flux 2.9.5) deployed helm history flux2
13:36:43 Resolved: "release in-sync with desired state", Ready=True UpgradeSucceeded helm-controller log, HelmRelease status
13:58–14:05 Operator run for #1617: read-only checks only (below) this report

Root cause

The flux2 HelmRelease (components/flux/base/helmrelease.yaml) installs Flux's own controllers, so helm-controller applies every upgrade of it to itself (Flux: safe change workflow). Chart 2.19.1 changes the helm-controller image (v1.5.3 → v1.6.4), so Helm updates the helm-controller Deployment during the upgrade. Kubernetes starts the new pod and then stops the old one. The old pod is the process running the Helm upgrade. When it stops, its context is canceled and the remaining Helm steps abort with context canceled. Helm marks the revision failed.

The old controller can't run its upgrade.remediation rollback because it has already stopped. The new controller doesn't see the failed revision as one it made ("release not observed to be made for object"). So it upgrades again, and nothing is being replaced this time, so that attempt succeeds. The same thing happened on 2026-07-02: revision 2 (flux2-2.18.2) failed with context canceled, and revision 3 succeeded 32 s later (helm history flux2). The upgrade evidence on #756 had named this as the self-upgrade hazard.

So any flux2 upgrade that changes the helm-controller Deployment can raise this event. It is not a fault in chart 2.19.1.

What the agent did

Only read-only commands. No write to the cluster, no suspend, no rollback, no silence. The ops runbook's triage order was followed, and the generic Flux freeze section was not needed: the release was already deployed and nothing was frozen.

  1. flux get helmreleases -A — flux2 Ready: "Helm upgrade succeeded for release flux-system/flux2.v5 with chart flux2@2.19.1". Every other HelmRelease was Ready too.
  2. helm -n flux-system history flux2 --max 10 — revision 4 failed ("context canceled"), revision 5 deployed, flux2-2.19.1, app 2.9.5. Revision 2 on 2026-07-02 shows the same failure.
  3. flux get kustomizations -A --status-selector ready=false and flux get helmreleases -A --status-selector ready=false — nothing listed. All 66 Kustomizations are Ready. flux-system has applied main@sha1:c9a50147, which is the tip of main.
  4. kubectl -n flux-system get hr flux2 -o jsonpath=… — Ready=True UpgradeSucceeded, Released=True, history has one entry (version 5, deployed 13:36:40).
  5. kubectl -n flux-system get events (HelmRelease flux2 and helm-controller objects) — the timeline above: new ReplicaSet at 13:36:15, old pod killed at 13:36:24, leader election at 13:36:39.
  6. kubectl -n flux-system logs deploy/helm-controller --since=40m — the new pod's "release not observed to be made for object", then "running 'upgrade' action", then "release in-sync with desired state".
  7. kubectl -n flux-system get pods, flux version — six controllers Running with 0 restarts. The distribution is flux-2.9.5 (helm-controller v1.6.4, kustomize-controller v1.9.5, source-controller v1.9.5, notification-controller v1.9.4, image-* v1.2.5).
  8. flux check and the Established condition and storedVersions of the 14 *.toolkit.fluxcd.io CRDs — "all checks passed". All are Established. The stored versions are the same as in the #756 pre-flight (v1, v2 for HelmRelease, v1beta3 for Alert and Provider).
  9. Rollback or forward: the release is already deployed on 2.19.1, the version in Git, so Git matches the cluster. A Helm rollback to revision 3 (flux2-2.18.2) would still be valid (pre-flight on #756: rollback goes both ways). It isn't needed, though, and it would replace helm-controller again in the same way. So the decision is to keep the upgrade as it is.
  10. This report, and a note in Flux: safe change workflow on how to tell this transient failure from a stuck one.

Resolution and verification

At 14:05 UTC, about 29 minutes after revision 5 deployed:

  • helm -n flux-system history flux2: revision 5 deployed, flux2-2.19.1.
  • flux get helmreleases -A --status-selector ready=false and flux get kustomizations -A --status-selector ready=false: empty.
  • flux check: all checks passed. The Flux controllers have run 2.9.5 since 13:36 with 0 restarts.

The post-merge checks in #756's review expected revision 4. Because of the retry, the release is at revision 5. Everything else on that list holds.

Follow-ups

  • 1621: add a section to the ops runbook on the flux2 self-upgrade context canceled failure, covering what to check and when it needs action (technical-writer).

References

  • Alert: Flux UpgradeFailed error event via Alert taskbase-platform (no Alertmanager alert)
  • Taskbase task: #1617, a follow-up of #1583
  • Pull requests: #756 (the upgrade and its upgrade evidence), and this report's pull request
  • Runbook sections: Triage order, Generic Flux freeze (checked, not needed)

Open questions

  • Every flux2 upgrade that changes helm-controller is likely to raise this event and a post-merge failure task, even though it heals within a minute. That happened twice out of two times (2026-07-02 and 2026-10-25). Should the Flux Alert, or Taskbase, wait to see whether the release recovers before opening a task? That is a change to failure reporting, and it is left to the owner.
  • Why didn't Kubernetes keep the old pod until the new one was Ready? The Deployment rolls out with maxSurge: 25%/maxUnavailable: 25% and terminationGracePeriodSeconds: 600, and the events show "Killing" and the new pod's first failed readiness probe in the same second. The record doesn't settle whether the pod could have finished the Helm upgrade during graceful shutdown.