helmfile

Boost Helm Deployment Efficiency with Helmfile: A Better Way to Manage Charts

Spread the love

Deployment in Kubernetes is a huge part of how applications can be stable and available. There are wrong ways of deploying to Kubernetes, which can lead to application downtime during the deployment process. Ensuring deployments are done as efficiently as possible is crucial to the availability of applications running in the Kubernetes cluster.

A proper Kubernetes deployment comprises YAML files, also called manifest files. These files form the deployment package of an application, which is made up of different components for application/compute, network, and security configurations. There are various ways these files can be deployed into a Kubernetes cluster. The three major options are:

  • Using kubectl — This is the native Kubernetes CLI tool for administering a Kubernetes cluster. Deployment is done using the kubectl apply -f command in the directory where the YAML files exist.
  • Using Kustomize — This is the direct elder brother to kubectl that allows some structure into the file arrangement and some room for dynamic value change using the overlay technique to interpose a file into another file.
  • Using Helm– One of the most advanced methods of deploying into Kubernetes. Helm is a templating engine with functions, variables, and other features that make it very flexible and versatile for various use cases.

Our focus in this article will be on the Helm chart. I have written about the Helm chart in this article and my concept of using the Mono Chart for deployment, which makes using Helm deployment for Kubernetes faster and more efficient. The native method of deploying to the Kubernetes Helm chart is to use the helm install command and reference the chart’s directory and the chart’s name to deploy. In today’s era of declarative infrastructure scripting and the GitOps approach to application deployment. Helm has risen to introduce a declarative way of deploying Helm charts, called a Helmfile.

What is a Helmfile

A Helmfile, similar to a Dockerfile, and an Earthfile, a declarative YAML file that defines how deployments are carried out in a Kubernetes cluster by referencing the YAML manifest files in a Helm chart that is local or remote. The file can be in the same repository as your code or a different repository; what is most important is the references the file has. The following is an example of a Helmfile.

repositories:
 - name: rabbitmq
   url: https://charts.bitnami.com/bitnami

releases:
- name: rabbitmq-app
  namespace: rabbitmq
  chart: bitnami/rabbitmq
  set:
  - name: clustering.enabled 
    value: true
  - name: clustering.name 
    value: "test-cluster"

To run this file use the following commands

helmfile init This initializes the Helm chart and prepares it for installation

helmfile apply Synchronizes the Helmfile declaration with the Kubernetes cluster components, and works in a GitOps approach for deployment.

The following prerequisites need to be met for the commands listed above to function:

  • Install the Helmfile Binary in the terminal, or CI pipeline instructions are here.
  • The configuration must be in a file named helmfile.yaml .
  • The command must be run on the location of the helmfile.yaml .

Features of Helmfile

On a basic level, it has the aspects that are needed to run a Helm chart effectively. Such as setting values while running the file, and referencing a values.yaml file that contains the values parameterized in the Helm Chart. Helmfile can run a Helm chart that is local or remote, as long as the location specified in the url The Helmfile parameter is accurate. Apart from the normal features of a Helm Chart, let us highlight some unique features that Helmfile has that are not native to Helm and Helm Chart

  • DAG-aware installation/deletion: With Helmfile, the order of installing and deleting components into a Kubernetes cluster can be managed effectively
  • Parallel Execution: Supports parallel execution of Helm commands, which saves time and allows faster deployment.
  • Helm Hooks: It supports pre-deployment and post-deployment hooks, which allow you to do actions that can run before and after a Helm release. The Helmfile hooks apply to the entire release workflow.
  • Centralized Configurations and Environments: With Helmfile, the values of multiple charts can be conveniently managed

Values of using a Helmfile

  • Manage multiple charts in a single file
  • Can be integrated with a CI/CD workflow for review before application (with the interactive flag)
  • Fewer commands to execute a Helm chart
  • Has an integration with Kustomize.

Disadvantages of Helmfile

  • Limited Applications: ArgoCD can be used instead
  • Increased Complexity with a new configuration to manage apart from the Helm Chart
  • It could make debugging challenging

Conclusion

Helmfile is an optional technique for deploying to Kubernetes. It is mostly an application used when Helm is deployed to Kubernetes. But it can bring an extra layer of declarative deployment to your deployment setup and speed up making changes and delivering applications in Kubernetes faster and more efficiently.

References


Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
×