Installation
Official Homepage: https://helm.sh/
Info
What is Helm ?
Helm helps you manage Kubernetes applications β Helm Charts help you define, install, and upgrade even the most complex Kubernetes application.Charts are easy to create, version, share, and publish β so start using Helm and stop the copy-and-paste.
Helm is a graduated project in the CNCF and is maintained by the Helm community.
Helm already installing and using on CI/CD, If you want to learn and work with helm
, feel free to installing on Installing Guide
I prefer to use command to get latest version of helm
Helm Template
All of application will base on template for releasing, you can understanding the concept with helm template
Question
Why we need the helm template ?
- Make everything become simple for managing and replacing
- Changing only one place and anything will come update for each environment (Consider when you want to change, make sure anything is working)
- Flexible variables base on environment with
values.yaml
file
Related articles:
Priority of Value in Helm
Tip
To override values in a chart
- use either the
--values
flag and pass in a file or use the--set
flag and pass configuration from the command line- To force string values, use
--set-string
.- You can use
--set-file
to set individual values from a file when the value itself is too long for the command line or is dynamically generated.- You can also use
--set-json
to set json values(scalars/objects/arrays)
from the command line.You can specify the
--values'/'-f
flag multiple times. The priority will be given to the last (right-most) file specified.You can specify the
--set
flag multiple times. The priority will be given to the last (right-most) set specified.You can update the values for an existing release with this command as well via the
--reuse-values
flag. TheRELEASE
andCHART
arguments should be set to the original parameters, and existing values will be merged with any values set via--values'/'-f
or--set
flags.
Related articles
Command usage
Helm
will submit the role for both of CI and CD progress*
CI (Continuous Integration)
helm dependency
Documentation: doc
Purpose: manage a chartβs dependencies
Info
Manage the dependencies of a chart.
Helm charts store their dependencies in βcharts/β. For chart developers, it is often easier to manage dependencies in βChart.yamlβ which declares all dependencies.
The dependency commands operate on that file, making it easy to synchronize between the desired dependencies and the actual dependencies stored in the βcharts/β directory.
Just use update
optional for update charts/ based on the contents of Chart.yaml
Example:
Documentation: The Chart.yaml File
If you can see with Chart.yaml
, you could understand what meaning of Chart with important value like
apiVersion
: The chart API version (required) - Default to usehelm3
with apiv2
to applied deploymentname
: The name of the chart (required) - This one will be effect to your kubernetes service, if namexxxx
, for example your deployment name will bexxxx
dependencies
: A list of the chart requirements (optional) - Take thecommon
withpre-define
for mapping changedeployments and YAML manifests
for application.
NOTICE: Application will use file with relative path, make sure ../../library/common/
exist
On CI progress, pipeline will trigger the action
Success
With this action, your new chart application will create and publish artifact with
- New value file if you change environment value
- New variable of
secret
configmap
, if you update them- Add new configuration like applying
HPA
to your application, for example
CD (Continuous Delivery)
helm update
Documentation: doc
Purpose: upgrade a release
Info
This command upgrades a release to a new version of a chart.
The upgrade arguments must be a release and chart. The chart argument can be either: a chart reference(βexample/mariadbβ), a path to a chart directory, a packaged chart, or a fully qualified URL. For chart references, the latest version will be specified unless the
--version
flag is set.
Apply --install
for purpose running both update and install if not exist Chart
on Cluster
Question
You need to understand concept of
value-file
work withhelm update
to make sure not mistake occur when defining. NOTICE: The value will be set base on priority. Read Priority of Value in Helm to explain more
- All environment with sensitive need to be masking like connection strings, password database, secret key, β¦ by force to using
--set
flag to set this part on the pipeline. - Base on environment, you need to upgrading the specify value for each them like
production-values.yaml uat-values.yaml systemtest-values.yaml
- If you do not set any value, default
values.yaml
is specify for general value
On CD progress, pipeline will trigger the action
Success
With this action, If not wrong anything, your new application will release to K8s Cluster
Another command
helm search
To search the version of chart from your repo which one you add into cluster, or from hub e.g ArtifactHub or selfhosted
helm install
To install helm chart from self-define or community from ArtifactHub
helm install <name-release> <chart-url>
helm list
To list releases on namespacehelm repo
To add, list, remove, update, and index chart repositorieshelm uninstall
To uninstall a release
Debug Template
Documentation: Doc
Info
Debugging templates can be tricky because the rendered templates are sent to the Kubernetes API server, which may reject the YAML files for reasons other than formatting.
There are a few commands that can help you debug.
helm lint
is your go-to tool for verifying that your chart follows best practiceshelm template --debug
will test rendering chart templates locally.helm install --dry-run --debug
will also render your chart locally without installing it, but will also check if conflicting resources are already running on the cluster. Setting βdry-run=server will additionally execute any lookup in your chart towards the server.helm get manifest
: This is a good way to see what templates are installed on the server.
Conclusion
Success
On this topic, you will learn and understand about helm for
- Install
Helm
for your environment, for debug or release- Understand priority value of helm chart
- How to use command with helm ?
- Tools for helping you debug the template before apply for real environment