Helm
Helm is a popular package manager for Kubernetes, an open-source container orchestration platform. It simplifies the deployment and management of applications in Kubernetes clusters by providing a templating system and a standardized way to package, distribute, and deploy software. With Helm, developers can define their application's configuration and dependencies using "charts," which are essentially packages that contain all the necessary files, templates, and metadata. These charts can be versioned and shared, allowing for easy collaboration and reuse across different projects.
Helm Chart Source
env0 supports using Helm with 3 chart sources:
git
/local
- Use charts that are defined in your code and are not hosted in a Helm Repo.Helm Repo
- Use charts which are hosted in a chart repository. If the repository requires authentication you can provide the username and password inENV0_HELM_REPO_USERNAME
andENV0_HELM_REPO_PASSWORD
environment variables.S3
- Hosted directly on S3, similar toHelm Repo
these charts are hosted remotely but they follow a different protocol.
In order to use a chart that is defined directly in your git
select the appropriate VCS provider and provide the path to your Helm chart code:
In order to use a chart hosted in a Helm Repo
/ S3
select the Helm Repo option in your template:
Custom Flow For Helm Repo Deployments
Helm Repo deployments do not require git clone since the chart is not stored in git, therefore there is no custom flow for a Helm Repo template.
In order to use custom flows (for cluster authentication or other usages) in Helm Repo you must configure a Project-level Custom Flow.
Environment Deployment
- Create a Helm Template.
- Follow our guide to Connect Your Kubernetes Cluster.
- Create an Environment.
Cluster Authentication
Cluster authentication varies from one provider to another. Please refer to the Connect Your Kubernetes Cluster guide to learn more.
Environment Variables For Enhanced Customization
env0 supports a more customized usage by providing unique environment variables which will be passed to Helm:
ENV0_HELM_SET_<YOUR_VARIABLE_NAME>
- set an environment variable with theENV0_HELM_SET
prefix and the variable name as the suffix will be passed to Helm using the--set
flag. E.g.ENV0_HELM_SET_servers[0].port=80
will pass--set server[0].port=80
to helm command. (see below for additional examples for inputting more complex types)ENV0_HELM_VALUES_FILES
- set this environment variable in order to provide Helm with your configuration which is stored in a values file(s), and will be passed to Helm using the--values (-f)
flag.ENV0_HELM_CLI_ARGS
- this variable's value will be added to every Helm command execution, it can be used to pass additional custom arguments to Helm. For example it can be set to--create-namespace --no-hooks
.ENV0_HELM_CLI_ARGS_diff
,ENV0_HELM_CLI_ARGS_upgrade
, andENV0_HELM_CLI_ARGS_uninstall
are similar, but only added to corresponding helm commands.
Execution Steps
Beyond the common steps such as Clone, Loading variables, etc. Deploy/Destroy Helm deployments contain the following steps:
-
Helm Diff -
helm diff upgrade <release-name> <chart-name/path> --install --allow-unreleased --color --detailed-exitcode
-
Helm Upgrade -
helm upgrade <release-name> . --install --atomic --timeout 4h
-
Helm Uninstall -
helm uninstall <release-name> --wait --timeout 4h
What Counts as a "diff"
env0 calculates diff between deployments using
helm
and the helm diff plugin.The Helm diff plugin finds the exact difference between Helm executions, changes to your Kubernetes resources which were not done by helm are left unnoticed.
For example, A Drift Detection run would result as successful (meaning no drift was found) if a change was done manually inside the cluster without using Helm (such as increasing the
replicas
from 1 to 2).
Complex Input Value Examples
Desired Helm Value | env0 HELM SET Input |
---|---|
annotations | general rule: - use quotes to encapsulate the "key" of annotation. - escape . (period) and / (slashes) with a (backslash)example(s): - ENV0_HELM_SET_annotations."nginx.ingress.kubernets.io/backend-protocol"=HTTPS - ENV0_HELM_SET_server.ingress.annotations."cert-manager.io/cluster-issuer"=letsencrypt |
labels | general rule: - use quotes to encapsulate the "key" of label. - escape . (period) and / (slashes) with a (backslash)example(s): - ENV0_HELM_SET_labels."app.kubernetes.io/name"=my-deployment |
complex values | general rule: - escape spaces with a (backslash)example - ENV0_HELM_SET_map={"foo:\ bar"} |
Updated 6 months ago