Skip to main content

Packaging a Helm Chart for a Release

This topic describes how to package a Helm chart and the Replicated SDK into a chart archive that can be added to a release.

Overview

To add a Helm chart to a release, you first add the Replicated SDK as a dependency of the Helm chart and then package the chart and its dependencies as a .tgz chart archive.

The Replicated SDK is a Helm chart can be installed as a small service alongside your application. The SDK is strongly recommended because it provides access to key Replicated features, such as support for collecting custom metrics on application instances. For more information, see About the Replicated SDK.

Chart Version Requirement

The chart version in your Helm chart must comply with image tag format requirements. A valid tag can contain only lowercase and uppercase letters, digits, underscores, periods, and dashes.

The chart version must also comply with the Semantic Versioning (SemVer) specification. When you run the helm install command without the --version flag, Helm retrieves the list of all available image tags for the chart from the registry and compares them using the SemVer comparison rules described in the SemVer specification. The version that is installed is the version with the largest tag value. For more information about the SemVer specification, see the Semantic Versioning documentation.

Package a Helm Chart

This procedure shows how to create a Helm chart archive to add to a release. For more information about the Helm CLI commands in this procedure, see the Helm Commands section in the Helm documentation.

To package a Helm chart so that it can be added to a release:

  1. In your application Helm chart Chart.yaml file, add the YAML below to declare the SDK as a dependency. If your application is installed as multiple charts, declare the SDK as a dependency of the chart that customers install first. Do not declare the SDK in more than one chart.

    # Chart.yaml
    dependencies:
    - name: replicated
    repository: oci://registry.replicated.com/library
    version: 1.0.0-beta.32

    For the latest version information for the Replicated SDK, see the replicated-sdk repository in GitHub.

    For additional guidelines related to adding the SDK as a dependency, see Install the SDK as a Subchart in Installing the Replicated SDK.

  2. (Recommended) Log out of the Replicated registry:

    helm registry logout registry.replicated.com

    Replicated recommends that you log out of the Replicated registry to avoid errors that can occur when Helm attempts to pull the SDK chart from the registry if you are logged in with a license that has expired.

  3. Update dependencies and package the chart as a .tgz file:

    helm package -u PATH_TO_CHART

    Where:

    • -u or --dependency-update is an option for the helm package command that updates chart dependencies before packaging. For more information, see Helm Package in the Helm documentation.
    • PATH_TO_CHART is the path to the Helm chart in your local directory. For example, helm package -u ..

    The Helm chart, including any dependencies, is packaged and copied to your current directory in a .tgz file. The file uses the naming convention: CHART_NAME-VERSION.tgz. For example, postgresql-8.1.2.tgz.

  4. Add the .tgz file to a release. For more information, see Managing Releases with the Vendor Portal or Managing Releases with the CLI.

    After the release is promoted, your Helm chart is automatically pushed to the Replicated registry. For information about how to install a release with the Helm CLI, see Installing with Helm. For information about how to install Helm charts with KOTS, see About Distributing Helm Charts with KOTS.