Helm install: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 174: Line 174:
==--username, --password==
==--username, --password==
See [[#Absolute_URL|Absolute URL of a chart in a remote repository]] above.
See [[#Absolute_URL|Absolute URL of a chart in a remote repository]] above.
==-n,--namespace==
Specifies the namespace scope for this installation. Note that the namespace must exist, otherwise Helm installation will fail:
<syntaxhighlight lang='text'>
Error: create: failed to create: namespaces "test" not found
</syntaxhighlight>


=Scenarios=
=Scenarios=

Revision as of 05:20, 16 October 2020

External

Internal

Overview


Revised for Helm 3


helm install installs a chart archive and creates a release:

helm install <release-name> <chart> [options]

The release name must be specified explicitly, and it must be the first argument. If it should be generated, --generate-name must be used instead of the release name. Charts may come from different sources.

Chart Sources

There are five types of chart sources:

  1. Unpacked charts on the local filesystem
  2. tgz packaged chart on the local filesystem
  3. Absolute URL of a chart archive in a remote repository
  4. Chart reference in a remote repository
  5. Chart is present in a locally cached repository, and specified by its chart name and repository prefix

Path to an Unpacked Chart

The chart argument of the install command can be an unpacked local chart directory. The directory name must be identical with the chart name specified in Chart.yaml).

helm install simplest ./playground/helm/simplest

Path to a Packaged Chart

helm install simplest ./simplest-1.0.0.tgz

Charts can be packaged with helm package command.

Where is the chart expanded locally?

Absolute URL

The absolute URL of a chart can be used as such:

helm install something https://example.com/charts/something-1.0.0.tgz

The version is built into the name of the chart, this is the default Helm versioning convention. The chart does not need to be cached in the local repository and the repository does not need to be cached locally with repo add.

If the remote repository is password-protected, the username and the password can be specified on the command line with:

helm install something https://example.com/charts/something-1.0.0.tgz --username <username> --password <password>

Where is the chart expanded locally?

Chart Reference

A chart available in a chart repository can be specified by a chart reference (which is the same thing as the chart name) when installed. There are two ways to specify a chart reference:

Using an Explicit Repository URL with --repo

A repository URL can be specified in-line in the install command line with --repo, without being previously added with helm repo add:

helm install --repo https://example.com/charts/ mynginx --version 1.2.3 nginx

If --version is not specified, the latest present version is installed.

Where is the chart expanded locally?

Using a Repository Prefix

helm install postgresql --version 1.2.3 example/postgresql

Note that the "example" is a name of a repository that has been previously added locally with helm repo add. If no other version specification is provided, the latest stable version of the chart will be installed. A specific version can be requested with --version.

helm install and Dependencies

If the chart has dependencies, they must be present in the charts/ subdirectory at the time of the installation. helm install does not manage dependencies, helm dependency does. helm install performs some sanity checks, such as comparing the content of requirements.yaml with the content of the charts/ subdirectory and failing if requirements.yaml contains dependencies that are not in charts/. However, if a dependency is present in charts/ but not in requirements.yaml, it will be installed. For more details on dependencies and how they work, see:

How Helm Dependencies Work

TODO: --dependency-update.

Overriding Default Configuration or Providing New Cofiguration

-f|--values

Default configuration can be overridden or new configuration can be specified with:

helm install -f|--values <configuration-overrides-file.yaml> <chart name>

The -f|--values flag can be specified multiple time on the command line, and the rightmost value will take precedence. The effective configuration actually applied to the chart is computed by using the chart's values.yaml as base and then logically overlaying the configuration files from left to right. An overlay step leaves configuration paths that exist in the base but are not present in the overlay unchanged, overwrites configuration paths that are present both in the base and the overlay with the value present in the overlay, and adds new configuration paths that do not exist in the base but exist in the overlay. The process is repeated from left to right for all files present on command line.

For more details on Helm configuration see:

Helm Configuration

--set-file

--set-file stringArray     

"names" the content of a file, and makes it available from templates using the name. Set values from respective files specified via the command line. Multiple or separate values can be specified as key1=path1,key2=path2)

TODO:

--set-file certificate=/path/to/the/file

then call .Values.certificate in the template to access the file's data.

For more details on Helm configuration see:

Helm Configuration

--set, --set--string

Individual configuration options can be specified with --set or --set-string.

helm install --set size=10 <chart name>

--set can be specified multiple times. If specified multiple time for the same value, the priority will be given to the last (right-most) set specified. For more details on overriding or specifying configuration see:

Helm Configuration

Overriding Tags and Conditions

Use --set to override default tag and condition values at installation time.

Options

Generic Options

Generic Options

--generate-name

Generate a release name:

helm install --generate-name <chart>

If used, the user-supplied name must be omitted from the command line, and a name based on the chart name will be generated. If the chart is named "simplest", the generated name is similar to "simplest-1-1575057340".

--dry-run

In this mode, the installation is simulated, without actually modifying anything on the Kubernetes cluster. Instead of installing the chart, the rendered template are sent to stdout so they can be inspected. Note that in this mode, it is not guaranteed that Kubernetes cluster will accept the generated manifest.

helm install --dry-run ...

--dry-run can be combined with --debug for more information:

helm install --dry-run --debug ...

--debug

helm install --debug ...

The --debug flag displays:

--verify

If --verify is used, the chart must have a provenance file, and the provenance file must pass all verification steps.

--atomic

Installation process purges chart on fail. The --wait flag will be set automatically if --atomic is used.

--version

Specify the exact chart version to install. If this is not specified, the latest version is installed.

--dependency-update

Run helm dependency update before installing the chart. TODO: more research here.

--name-template

Specify template used to name the release.

--output

Prints the output in the specified format. Allowed values: table, json, yaml (default table).

--wait

If set, Helm will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment, StatefulSet, or ReplicaSet are in a ready state before marking the release as successful. It will wait for as long as --timeout.

--timeout

The time to wait for any individual Kubernetes operation. The default value is 5 minutes.

--replace

Also see helm uninstall - Keep a Resource from being Uninstalled to understand implication on orphaned resources.

--username, --password

See Absolute URL of a chart in a remote repository above.

-n,--namespace

Specifies the namespace scope for this installation. Note that the namespace must exist, otherwise Helm installation will fail:

Error: create: failed to create: namespaces "test" not found

Scenarios

Using External Files during Installation

TODO:

https://github.com/helm/helm/issues/3276

Accessing Arbitrary Files inside Templates

TODO https://helm.sh/docs/chart_template_guide/accessing_files/

Also see:

Accessing Files inside Templates