0
0
KubernetesHow-ToBeginner · 4 min read

How to Create a Helm Repository: Step-by-Step Guide

To create a Helm repository, package your Helm charts using helm package and host them on a web server or object storage. Then, create an index.yaml file using helm repo index to list your charts, making the repository accessible via HTTP.
📐

Syntax

Creating a Helm repository involves two main commands:

  • helm package [chart_directory]: Packages your Helm chart into a versioned archive.
  • helm repo index [directory] --url [repository_url]: Generates an index.yaml file that lists all charts in the directory and sets the repository URL.

Host the directory with the packaged charts and index.yaml on a web server accessible via HTTP.

bash
helm package ./mychart
helm repo index ./ --url https://example.com/helm-charts
💻

Example

This example shows how to create a Helm repository from a local chart and serve it using a simple web server.

bash
mkdir helm-repo
cp -r ./mychart helm-repo/
cd helm-repo
helm package ./mychart
helm repo index ./ --url https://example.com/helm-repo
# Now host the helm-repo directory on a web server, e.g., using Python's simple HTTP server:
python3 -m http.server 8080
Output
Successfully packaged chart and saved it as mychart-0.1.0.tgz Created index.yaml for repository at https://example.com/helm-repo Serving HTTP on 0.0.0.0 port 8080 ...
⚠️

Common Pitfalls

  • Not hosting over HTTP/HTTPS: Helm requires the repository to be accessible via HTTP or HTTPS, not just a local file path.
  • Incorrect --url in helm repo index: The URL must point to where the charts and index.yaml are hosted, or Helm clients cannot find the charts.
  • Forgetting to update index.yaml: When adding new charts, always regenerate index.yaml to include them.
bash
## Wrong way (missing --url):
helm repo index ./

## Right way:
helm repo index ./ --url https://example.com/helm-repo
📊

Quick Reference

Steps to create and serve a Helm repository:

  • Package charts: helm package ./chart-dir
  • Generate index: helm repo index ./ --url https://your-domain/path
  • Host files on HTTP server
  • Add repo to Helm client: helm repo add myrepo https://your-domain/path

Key Takeaways

Package your Helm charts with 'helm package' before creating the repository index.
Use 'helm repo index' with the correct URL to generate the repository index file.
Host your packaged charts and index.yaml on a web server accessible via HTTP or HTTPS.
Always update the index.yaml when adding or removing charts from the repository.
Add the repository URL to your Helm client to install charts from your repository.