Skip to main content

Publishing Charts to Repository

1. Generating Repository Index

Command Description Options Notes
helm repo index Generate an index.yaml file for a chart repository --api-version, --cert-file, --key-file, --home, --keyring, --password, --username Creates or updates the index file for a local or remote chart repository

Example: Generate index.yaml for local repository

helm repo index /path/to/repo --url https://myrepo.example.com/charts
Note: The index.yaml file is required for Helm repositories to function properly with helm search and helm install.

2. Updating Index with New Chart

Command Description Options
helm repo index Updates the index file for a local chart repository --url to specify repo URL, --merge to merge with existing index

Example: Update index with new chart

helm repo index . --url https://myrepo.example.com/charts
Note: The index.yaml file must be updated after pushing new chart versions to the repository.
Warning: Ensure that the --url matches the repository URL to avoid incorrect chart references.

3. Setting Base URL

Property Value Description
baseURL https://my-chart-repo.com/charts The base URL where charts are hosted

Example: Setting base URL in chart metadata

apiVersion: v2
name: my-app
description: A Helm chart for my application
type: application
version: 1.0.0
appVersion: "1.0"
home: https://my-app.com
sources:
  - https://github.com/myorg/my-app
maintainers:
  - name: John Doe
    email: john.doe@example.com
    url: https://github.com/johndoe
Note: The baseURL is used by Helm to resolve chart dependencies and fetch charts from the repository.

4. Hosting Static Repository

Option Values Notes
chart.repo.url https://example.com/charts URL to the static chart repository
chart.repo.name my-charts Name of the repository in Helm

Example: Add Static Repository

helm repo add my-charts https://example.com/charts
helm repo update

Example: Install Chart from Static Repo

helm install my-app my-charts/my-app-chart
Note: Ensure the repository URL serves charts via HTTP/HTTPS and includes an index.yaml file.

5. Using GitHub Pages

GitHub Pages can be used to host a Helm chart repository. This approach is useful for open-source projects or when you want to leverage GitHub's infrastructure for hosting.

Step Description Action
1 Prepare your chart repository Create a directory structure like my-charts/ containing your chart files.
2 Generate index.yaml Run helm repo index . --url https://username.github.io/repo-name to generate the index file.
3 Commit and push to GitHub Push your chart files and index.yaml to a branch (e.g., gh-pages) in your repository.
4 Enable GitHub Pages In your repository settings, enable GitHub Pages and set the source to the gh-pages branch.

Example: Publishing a Chart to GitHub Pages

helm repo index . --url https://myuser.github.io/my-helm-charts
git add .
git commit -m "Update chart index"
git push origin gh-pages
Note: Ensure that the --url matches your GitHub Pages URL to avoid broken links in the chart index.
Warning: GitHub Pages is not designed for high-traffic chart repositories. For production use, consider using a dedicated chart repository server or cloud storage (e.g., AWS S3).

6. Publishing to ChartMuseum

Property Value Description
chartmuseum.url http://localhost:8080 URL of the ChartMuseum server
chartmuseum.username admin Username for ChartMuseum authentication
chartmuseum.password password Password for ChartMuseum authentication

Example: Publishing Chart to ChartMuseum

helm repo add chartmuseum http://localhost:8080
helm repo update
helm push mychart-1.0.0.tgz chartmuseum
Note: Ensure ChartMuseum is running and accessible before publishing.
Warning: ChartMuseum does not support HTTPS by default. Use with caution in production.

7. Publishing to Harbor

Property Description Example
harbor.repo.url URL of the Harbor repository https://my-harbor.com/chartrepo/myproject
harbor.repo.username Username for Harbor authentication admin
harbor.repo.password Password for Harbor authentication my-secret-password

Example: Pushing Chart to Harbor

helm package my-chart
helm repo add my-harbor https://my-harbor.com/chartrepo/myproject
helm registry login -u admin -p my-secret-password https://my-harbor.com
helm push my-chart-1.0.0.tgz my-harbor
Note: Ensure the Harbor repository is configured to accept chart uploads.
Warning: Helm v3.12+ supports helm push for OCI registries including Harbor.

8. Publishing to Artifactory

Property Description Example
helm repo add Adds a repository to the local Helm client helm repo add artifactory https://artifactory.example.com/artifactory/helm
helm repo update Updates the local cache of repository information helm repo update
helm package Packages a chart into a .tgz file for publishing helm package mychart/
helm push Pushes a chart to an Artifactory repository (requires helm-push plugin) helm push mychart-1.0.0.tgz artifactory

Example: Publishing Chart to Artifactory

helm repo add artifactory https://artifactory.example.com/artifactory/helm
helm repo update
helm package mychart/
helm push mychart-1.0.0.tgz artifactory
Note: Ensure the helm-push plugin is installed to support publishing to Artifactory repositories.
Warning: Make sure the repository URL and credentials are correctly configured in your Helm client before publishing.

9. Automating Repository Updates

Example: Using GitHub Actions for Chart Publishing

name: Publish Helm Chart
on:
  push:
    branches:
      - main
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Helm
        uses: azure/setup-helm@v3
      - name: Package chart
        run: helm package .
      - name: Push to repository
        run: helm repo add my-repo https://my-chart-repo.com && helm repo update
Step Description Action
1. Package Chart Creates a .tgz archive of the chart helm package .
2. Add Repo Registers the chart repository helm repo add <name> <url>
3. Update Repo Syncs local cache with remote repo helm repo update
Note: Ensure the repository URL is accessible and credentials are configured for private repos.

Best Practices

  • Use CI/CD pipelines to automate chart publishing
  • Validate chart before packaging with helm lint
  • Version charts semantically using helm package --version

10. Managing Repository Versions

Version Type Description Notes
v3.15.0 Stable Latest stable release Full support for OCI registries
v3.14.0 Stable Previous stable release Improved chart dependency handling
v3.13.0 Stable Previous stable release New subchart support features

Example: Chart Versioning

apiVersion: v2
name: my-app
description: A Helm chart for my application
version: 1.2.3
appVersion: "1.0.0"
Note: Helm follows semantic versioning (SemVer) for chart versions.
Warning: Never reuse a version number once it has been published.

Version Management Best Practices

  • Use semantic versioning (e.g., 1.2.3)
  • Increment version numbers for each release
  • Do not reuse version numbers in the same repository
  • Keep appVersion separate from chart version

Was this article helpful?