Search code examples
kuberneteskubernetes-helmhelmfile

Common helm chart templates for a group of micro-services


Is there a way to define a common helm chart template for a set of services and extend those templates on need basis?

All my micro services are spring-boot based and are deployed on Kubernetes cluster. I use helm chart templates for the deployment manifest files. There is a lot of common configuration across those helm charts. So, I'd like to have a default template file which all the services can use which includes default declarations like Kubernetes resource requests and limits, the default environment variables, namespace details etc.

Each microservice, now should be able to extend the common chart as required. For example: the services could add a list of additional environment variables.


Solution

  • This sounds a lot like you would need a so called Library chart.

    Library charts in helm do not instantiate objects in k8s, but rather provide reusable templates. In that library chart, you define the deployment, service and other components as templates in a tpl file. Later, you then import the library chart in you concrete helm charts and use the defined templates.

    The templates itself can be heavily parameterized themselves allowing you to customize for example a deployment template with custom env vars.