It's well known that Kubernetes is deeply rooted in many existing cloud architectures within the IT sector. It's an industry standard that has gained significant value over time and is now essential for many modern projects, especially those based on microservices and scalable deployments. Its ability to automatically orchestrate containers has made it a central component of the DevOps ecosystem.
Along with Kubernetes came the Helm package manager, which helps easily install any application in the desired Kubernetes environment, simplifying the deployment process through the use of predefined charts. These charts are simply configurable packages containing all the necessary definitions for deploying an application: from services, deployments, and configurations to environment variables and external dependencies.
However, as environments grow in complexity, using Helm in isolation begins to reveal certain limitations. Managing multiple charts, coordinating across different environments (development, testing, and production), and maintaining consistent configurations across deployments can become error-prone and difficult to scale. Helm alone doesn't provide a superior orchestration layer that allows for centralized grouping, versioning, and synchronization of multiple releases. That's precisely where Helmfile comes in.
What exactly is Helmfile?
Simply put, Helmfile is a declarative specification that helps manage Kubernetes Helm charts in a much more structured way, grouping their releases in one place where we can control their versions, configure them to the developer's liking, and adapt them to the needs of deploying applications on Kubernetes.
In other words, Helmfile acts as an abstraction layer on top of Helm, allowing us to define the entire desired state of our system in a single YAML file. Instead of manually running multiple Helm commands for each application, Helmfile lets us centrally declare which applications we want to deploy, with which versions, and in which environments, and then apply that state automatically and reproducibly.
Key qualities:
Helmfile not only acts as an organizational layer on top of Helm, but also introduces a series of key features that make it a much more powerful tool in real-world production environments. These features focus primarily on declarativeness, reusability, versatility, and the ability to modify resources before deployment.
Below, we analyze its most important features along with brief practical examples that allow you to understand how it works in a simulated environment.
1. Declarative Approach:
One of the main advantages of Helmfile is its completely declarative nature. This means that instead of executing individual commands to install or update applications, you define a central file (helmfile.yaml) where you specify the desired system state.
Helmfile interprets this file and synchronizes the environment to exactly match the defined state, improving reproducibility and reducing human error.
Configuring a general HelmFile
The necessary dependencies are installed and the cluster state is converted to the desired state.
2. Modules:
Helmfile allows you to modularize configurations, meaning you can reuse common patterns across different projects or teams. These modules can be stored in Git repositories, S3 buckets, or internal shared systems.
This is especially useful in large companies, where multiple teams need to deploy similar services without duplicating configurations.
The main directory structure contains different versions for each environment. We will now combine both.
Figure 1: Changes are successfully synchronized with the environment
3. Versatility:
Another important feature is that Helmfile isn't limited to just Helm charts. It also allows you to manage other types of Kubernetes resources, such as:
- Helm charts
- Kustomizations
- Complete directories of YAML manifests
This makes Helmfile a more flexible tool, capable of unifying different deployment methods under a single interface. However, these advanced features aren't natively available in a standard Helmfile installation; they require extensions like helm-x, which adds complexity to its configuration and use.
For this reason, in basic environments, users typically work only with traditional Helm charts, taking advantage of their ability to centralize multiple deployments in a single declarative file.
Different types of management files that HelmFile is able to work with
4. Resource Patching:
Helmfile allows you to modify Kubernetes resources before installation using JSON patches or Strategic Merge Patches. This avoids having to directly modify the original charts, which is very useful when using third-party charts.
This way, configurations can be adapted without forking or duplicating external projects.
Applying a JSON Patch to a Helmfile to modify a Service resource of a third-party chart without altering the original chart
Why you should use it:
Using Helm alone is a significant improvement when deploying applications on Kubernetes, but it has limitations when working with multiple charts or more complex environments. Each deployment is managed individually, which can hinder organization, version control, and system reproducibility.
This is where Helmfile offers a unique advantage. By introducing a declarative approach, it allows you to define the complete state of all releases in a single file, facilitating their management and preventing inconsistencies between environments. This is especially useful in projects with multiple services or configurations that need to be kept synchronized. Furthermore, considering the GitOps approach, Helmfile fits in perfectly because by declaratively defining the application state and managing dependencies and configurations, you gain complete control and observability over changes made to your Kubernetes environment, making it much easier to revert changes or find their history.
Furthermore, Helmfile simplifies tasks such as updating, installing, or deleting multiple charts at once, reducing the possibility of errors and improving workflow efficiency. Compared to raw Helm, it offers an additional layer of control and organization that becomes practically indispensable as project complexity grows.
While Helm does address issues like multiple charts with umbrella charts (which consist of a main chart that groups several subcharts within the same structure), Helmfile offers a cleaner and more flexible abstraction. Instead of grouping everything into a single chart, it allows you to manage each chart independently within the same declarative file, preventing unexpected behavior and facilitating maintenance. This eliminates the need to repackage and redeploy an umbrella chart every time one of its components is modified and also allows for greater control over deployments, enabling you to define the order in which releases are applied, limit which components are deployed in each environment, or even apply changes in a more controlled manner to specific parts of the system.
Example HelmFile for managing two applications simultaneously
With a single command, we deploy multiple releases (if it already exists, its status is updated)
Relationship with ArgoCD and its use in automation:
Another major advantage of HelmFile is its ease of use in managing workflow automation for continuous deployments. Similar to its excellent integration with GitOps, HelmFile also complements the functionalities of applications like ArgoCD, which aim to automate continuous application delivery.
In this context, HelmFile can be used to declaratively define and organize deployments, while ArgoCD automatically applies these changes to the cluster, creating a more robust workflow.
Furthermore, HelmFile facilitates the use of remote charts alongside values stored in Git, allows for the reuse of configurations across environments, preventing duplication, and supports templates and variables that make deployments more flexible. All of this, combined with centralization in a single file, improves project organization and maintenance.
This benefit is not limited to specific applications; working with any type of CI/CD pipeline using HelmFile will also help execute complete deployments more consistently.
Conclusion:
Throughout this article, we have seen how Helmfile significantly improves Kubernetes deployment management, providing a declarative and centralized approach that facilitates the control and organization of multiple releases.
Compared to using Helm "raw," it introduces greater flexibility, allowing configurations to be adapted and maintaining a clear system state without needing to directly modify the original charts.
In short, Helmfile presents itself as a simple yet powerful tool, capable of optimizing work with Kubernetes and making increasingly complex environments more manageable.
Rubén Gadea
Software Technician
ALTIA