Deploy with Helm
Use Helm in a Codefresh pipeline
Helm is the package manager for Kubernetes.
Codefresh has comprehensive support for Helm:
- Free built-in Helm repository with each Codefresh account
- Helm chart dashboard to track your charts
- Helm Release dashboard to view your deployments
- Environment dashsboard to view Helm releases
- Helm promotion dashboard to promote Helm releases
- Add any external Helm repository on any other cloud provider
Codefresh also provides a pipeline step for deploying with Helm.
For more insights on Helm charts see also our Helm best practices guide.
The example Helm project
You can see the example project at https://github.com/codefresh-contrib/helm-sample-app. The repository contains a simple Go application, a Dockerfile and an example chart.
Prerequisites
At least one Kubernetes cluster in your Codefresh account.
CI/CD pipeline with Helm deployment
It is possible to deploy directly a Helm chart as it exists on the filesystem. This is not the recommended way to use Helm, because you are bypassing the Helm chart repository, but it is certainly the simplest Helm pipeline possible.
Here is the whole pipeline:
codefresh-do-not-store.yml
This pipeline does the following:
- Clones the source code through a Git clone step
- Builds a docker image through a build step
- Deploys the Helm chart to a cluster named
my-demo-k8s-cluster
using the Helm step from the Step Marketplace.
In this example, charts/helm-example
refers to the filesystem location in the code that was just checked out.
The deployment will be visible in the Helm releases dashboard.
If you want to run this example yourself, make sure to edit the chart and put your own values there for the Docker image.
CI/CD pipeline with Helm deployment that also stores the chart
It is recommended to use a Helm repository to store your chart before deploying it. This way you know what is deployed in your clusters and you can also reuse charts in other installations.
First of all you need to import in your pipeline from the shared configuration the settings for the internal Helm repository (or any other external repository that you have setup in Codefresh). This will make available the internal Helm repository to your pipeline so that it can push/pull Helm charts from it.
Once that is done you can change your pipeline to also store the chart first and then deploy it.
Here is the whole pipeline:
codefresh.yml
After you finish running your pipeline, not only the deployment will take place, but you will also see your chart in your Helm Chart dashboard:
It is also possible to run your own Helm commands in a Codefresh pipeline.
Related articles
CD pipeline examples
Codefresh YAML for pipeline definitions
Steps in pipelines
Creating pipelines
How Codefresh pipelines work