✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Chart Publishing

Chart Publishing is the process of sharing Helm charts to repositories, enabling consistent and scalable deployment of Kubernetes applications.

Chart Publishing is the process of preparing, packaging, and distributing Helm charts to a centralized repository or registry, enabling users to easily discover, install, and manage Kubernetes applications. It involves versioning charts, validating their content, and making them accessible through a repository index or a chart registry, ensuring consistent and reliable deployment workflows for containerized applications.


Chart Packaging

Definition and Purpose

Chart packaging is the step where a Helm chart directory, containing all Kubernetes resource templates, values, and metadata, is compressed into a versioned archive file with a .tgz extension. This archive makes it easy to distribute and consume charts as a single unit.

Packaging Process

The packaging process uses the helm package command, which:

  • Validates the chart structure and required files (Chart.yaml, templates, values.yaml).
  • Compresses the chart folder into a .tgz file.
  • Automatically includes the version from Chart.yaml in the archive filename.

Example:

helm package mychart/

This generates mychart-1.0.0.tgz if the chart version is 1.0.0.

Versioning

Versioning is critical in chart publishing to manage releases and updates. The version specified in Chart.yaml follows Semantic Versioning, typically in the format MAJOR.MINOR.PATCH. Each published chart package must have a unique version to avoid conflicts and ensure proper upgrade paths.


Chart Repository Creation and Maintenance

Repository Structure

A chart repository is an HTTP server or storage location that hosts packaged charts and an index file (index.yaml). The index contains metadata for each chart version, including name, version, description, and URLs to the chart archives.

Generating the Index

The helm repo index command generates or updates the index.yaml file by scanning a directory of packaged charts. This file acts as the catalog for the repository, allowing Helm clients to search and retrieve charts.

Example:

helm repo index ./ --url https://example.com/charts

This command creates or updates the index.yaml with URLs pointing to the hosted chart archives.

Hosting the Repository

Chart repositories can be hosted on any static web server or cloud storage configured to serve files via HTTP/HTTPS, such as:

  • GitHub Pages
  • Amazon S3 buckets with static website hosting enabled
  • Google Cloud Storage
  • Azure Blob Storage

Setting appropriate permissions, enabling HTTPS, and maintaining availability are essential for a reliable repository.


Chart Publishing Workflow

Steps Overview

  1. Develop and Test: Create and validate a Helm chart locally, ensuring templates render correctly and the application deploys as expected.
  2. Package the Chart: Use helm package to bundle the chart into a .tgz archive with a proper version.
  3. Prepare the Repository: Place the packaged chart in a directory served by a web server or storage bucket.
  4. Update Repository Index: Run helm repo index to generate or update the index.yaml file with the new chart version.
  5. Publish: Upload the packaged charts and updated index.yaml to the hosting location.
  6. Verify: Add the repository with helm repo add and test installation or upgrades using helm install or helm upgrade.

Automation

Many organizations automate chart publishing using CI/CD pipelines that:

  • Run linting and tests on charts.
  • Package charts upon successful builds.
  • Update repository indexes automatically.
  • Deploy charts and indexes to repositories.
  • Integrate with Helm registries or artifact repositories.

Automation ensures accuracy, repeatability, and speeds up the release cycle.


Chart Distribution Formats and Mechanisms

Traditional Chart Repositories

Traditional Helm chart repositories use an HTTP server hosting a directory of .tgz files and an index.yaml. Helm clients pull the index.yaml to discover charts and download the archives.

OCI-based Chart Registries

Helm supports packaging and distributing charts using OCI (Open Container Initiative) registries, similar to Docker registries. This allows charts to be pushed and pulled as OCI artifacts.

Commands include:

helm chart save mychart-1.0.0.tgz myregistry.example.com/mychart:1.0.0
helm chart push myregistry.example.com/mychart:1.0.0
helm chart pull myregistry.example.com/mychart:1.0.0

Advantages of OCI registries:

  • Leverage existing container registry infrastructure.
  • Support for authentication, access control, and artifact lifecycle.
  • Simplified management of Helm charts alongside container images.

Choosing a Distribution Method

The choice between a traditional HTTP chart repository and an OCI registry depends on organizational infrastructure, security policies, and tooling preferences.


Security and Best Practices in Chart Publishing

Validation and Linting

Before publishing, charts should be validated and linted using helm lint to detect common errors, enforce standards, and ensure chart quality.

Signing Charts

Charts can be cryptographically signed to ensure integrity and authenticity. Using tools like cosign or gpg, publishers can sign charts and publish signatures alongside them.

Access Control

Repositories should enforce access control, using authentication and authorization mechanisms to restrict publishing rights and protect artifacts.

Metadata Accuracy

Accurate and complete metadata in Chart.yaml and index.yaml helps users make informed decisions and automates dependency management.

Version Management

Avoid overwriting published chart versions. Increment versions using semantic versioning to prevent deployment issues and maintain upgrade paths.


Integration with Helm Ecosystem

Chart publishing integrates tightly with Helm client commands and tooling:

  • helm repo add registers repositories with Helm.
  • helm repo update fetches the latest index files.
  • helm search repo allows querying published charts.
  • helm install and helm upgrade use published charts during deployment.

Publishing charts effectively supports Helm’s declarative, reusable, and shareable application deployment model, enabling teams to distribute Kubernetes applications reliably across environments.


Summary of Commands Used in Chart Publishing

CommandPurpose
helm package <chart>Packages a Helm chart into a .tgz archive.
helm repo indexGenerates or updates the repository index.yaml.
helm repo addAdds a chart repository to the Helm client.
helm repo updateUpdates local cache of chart repositories.
helm lint <chart>Validates the chart for errors and best practices.
helm chart saveSaves a chart as an OCI artifact.
helm chart pushPushes a chart to an OCI registry.
helm chart pullPulls a chart from an OCI registry.

Additional Considerations

Repository Metadata Caching

Clients cache the repository index to improve performance. Publishers must ensure consistent index updates and cache invalidation to prevent stale data.

Dependency Management

Charts can declare dependencies on other charts. Publishing must consider these dependencies, ensuring required charts are available in repositories.

Multi-architecture Support

Charts can include manifests for different architectures or Kubernetes versions; publishing should clearly document compatibility.


This comprehensive explanation covers all critical aspects of Chart Publishing in Helm, from packaging and repository management to security and distribution methods, facilitating robust Kubernetes application deployment workflows.