What is Helmfile & Why Use It?
Helmfile is a declarative spec for deploying Helm charts. Think of it as docker-compose for Helm. It lets you manage multiple Helm charts across environments using a single YAML file.
Helmfile is especially useful in GitOps workflows and CI/CD pipelines. It helps eliminate Helm command repetition, enables better configuration management, and improves consistency across clusters.
Benefits:
Declarative chart deployments
Environment-specific values
Secrets support with SOPS
Simplifies multi-chart orchestration
Great for automation and GitOps
Example:
releases:
– name: my-nginx
namespace: web
chart: bitnami/nginx
version: 13.2.18
2. Installing Helmfile
Install Helm:
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
Install Helmfile:
#curl -LO https://github.com/roboll/helmfile/releases/download/v0.135.0/#helmfile_linux_amd64
#mv helmfile_linux_amd64 helmfile
#chmod 777 helmfile
Verify Installation:
helmfile --version
3. Anatomy of helmfile.yaml
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
releases:
- name: redis
namespace: cache
chart: bitnami/redis
version: 17.1.3
values:
- redis-values.yaml
Key Elements:
- repositories: Helm chart sources
- releases: Charts to deploy
- values: External value files
4. Managing Environments
environments:
dev:
values:
- values/dev.yaml
prod:
values:
- values/prod.yaml
Run with:
helmfile -e dev apply
5. Helmfile + Helm Secrets (with SOPS)
Encrypt secrets:
sops -e values/secrets.yaml > values/secrets.enc.yaml
Use in helmfile.yaml:
secrets:
- values/secrets.enc.yaml
Apply securely:
helmfile --secret apply
6. Deploying Multiple Charts
releases:
- name: frontend
chart: ./charts/frontend
namespace: app
- name: backend
chart: ./charts/backend
namespace: app
- name: db
chart: bitnami/postgresql
namespace: db
Apply all:
helmfile apply
7. Using Multiple Helmfiles
Folder structure:
helmfile.d/
00-init.yaml
10-db.yaml
20-app.yaml
Apply with:
helmfile -f helmfile.d/ apply
8. Debugging & Dry Run
helmfile diff # Show changes between current and target state
helmfile template # View the Kubernetes manifests that will be generated
helmfile lint # Lint all defined Helm charts
helmfile apply –debug # Apply with verbose output
helmfile sync # Apply changes only if they are different (like apply, but smarter)
helmfile test # Run Helm tests defined in your charts
helmfile status # Show the release status of all charts
helmfile destroy # Uninstall all releases defined in the file
9. CI/CD Integration
GitHub Actions Example:
- name: Deploy via Helmfile
run: |
helmfile -e prod
apply Use GitHub Secrets or SOPS for secure key handling.