Kubernetes
Helm
Upgrade Issue
Troubleshooting
DevOps

Kubernetes Helm stuck with an update in progress

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Kubernetes Helm is an essential tool for managing Kubernetes applications, often referred to as the "package manager for Kubernetes." Helm simplifies many tasks involved with deploying and maintaining complex applications within Kubernetes clusters. However, users sometimes encounter an issue where Helm gets stuck with an "update in progress" status. In this article, we will delve into the technical reasons for this problem, offer solutions, and share preventive measures to improve overall Helm usage.

Understanding Helm Deployment Process

Before solving the "update in progress" issue, it's essential to understand how Helm manages deployments. When you issue a command like helm upgrade, Helm initiates a series of operations to update your deployment as specified in your Helm charts:

  1. Chart Fetching: The specified chart is fetched from either a local directory or a remote repository.
  2. Template Rendering: All templates within the chart are rendered into Kubernetes manifests.
  3. Resource Update: Kubernetes resources are updated with the newly rendered manifest data.
  4. Change Management: Helm tracks current and past states of releases to facilitate rollbacks or audit operations.

Common Causes of "Update in Progress"

1. Concurrent Operations

Helm maintains a release lock system to prevent simultaneous operations on the same chart. Concurrent operations on the same release can trigger an "update in progress" message. This might occur when an upgrade and a rollback or another upgrade operation are attempted at the same time.

2. Timeouts and Failures

Network latency or resource unavailability can cause timeouts during the operation. Helm might not gracefully recover from these failures, leaving an update in limbo.

3. Improper Rollback Mechanism

Understanding how Helm initiates rollbacks is crucial. Sometimes, automatic Helm rollbacks due to a failed upgrade can prematurely lock the release if not handled properly.

4. Release Data Corruption

Corruption or inconsistency in the release data stored in the backend storage, typically in Kubernetes Secrets or ConfigMaps, could lead to conflicts that leave updates in an unfinished state.

Technical Solutions

1. Investigate Helm History

Check the state of your releases using the Helm history command:

bash
helm history <release-name>

Identify if there are any failed updates or rollbacks and inspect their logs for more detailed error messages.

2. Unlock the Release

Sometimes manually unlocking the release might be necessary. Here’s a generalized way to check and alter the lock:

  1. Identify the ConfigMap:
bash
   kubectl get configmaps -n <namespace> | grep <release-name>
  1. Edit the relevant ConfigMap or Secret where Helm stores its operation states:
bash
   kubectl edit cm/sh.helm.release.v1.<release-name>.v<version> -n <namespace>
  1. Set the status field to desired state if Kubernetes side information appears to be incomplete or incorrect. This must be done cautiously.

3. Restoring Consistency

If unlocking manually does not resolve the issue, you may have to delete the last entry from the release history manually or force a redeployment:

bash
helm install --replace <release-name> <chart-repo> --version <version> --namespace <namespace>

4. Clear Helm Cache

Clearing Helm’s cache may resolve the corruption in client-side data:

bash
helm repo update

Preventive Measures

  • Implement CI/CD Pipelines: Use Continuous Integration/Continuous Deployment systems to serialize Helm operations and avoid concurrent accesses.
  • Increase Resource Limits: Evaluate and appropriately adjust timeouts and resource limits in both Helm and Kubernetes YAML files.
  • Use Helm Diff: Leverage plugins like Helm Diff to simulate and review changes before executing them.

Key Takeaways

Key ConsiderationExplanation/Utility
ConcurrencyAvoid concurrent Helm operations on the same release.
TimeoutsEnsure network and cluster are equipped to avoid timeouts.
Release LockingInvestigate and appropriately unlock Helm release locks.
Repository UpdatesRegularly update Helm charts and repositories to avoid stale data issues.
History & RollbacksMaintain awareness of Helm history and recent rollbacks for informed troubleshooting.

Additional Details

Troubleshooting Commands:

  • Check Helm version:
bash
  helm version
  • Validate Cluster Connection:
bash
  kubectl get nodes

Resource Configuration

YAML configurations often impact Helm’s execution:

yaml
1resources:
2  limits:
3    memory: "2048Mi"
4    cpu: "1"
5  requests:
6    memory: "1024Mi"
7    cpu: "0.5"

Adjust these as per the cluster’s capacity and application requirements.

By understanding both the mechanics of Helm and the context of common issues, users are better equipped to handle situations where updates are stuck, effectively leveraging Kubernetes' robust capabilities.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.