Agent skill
helm-stuck-release-recovery
Fix Helm releases stuck in pending-upgrade, pending-rollback, or pending-install states. Use when: (1) terraform apply fails with "another operation (install/upgrade/rollback) is in progress", (2) helm history shows status "pending-upgrade" or "pending-rollback", (3) a Helm upgrade was interrupted by network timeout, etcd timeout, or VPN drop, (4) helm upgrade fails with "an error occurred while finding last successful release". Covers manual secret cleanup to restore Helm release to a deployable state.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/helm-stuck-release-recovery
SKILL.md
Helm Stuck Release Recovery
Problem
Helm releases can get stuck in pending-upgrade, pending-rollback, or pending-install
states when an upgrade is interrupted (network drop, etcd timeout, resource exhaustion).
Subsequent upgrades or terraform applies fail because Helm thinks an operation is in progress.
Context / Trigger Conditions
terraform applyfails with:another operation (install/upgrade/rollback) is in progresshelm history <release> -n <namespace>showspending-upgrade,pending-rollback, orpending-install- A previous Helm upgrade was interrupted by network timeout, VPN drop, or etcd timeout
helm upgradefails with:an error occurred while finding last successful release
Solution
Step 1: Identify the stuck release
helm --kubeconfig $(pwd)/config history <release> -n <namespace> | tail -5
Look for revisions with status pending-upgrade, pending-rollback, or pending-install.
Step 2: Delete the stuck Helm release secrets
Each Helm revision is stored as a Kubernetes secret named sh.helm.release.v1.<release>.v<revision>.
Delete all stuck revisions:
# Delete specific stuck revision (e.g., revision 5)
kubectl --kubeconfig $(pwd)/config delete secret sh.helm.release.v1.<release>.v5 -n <namespace>
# If multiple stuck revisions exist, delete all of them
kubectl --kubeconfig $(pwd)/config delete secret sh.helm.release.v1.<release>.v6 -n <namespace>
Step 3: Verify the release is clean
helm --kubeconfig $(pwd)/config history <release> -n <namespace> | tail -3
The latest revision should now show deployed status.
Step 4: Retry the upgrade
terraform apply -target=module.kubernetes_cluster.module.<service> -var="kube_config_path=$(pwd)/config" -auto-approve
Important Notes
- Never patch the secret labels (e.g., changing
status: pending-rollbacktostatus: failed). This changes the label but not the encoded release data inside the secret, leaving Helm in an inconsistent state. Always delete the stuck secrets entirely. - If the failed upgrade partially applied changes to the cluster (e.g., modified a Deployment), the next successful upgrade will reconcile the state.
- When VPN/network is unstable, prefer direct
helm upgrade --reuse-values --set key=valueoverterraform apply, since Helm upgrades are faster than the full Terraform refresh cycle.
Verification
After deleting stuck secrets and re-applying:
helm historyshows the new revision asdeployedterraform applycompletes without errors
Example
# Helm history shows stuck state
$ helm history nextcloud -n nextcloud | tail -3
4 deployed nextcloud-8.8.1 Upgrade complete
5 failed nextcloud-8.8.1 Upgrade failed: etcd timeout
6 pending-rollback nextcloud-8.8.1 Rollback to 4
# Fix: delete stuck revisions
$ kubectl delete secret sh.helm.release.v1.nextcloud.v5 sh.helm.release.v1.nextcloud.v6 -n nextcloud
# Verify clean state
$ helm history nextcloud -n nextcloud | tail -1
4 deployed nextcloud-8.8.1 Upgrade complete
# Re-apply
$ terraform apply -target=module.kubernetes_cluster.module.nextcloud -auto-approve
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?