Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-running helm install --name foo after helm delete foo fails #1140

Closed
mumoshu opened this issue Sep 5, 2016 · 6 comments
Closed

Re-running helm install --name foo after helm delete foo fails #1140

mumoshu opened this issue Sep 5, 2016 · 6 comments

Comments

@mumoshu
Copy link
Contributor

@mumoshu mumoshu commented Sep 5, 2016

It seems that helm install --name foo fails with an error like Error: a release named "foo" already exists even though that release is already deleted by helm delete and helm list doesn't show a release named so.

I could reproduce it with helm v2.0.0-alpha.3 by running:

$ helm install mumoshu/mysql-0.2.1.tgz --name my-release --namespace dev
Fetched mumoshu/mysql-0.2.1.tgz to /Users/me/path/to/repo/mysql-0.2.1.tgz
my-release
$ helm delete my-release
$ helm install mumoshu/mysql-0.2.1.tgz --name my-release --namespace dev
Fetched mumoshu/mysql-0.2.1.tgz to /Users/me/path/to/repo/mysql-0.2.1.tgz
Error: a release named "my-release" already exists
$ helm list
snug-stingeray
@technosophos
Copy link
Member

@technosophos technosophos commented Sep 6, 2016

You actually have to purge the release if you want to re-use the name: helm delete --purge my-release. Otherwise, Tiller keeps the history of my-release.

@mumoshu
Copy link
Contributor Author

@mumoshu mumoshu commented Sep 7, 2016

@technosophos Thanks!
Would you mind clarifying why helm delete doesn't purge the release by default?
Also, is there any way to list deleted-but-not-purged releases?(helm list doesn't seem to show those)

My intent was to have a stable release name e.g. mysql-dev so that I can locate the latest release for the specific component(mysql), without scraping the output of helm list --long | grep mysql. I'm not sure what might be a helm-ish way though.

@technosophos
Copy link
Member

@technosophos technosophos commented Oct 7, 2016

There are several changes since this bug was filed.

  • helm list --all now shows all releases (deleted or otherwise), and helm list --deleted shows just deleted releases.
  • helm install --replace allows you to re-use the name.
  • helm rollback can now un-delete a release (provided it hasn't been replaced.

So at this point, you actually have two options for accomplishing your workflow:

  • helm delete mysql-dev && helm install --replace --name mysql-dev...
  • helm upgrade --install mysql-dev

I'm going to mark the issue as closed, but feel free to re-open it if I missed a use case here.

@Paxa
Copy link

@Paxa Paxa commented Jun 27, 2018

What helm command would be similar to kubectl apply ...? (sorry for dump question)

@CodeJjang
Copy link

@CodeJjang CodeJjang commented Nov 16, 2018

@Paxa If you mean similar by using the same command when installing and upgrading a release, then according to Helm Tips and Tricks:

helm upgrade --install <release name> --values <values file> <chart directory>

@RomHartmann
Copy link

@RomHartmann RomHartmann commented Feb 4, 2019

For anyone experiencing this when using multiple kubectl contexts, remember to also explicitly set --kube-context when using one that is not default.:

helm del --purge $(NAME) --kube-context $(ENV)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants