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

How to scale down pre-upgrade and up post-install? #2516

Closed
DonMartin76 opened this issue May 28, 2017 · 3 comments
Closed

How to scale down pre-upgrade and up post-install? #2516

DonMartin76 opened this issue May 28, 2017 · 3 comments

Comments

@DonMartin76
Copy link

DonMartin76 commented May 28, 2017

Hi there,

I have the following situation with one component of the package I am trying to write a Helm chart for: Even though the component is scalable, it's important that it's scaled down to just 1 instance prior to being upgraded (correct: this leads to a little bit of downtime), and after a new version has been installed, the component can be scaled up again.

Can I accomplish this using Helm hooks (or other means)? With bash scripts, I run a kubectl scale on the correspoding deployment, can I incorporate this kind of logic into the Helm chart? Do I need a Rudder?

Best regards,
Martin

@DonMartin76
Copy link
Author

I have the following idea so far:

  • For pre-upgrade, use a Job with an image which contains kubectl and does just that, kubectl scale deployment <...> --replicas=1, e.g. inside a bash script or so
  • Deploy new version with a fixed replica count of 1
  • Another Job which runs kubectl with the in-cluster configuration to set the replica count to the desired number of replicas, once more using some kind of scripting

Is this how you would do it today? Are there plans on supporting these kinds of things more explicitly?

@technosophos
Copy link
Member

Honestly, the best way to do this is to run three Helm commands roughly like this:

$ helm upgrade myrelease oldchart --set replicaCount=1 --reuse-values
$ helm upgrade myrelease newchart 
$ helm upgrade myrelease newchart --set replicaCount=5 --reuse-values

(The above assumes that replicaCount is the correct name for whatever {{.Value}} has the replica count)

The reason for doing it this way is that Helm tracks each step of state here, and you don't run the risk of getting into a situation in which Helm cannot recover because some other process modified and broke the manifest files.

@bacongobbler
Copy link
Member

I'm going to close this ticket due to inactivity, but please re-open if this still needs to be addressed. Thanks!

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

No branches or pull requests

4 participants