I'm managing a project with 10 microservices and currently using a single Helm values file that combines all their configurations. I'd prefer to have individual value files for each microservice to simplify changes and make it clearer where to apply new updates. The goal is to install all microservices under the same release name. However, when I run a Helm upgrade, it deletes the old pods and only installs the ones defined in the last value file. I found that using Helmfile can help with the install and upgrade process, but it requires me to script the merging of all value files. This becomes cumbersome when I need to add new services in the future. Is there a way to automate this process, allowing me to just specify the path of new value files for installation?
3 Answers
You can also configure your Helm chart to use multiple value files by defining them in your Helm templates like so:
```yaml
helm:
valueFiles:
- values/service1.yaml
- values/service2.yaml
``` This should help to keep things more organized, but you'll need to ensure the values are structured correctly to avoid issues during upgrades.
Another way to handle this is by creating separate YAML files for each microservice, like `microservice1.yaml`, `microservice2.yaml`, and passing them in during deployment with `helm install`. Although this can get tricky, especially when upgrading since changes might not be retained unless managed properly.
I did that, but when I upgrade the second microservice in the same namespace, it deletes the previous one.
You can actually pass multiple values files during a Helm install using the `-f` option repeatedly like this: `helm install my-release -f values1.yaml -f values2.yaml`. For upgrades, consider using the `--reuse-values` flag to keep the previous configurations while merging new ones from your specified files. This might help keep your existing pods around during upgrades.
I tried this, but the old pods still got deleted. Each of my value files has different Docker images, which might be causing issues.
Okay, thanks! I'll give this a shot and see how it goes.
Can you provide more specific guidance on setting that up?