Search code examples
kuberneteskubernetes-helm

How to use a Helm template in multiple repositories?


I have several microservices that have practically the same settings in YAML, some values change (e.g. image, version, a specific environment variable ...), and they are in different repositories, with a different pipeline each. How do I use the same template between them without getting repeated code?


Solution

  • This is how we do it in the place I currently work.

    We have our own generic Helm chart that is version controlled and hosted in our Artifactory, every parameter in that chart that may need changing is exposed in values.yaml.

    The Artifactory gets added to helm as repository, then you only need separate a values.yaml for each microservice you want deployed as the chart gets sourced centrally.

    helm install -f values.yaml microservice01 artifcatory/global-helm-chart

    On top of that we use helmfile, but this is not necessary in order to achieve your goal.

    The key points are:

    • make the chart generic
    • host it centrally
    • add the repository to helm.