helm: helm install --replace fails with "cannot re-use a name that is still in use"
Hi, I try to idempotently deploy a package with:
helm install --replace --tiller-namespace=system --namespace=system -n somepackage
(I use the system namespace, and tiller is deployed into it, so no mistake there), but the second time it fails with
"Error: cannot re-use a name that is still in use"
The first install runs flawless, it’s the subsequent ones that fail. I am using helm version:
Client: &version.Version{SemVer:"v2.7.0-rc1", GitCommit:"1eff362941a349ab577c356f037ee093b23767a7", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.7.0-rc1", GitCommit:"1eff362941a349ab577c356f037ee093b23767a7", GitTreeState:"clean"}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 29
- Comments: 48 (9 by maintainers)
Commits related to this issue
- #3134 Document how to update a deployment idempotently To use the same command when installing and upgrading a release, using helm upgrade with --install works. — committed to splisson-altair/helm by splisson-altair 7 years ago
- #3134 Document how to update a release idempotently To use the same command when installing and upgrading a release, using helm upgrade with --install works. — committed to splisson-altair/helm by splisson-altair 7 years ago
- docs(helm): Document how to update a release idempotently To use the same command when installing and upgrading a release, using helm upgrade with '--install' works. Closes #3134 — committed to splisson/helm by splisson 7 years ago
- docs(helm): Document how to update a release idempotently (#3148) * docs(helm): Document how to update a release idempotently To use the same command when installing and upgrading a release, using... — committed to helm/helm by splisson 7 years ago
- When checking for "name reuse", consider SUPERSEDED deploys as valid. Relates to #3134, but does not fix the underlying cause of releases ended up stuck in SUPERSEDED. Also cleans up the boolean logi... — committed to atombender/helm by atombender 6 years ago
workaround: helm upgrade --install
I strongly recommend running all charts through
helm templateand then taking the output throughkubectl apply --dry-run, which acts as a linter. This is how I discovered the problem; we have an internal tool that wraps Helm and does this automatically now.@technosophos Any progress on this? It’s hitting us in production, where we can’t just
helm del --purgestuff that in use, like statefulsets that need to be carefully managed.I did notice that when the problem happens, it seems that every upgrade has been
SUPERSEDED, except the last one, which wasDEPLOYED, e.g.:I don’t understand why they would differ in status. These have all been done with
helm upgrade --install.I’m getting this on a lot of deploys now. Until this is fixed, is there a temporary workaround aside from
helm delete --purge?Another workaround is to delete the corresponding namespace and then create a new one. For example deleting the namespace
kuberhealthy:I’ve noticed a couple of times now that the error shows up if I have something invalid (e.g. reference to a variable that has a typo) in the chart, and goes away if I fix the error. It looks a lot like Helm is masking the underlying linting error, and emitting the
cannot re-useerror instead. I didn’t realize this earlier because the workflow was using did not lint the charts before runninghelm.helm install --replace worked for me
I keep running into this issue.
helm upgrade --installworks for me, but actually I need to usehelm install --replace, because I want to fully reset my installations for review environments.I read a lot of comments that this error really just hides a template issue, but I don’t think this is the issue for me, since
helm upgrade --installworks.Is
helm install --replacereally broken or could there be something wrong with my own setup after all?I also ran into the masking problem. Is it possible to fix it and make Helm show the actual problem in the error message.
@technosophos Can we please reopen this? The issue still exists on 2.9.0.
As an aside, I have noticed that sometimes this error occurs even when the manifests don’t contain any syntactical or semantic errors. However, since Helm is masking the underlying error, there’s no way to tell what’s preventing the deploy from working. All that is in Tiller’s log is:
Thumbs up to @atombender for the tip. Helm really is misleading with the error message. My underlying chart template evaluated to a Yaml with indententation errors and helm spits out this exact message:
Fixing my chart template got rid of the problem. Thank God I can
helm templateto view the processed yaml created by the template to check for errors.Ah, yes, tnx. I saw that somewhere. Which is the real problem: where can I read about deploying helm packages idempotently with the same command. It’s not in the documentation.
Is anybody reading this with the know how to edit the docs about this? I suspect ppl are losing time finding out about this, like me.
It turns out to be a template error, as indicated above, but the message was masked until I ran
helm delete --purge.We also got the same
Error: UPGRADE FAILED: cannot re-use a name that is still in useand we have to delete the release and recreate again.It would be more helpful if we get the error message because of which this is failing.
I don’t even know what’s causing it. What is happening that’s making it consider a name to be “in use”?
Deleting the namespace isn’t an option if this happens on the default namespace. I’m having a similar issue where my helm install returned an error and then helm uninstall also errored. Now the release is gone but Helm seems to think it’s still there.
Is this issue still present on more recent versions of Helm 2 (e.g. 2.14.3)?
@juliohm1978 what would you suggest we change the title to?
^ Agreed. This issue is still present and still a problem that I have to workaround on a regular basis by deleting and redeploying released.
It’s also not a support question, this is a bug.
I’m still getting this error on Helm 2.9.1:
I’m using the following chart - https://github.com/so0k/flask_app_k8s/tree/master/chart/flask-app
How to reproduce:
Running helm upgrade with
--reuse-valuesflag hits this errorBut without the
--reuse-valuesflag, there is no errorI downgraded to Helm 2.8.2 and it works
Adam and I found a regression that might have led to @27Bslash6 's particular version of this problem. I don’t know if it’s the same that @atombender is hitting. But the validation logic got broken during the Kubernetes 1.9 API update, and that would have led to the apparent naming conflict on an invalid template.
Please re-open, I’ve just encountered this on releases that have status ‘DEPLOYED’, on Helm 2.9.0:
Tiller:
FWIW, another workaround is to patch the last configmap, changing the label
STATUStoDEPLOYED.