Deploy Logging and Monitoring tools using Helmfile
As we understand Helm is a Kubernetes deployment tool for automating the creation, packaging, configuration, and deployment of applications and services to Kubernetes clusters. The thing with which we struggle many times is the dependency between the charts. That’s where helmfile comes into the picture.
What is helmfile?
Helmfile gives us the power of dependency management, i.e. our Chart can depend on other Charts, and allows templating of YAML files. Helmfile allows us to have dependencies between separate Helm installs. This way we can install multiple helm charts with 1 command, however, Helmfile in the background is actually using Helm to install multiple Charts.
Helmfile also allows us to template values.yaml. In standard Helm Charts this isn’t allowed. Helm wants the yaml file to be declarative. Declarative languages work great for ensuring that a system is going to get to the final state we want without worrying about imperative coding-type issues. But maintaining a bunch of static values.yaml files are messy and not DRY. This is why often with Declarative Languages you end up using imperative programming in front of the declarative tool/language.
Helmfile also allows you to manage any number of Helm charts
Brief information about this project
Here in this project we have setup 3 environments (dev, prod, shared)
We are deploying monitoring and logging tools in 3 environments based on our requirements.
Helmfile is providing the ability to reduce duplicate data and we can manage dependency of the helm charts.
We have created here a folder envs which stores all our required variables and customization for each environment.
we have created a separate folder for each environment where each folder contains 3 files
1. charts.yaml.gotmpl
In this file you can provide the tools you want to install from the all charts present in charts.
2. envs.sh
It includes the environment variables to be exported during chart deployment.
3. values.yaml.gotmpl
This file can be used to customize the charts values as per the requirement
Steps to deploy the helmfile
1. Download Helmfile
Link- helmfile_linux_amd64
2. Change the name of the file
mv helmfile_linux_amd64 helmfile
3. Change the permission of the file
chmod 777 helmfile
4. Move the file to /usr/local/bin
mv helmfile /usr/local/bin
5. Chech the version
helmfile --version
Once your helmfile is installed follow the below steps
Step1: Select the environment you want to deploy and run the envs.sh of that environment
source envs/<< env >>/envs.sh
Step2: Deploy the helmfile
helmfile apply
The helmfile apply will one by one deploy all your helm charts enabled in envs/<< env >>/charts.yaml.gotmpl
The code is available at https://github.com/hemantdua56/helmfile-logging-monitoring
Thanks for the Read