How to Fix helm “has no deployed releases” Error

Introduction

In Helm, the helm upgrade [release-name] [chart] command lets you upgrade your release to a new version. However, attempting to upgrade your release can sometimes produce the  “helm has no deployed releases” error.

In this tutorial, we will cover the causes of the “helm has no deployed releases” error as well as several potential solutions.

How to fix "helm has no deployed releases" error

Prerequisites

What Causes the “helm has no deployed releases” Error?

As of Helm 2.7.1, running the helm upgrade [release-name] [chart] command on a previously failed release produces the following error:

Error: UPGRADE FAILED: [release-name] has no deployed releases
"No deployed releases" error in terminal.

Helm 2 compares the current deployment manifest with the new one to apply the necessary patches. It does not, however, compare the state of the resources between the manifests.

If a previous deployment failed, it is likely that the cluster has some missing resources. Prior to Helm 2.7.1, Helm will try to upgrade the deployment without installing the missing resources. To prevent this, as of version 2.7.1, Helm uses the latest successful deployment as the baseline for the upgrade. If there is no successful deployment to be found, the system returns the “helm has no deployed releases” error message.

Fixing the “helm has no deployed releases” Error

There are several ways to fix the “helm has no deployed releases” error, most of them focusing on changing the status of the failed deployment causing the issue:

Solution 1: Changing the Deployment Status

In Helm 2, changing the release status to deployed lets you bypass the issue:

kubectl -n kube-system patch configmap [release name].[release version] --type=merge -p '{"metadata":{"labels":{"STATUS":"DEPLOYED"}}}'

Where:

  • [release name] is the name of the release you want to update.
  • [release version] is the current version of your release.

Note: Keep in mind that the solution above only serves to bypass the issue. You still need to make manual adjustments to add the missing resources.

Since Helm 3 stores the deployment history as Kubernetes secrets. Check the deployment secrets:

kubectl get secrets

Find the secret referring to the failed deployment, then use the following command to change the deployment status:

kubectl patch secret [name-of-secret-related-to-deployment] --type=merge -p '{"metadata":{"labels":{"status":"deployed"}}}'

Solution 2: Cleaning Up Failed Deployments

Deleting the current release and starting a new one from scratch fixes the issue. To do this with Helm 2, use:

helm delete --purge [release name]

Where:

  • [release name]is the name of the release you want to delete.
Deleting a Helm release

As of Helm 3, deleting a release requires the uninstall command:

helm uninstall [release name]
Uninstalling a Helm 3 release

1. Another way to remove a failed release is to first check the status of your deployment:

helm list -a

2. If the status of your release is not deployed, check the deployment secrets:

kubectl get secrets

3. Describe the last item on the secrets list to check its status:

kubectl describe secret [secret name]

Where:

  • [secret name] is the name of the secret you want to check.

4. If the secret has the same status as the failed deployment, delete it by using:

kubectl delete secret [secret name]

5. Upgrade your release with:

helm upgrade [release name]

Solution 3: Forcing an Upgrade

Another way to solve the issue is to force an upgrade by using:

helm upgrade [release name] --force

Where:

  • [release name] is the name of the release you want to upgrade.

Behind the scenes, this does a similar job to helm delete --purge, deleting the previous release before installing a new one. This can lead to loss of service, making it unsuitable for certain releases.

Conclusion

After following this tutorial, you should be able to upgrade your release to a new version without receiving the “helm has no deployed releases” error.

原创文章,作者:306829225,如若转载,请注明出处:https://blog.ytso.com/223936.html

(0)
上一篇 2022年1月7日
下一篇 2022年1月7日

相关推荐

发表回复

登录后才能评论