Continuous deployment in Kubernetes with Helm

Software development

Continuous deployment in Kubernetes with Helm

Category: Kubernetes

Helm is the Kubernetes package manager. Learn how to use it to automate continuous deployments, manage configurations, and maintain versions of your applications across clusters.


What is Helm and why should you use it?

Helm is a tool that facilitates the deployment of applications in Kubernetes through reusable templates called chartsIf Docker is the container and Kubernetes is the orchestrator, Helm is the equivalent of a package management system like apt or npm.

With Helm you can:

  • Versioning and reusing deployment configurations
  • Automate continuous deployments in environments such as staging and production
  • Reduce human errors by avoiding duplicate YAML files
  • Rollback to previous versions if something goes wrong

Step 1: Install Helm

Helm can be easily installed from the official site or with Homebrew:

brew install helm helm version

Step 2: Create a Custom Chart

Use the command helm create To generate the base structure of a chart:

helm create mi-app

This will generate a structure like this:

my-app/ ├── charts/ ├── templates/ │ ├── deployment.yaml │ ├── service.yaml │ └── ingress.yaml ├── values.yaml └── Chart.yaml

The file values.yaml contains the configuration values that you can parameterize. The rest of the files use the syntax of Go templates to interpolate those values.

Step 3: Install the chart on Kubernetes

If you already have your Kubernetes cluster running (minikube, kind, GKE, EKS, etc.), you can install your chart with:

helm install my-app ./my-app

You can also pass custom values from another file:

helm install mi-app ./mi-app -f values.prod.yaml

Step 4: Update the app and make continuous deployments

When you update the chart or your values, you just need to run:

helm upgrade my-app ./my-app

This applies the changes without removing the current release, allowing for a continuous deployment cycle without downtime (as long as your containers are correctly configured with probes and rolling update strategies).

Step 5: Automate with GitHub Actions

You can use GitHub Actions to automatically deploy when a main is pushed:

name: Deploy to Kubernetes on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: azure/setup-helm@v3 - run: | helm upgrade --install mi-app ./mi-app -f values.prod.yaml

This workflow assumes that you have configured access to your cluster via a kubeconfig secure stored as a secret in the repository.

Advanced Tips

  • ✅ Use helm diff to preview the changes before applying them
  • 📦 Publish your charts to your own private Helm repository
  • 🧪 Integrates deployment tests and template validation
  • 🚀 Combine Helm with ArgoCD for declarative continuous deployment

Conclusion

Helm has become the de facto standard for deploying applications on Kubernetes. Its strength lies in its template reusability, rollback capabilities, and its natural integration with CI/CD pipelines. If you work with Kubernetes, mastering Helm is almost mandatory.

With just a few lines of configuration, you can automate the entire deployment cycle, from development to production.

Share
Facebook
Twitter
E-mail
Print