#8353·k0s

Helm extension permanently stuck after a controller is terminated mid-upgrade: reconcile loops forever on "another operation (install/upgrade/rollback) is in progress"

Author: AlgeranCreated Sep 22, 2026Updated Sep 24, 2026

Before creating an issue, make sure you've checked the following:

  • You are running the latest released version of k0s
  • Make sure you've searched for existing issues, both open and closed
  • Make sure you've searched for PRs too, a fix might've been merged already
  • You're looking at docs for the released version, "main" branch docs are usually ahead of released versions.

Not on the latest release, so leaving the first box honest: this was hit on v1.35.4+k0s.0. The relevant code is byte-identical on the current releases, though — pkg/helm/helm.go:451 (upgrade.Atomic = true) and the reconcile branches below are the same on v1.35.8+k0s.1 and v1.36.4+k0s.1, and structurally unchanged on main (details under Additional context).

Closest existing issue I found is #8181, but that one is on the install path (failed to uninstall … before reinstall, a chart that never installed cleanly). This is the upgrade path with a pending release.

Platform

bash
linux/amd64
Amazon Linux 2023.12.20260918
kernel 6.18.48-109.150.amzn2023.x86_64
containerd://1.7.31

Version

v1.35.4+k0s.0

Sysinfo

`k0s sysinfo`

Not captured — the controller nodes this was observed on were replaced as part of the very
rolling update that triggered the bug, so there is no node left to run `k0s sysinfo` on.
Everything relevant is in the Chart status and Helm release history below.

What happened?

A controller node was replaced while the extensions controller was upgrading a Helm extension. The upgrade was cancelled, Helm's atomic rollback started, and that rollback was cancelled too when the next controller node was replaced. The release has been stuck ever since: reconcile retries and fails identically every time, and it does not recover on its own.

bash
$ kubectl get charts.helm.k0sproject.io -n kube-system k0s-addon-chart-aws-ebs-csi-driver \
    -o json | jq '{spec: .spec.version, status: .status.version, error: .status.error}'
{
  "spec": "2.64.0",
  "status": "2.62.0",
  "error": "can't reconcile upgrade for \"k0s-addon-chart-aws-ebs-csi-driver\": can't upgrade loadedChart `aws-ebs-csi-driver`: another operation (install/upgrade/rollback) is in progress"
}

Helm history for the release:

revision chart status
2 2.62.0 deployed
3 2.64.0 failed — Upgrade "aws-ebs-csi-driver" failed: context canceled
4 2.62.0 pending-rollback — Rollback to 2

The workload still runs the chart 2.62.0 images.

Steps to reproduce

  1. A k0s cluster with a Helm extension already installed (so chart.Status.ReleaseName is set).
  2. Change that extension's version in the k0s config so an upgrade starts.
  3. While helm upgrade is running, terminate the controller — SIGKILL the process, or replace the node.
  4. Bring the controller back.

Observed through k0smotron/CAPI replacing every control-plane machine during a rolling update, but any controller restart inside the upgrade window should be enough.

Expected behavior

A controller that owns these releases recovers from its own interrupted operation. Helm cannot do it by itself: it has no way to distinguish a genuinely in-flight operation from one whose process died.

Actual behavior

The Chart object stays on the old version indefinitely, with the same error on every reconcile.

Timeline from the incident (UTC):

14:57:08  helm upgrade to 2.64.0 fails, "context canceled"
14:57:53  first replacement controller node joins
14:58:57  atomic rollback starts, never finishes -> pending-rollback
14:59:41  second replacement controller node joins
15:01:31  third replacement controller node joins
15:24:39  reconcile retry, "another operation (install/upgrade/rollback) is in progress"
(next day)
05:52:08  same error, same pending-rollback revision, still stuck

Screenshots and logs

The Chart status and the Helm release history above are the whole evidence trail. Controller logs from the original node are gone with the node.

Additional context

Why it gets stuck, as far as I can follow it in the code (line numbers from v1.35.4+k0s.0):

  1. pkg/helm/helm.go:451 sets upgrade.Atomic = true. When the upgrade's context is cancelled, Helm starts an automatic rollback, creating revision 4 in pending-rollback. That rollback is cancelled as well, so the revision stays pending.

  2. Helm then refuses any further upgrade, in helm.sh/helm/v3/pkg/action/upgrade.go:

    go
    // finds the last non-deleted release with the given name
    lastRelease, err := u.cfg.Releases.Last(name)
    ...
    // Concurrent `helm upgrade`s will either fail here with `errPending` or when creating
    // the release with "already exists". This should act as a pessimistic lock.
    if lastRelease.Info.Status.IsPending() {
        return nil, nil, errPending
    }

    Releases.Last returns the highest revision, not the last deployed one, and IsPending() covers StatusPendingInstall, StatusPendingUpgrade and StatusPendingRollback.

  3. The upgrade path in pkg/component/controller/extensions_controller.go:523-540 never inspects the release status — it goes straight to UpgradeChart and wraps whatever comes back:

    go
    } else {
        if !cr.chartNeedsUpgrade(chart) {
            return nil
        }
        // update
        chartRelease, err = helmCmd.UpgradeChart(ctx, ...)
        if err != nil {
            err = fmt.Errorf("can't reconcile upgrade for %q: %w", chart.GetName(), err)
            return
        }
    }
  4. chartNeedsUpgrade (extensions_controller.go:632-638) returns true whenever chart.Status.Error != "", so the failure itself guarantees the next reconcile, and that reconcile hits errPending again.

The recovery logic that does exist, at extensions_controller.go:476:

go
case status == release.StatusPendingInstall, status == release.StatusFailed, status == release.StatusUninstalling:

is unreachable in this situation twice over: it sits inside if chart.Status.ReleaseName == "", which is only true before the first successful install, and it does not list StatusPendingUpgrade or StatusPendingRollback — those fall through to default: and return unsupported status %s in release version %d.

Current releases look the same. v1.35.8+k0s.1 and v1.36.4+k0s.1 both still have upgrade.Atomic = true at pkg/helm/helm.go:451, the same status list (StatusPendingInstall, StatusFailed, StatusUninstalling) and no status inspection on the upgrade path. On main the Helm v4 migration dropped Atomic, so a cancelled upgrade would leave pending-upgrade rather than pending-rollback — still a pending status, still the same lock — and the upgrade path (extensions_controller.go:559-573) and the status list (:511) are unchanged.

Suggested fix. On the upgrade path, inspect the release before calling UpgradeChart and treat a pending release left behind by k0s itself as recoverable: for StatusPendingUpgrade / StatusPendingRollback, roll back to the last deployed revision (or drop the pending one) and retry. Doing this once per Chart at controller startup would also work, since that is exactly the moment a previous operation is known to have died with the process. A dwell time, or a check that nothing else owns the operation, would avoid disturbing a release another process is legitimately working on.

Workaround. Delete the pending release secret; the next reconcile then succeeds, because Releases.Last returns the failed revision, which is not pending, and Helm resolves the current release through Releases.Deployed:

bash
$ kubectl -n kube-system delete secret sh.helm.release.v1.aws-ebs-csi-driver.v4