Creating New helm chart

Helm Chart development

helm create NAME flags

helm create guestbook                         
Creating guestbook
tree guestbook 
guestbook
├── Chart.yaml
├── charts
├── templates
   ├── NOTES.txt
   ├── _helpers.tpl
   ├── deployment.yaml
   ├── hpa.yaml
   ├── ingress.yaml
   ├── service.yaml
   ├── serviceaccount.yaml
   └── tests
       └── test-connection.yaml
└── values.yaml
File/Directory
Definition
Required?

charts/

A directory that contains dependencies or Helm charts that the parent chart depends on.

No

Chart.yaml

A file that contains metadata about the Helm chart.

Yes

.helmignore

A file that contains a list of files and directories that should be omitted from the Helm chart’s packaging.

No

templates/

A directory that contains Golang templates, which are primarily used for generating Kubernetes resources.

Yes, unless the chart contains dependencies

templates/*.yaml

A template file used to generate a Kubernetes resource.

Yes, unless the chart contains dependencies

templates/_*.tpl

A file that contains boilerplate helper templates.

No

templates/NOTES.txt

A template file that is used to generate usage instructions after chart installation.

No

templates/tests/

A folder used for grouping different templates. This is strictly for aesthetics and has no effect on how the Helm chart operates – for example, templates/tests is used to group templates that are used for testing.

No

values.yaml

A file that contains the chart’s default values.

No, but every chart should contain this file as a best practice

Additional files not listed in the table may be included in a Helm chart, which were not generated by the helm create command.

File/Directory
Definition
Required?

Chart.lock

A file used to save, or lock in, the previously applied dependency versions.

No

crds/

A directory that contains Custom Resource Definition (CRD) YAML resources. These CRD resources will be installed before those under templates/.

No

README.md

A file that contains installation and usage information about the Helm chart.

No, but every Helm chart should contain this file as a best practice

LICENSE

A file that contains the chart’s license, which provides information about usage and redistribution rights.

No

values.schema.json

A file that contains the chart’s values schema in the JSON format. Used to provide input validation.

No

Installing helm chart using local path

We can check the manifest that got applied

Let's cleanup

chart.yaml(Chart Definition)

  • Holds metadata about the helm chart.

Chart.yaml fields:

Field
Description
Required?

apiVersion

The chart API version

Yes

name

The name of the Helm chart

Yes

description

A brief description of the Helm chart

No

type

The type of Helm chart (either Application or Library)

No

version

The version of the Helm chart, in SemVer format

Yes

appVersion

The version of the application that the Helm chart deploys. This does not need to be in the SemVer format.

No

Additional Chart.yaml supported fields:

Field
Description
Required?

kubeVersion

A range of compatible Kubernetes versions in the SemVer format.

No

keywords

A list of keywords used to describe the Helm chart. Keywords are also used to provide search terms for the helm search command.

No

home

The URL to the Helm chart’s home page.

No

sources

A list of URLs that link to source code used by the Helm chart.

No

dependencies

A list of charts that your Helm chart is reliant on.

No

maintainers

A list of Helm chart maintainers.

No

icon

An icon in SVG or PNG format used to represent the Helm chart. Displayed on the chart’s Artifact Hub page.

No

deprecated

Indicates whether the Helm chart has been deprecated.

No

annotations

A list of annotations used to provide custom metadata.

No

Updating Chart.yaml


Chart Dependencies

Check dependencies

  • Supported fields under chart.yaml for dependencies:

Field
Description
Required?

Name

The name of the dependency chart

Yes

Repository

The location where the dependency chart resides

Yes

Version

The chart dependency version

Yes

Condition

A Boolean value that determines whether to include the dependency or not

No

Tags

A list of Boolean values that determine whether to include the chart or not

No

import-values

A mapping of source values to parent values

No

Alias

An alternative name to give the dependency

No

  • helm dependency command

Command
Description

helm dependency list

Lists the dependencies for the given chart.

helm dependency update

Downloads the dependencies listed in Chart.yaml and generates a Chart.lock file.

helm dependency build

Downloads the dependencies listed in Chart.lock. If the Chart.lock file is not found, then this command will mirror the behavior of the helm dependency update command.

  • Clone this repo if you want to do hands-on:

  • Status missing means, the dependency chart is not downloaded yet.

  • We can perform dependecy update to download it

  • Dependencies gets downloaded under charts folder and version is updated in Chart.lock file.

  • You can use wildcard version for dependencies.

    • For example:

    • This will download the latest version starting with major version 9.

  • helm dep update will to the latest version, to keep consistent with the version specified in Chart.lock run cmd helm deps build

Conditional Dependencies

  • Chart.yaml

  • values.yaml

  • Disabling mariadb.enabled flag

Tags based dependencies

  • Chart.yaml

  • To only include database, set --set tags.backend=false --set tags.database=true

  • When both conditional and tags are used, then conditional override tags.

Overriding Dependencies names and values

  • Dependency mentioned in Chart.yaml:

  • Overriding mariadb in values.yaml:

Dependencies Alias

  • Here, with the help of alais we can deploy multiple instances of mariadb with same parameters.

  • This way, we can also install multiple mariadb instance of different version.

import-values

  • Application chart

  • Dependency chart


morearrow-up-right

Last updated