> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Demo Helm Controller with Helm Repository as Source

> Demonstrates using Flux HelmRepository and HelmRelease to deploy a packaged Helm chart from a Helm repository, including values, artifact fetching, and verification

In the previous lesson we covered Helm charts and how to deploy them in a Kubernetes cluster using Flux's HelmRelease controller. In this lesson we'll deploy a packaged Helm chart (.tgz) that is published in a Helm repository (hosted via GitHub Pages / Artifact Hub). We'll use Flux's source-controller Helm API to register the Helm repository and a HelmRelease to install the chart into the cluster.

This demo uses a packaged Helm chart (block-buster-helm-app) published as a GitHub Release and indexed on Artifact Hub. The release contains the Helm artifact `block-buster-helm-app-7.6.0.tgz` and a sample `values.yaml`.

![A dark‑theme GitHub releases page for the repository "sidd-harth/block-buster-helm-app" showing the 7.6.0 release. The page lists assets including a block-buster-helm-app-7.6.0.tgz and source code archives.](https://mintcdn.com/kodekloud-c4ac6d9a/AyhVWHpoMIYCWiei/images/GitOps-with-FluxCD/Helm-Controller-and-OCI-Registry/Demo-Helm-Controller-with-Helm-Repository-as-Source/github-release-block-buster-helm-760.jpg?fit=max\&auto=format\&n=AyhVWHpoMIYCWiei\&q=85\&s=440c00e2b78e4615028e9a4c8050f01b)

Artifact Hub lists the package entry (this version does not include a README in Artifact Hub):

![A dark-themed ArtifactHUB package page screenshot showing the message "This package version does not provide a README file" and a bar chart of views over the last 30 days. The right sidebar shows chart version and a security report with vulnerability counts, and related packages are listed below.](https://mintcdn.com/kodekloud-c4ac6d9a/AyhVWHpoMIYCWiei/images/GitOps-with-FluxCD/Helm-Controller-and-OCI-Registry/Demo-Helm-Controller-with-Helm-Repository-as-Source/artifacthub-package-no-readme-views-vulns.jpg?fit=max\&auto=format\&n=AyhVWHpoMIYCWiei\&q=85\&s=7ea50e58faed612ababdc6b01b9cd2f2)

You can install the chart locally with Helm for quick testing:

```bash theme={null}
helm repo add block-buster-app https://sidd-harth.github.io/block-buster-helm-app/
helm install my-block-buster-helm-app block-buster-app/block-buster-helm-app --version 7.6.0
```

In this lesson we will instead register the Helm repository with Flux, create a HelmRelease that references that HelmRepository, and let Flux reconcile and install the chart.

***

## Overview of the steps

1. Create a `HelmRepository` source in Flux.
2. Prepare a `values.yaml` (optional customization).
3. Create a `HelmRelease` that references the `HelmRepository`.
4. Inspect how Flux source-controller stores index and chart artifacts.
5. Verify the HelmRelease and the deployed resources.

***

## 1) Create a HelmRepository source in Flux

Register the Helm repository URL (the GitHub Pages URL shown on Artifact Hub) using a `HelmRepository` resource. You can either write the manifest directly or use the `flux` CLI to create/export it.

Example `HelmRepository` manifest:

```yaml theme={null}
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
  name: 6-demo-source-helm-bb-app
  namespace: flux-system
spec:
  interval: 1m0s
  url: https://sidd-harth.github.io/block-buster-helm-app
```

Create/export with the flux CLI:

```bash theme={null}
cd block-buster/flux-clusters/dev-cluster/

flux create source helm 6-demo-source-helm-bb-app \
  --url https://sidd-harth.github.io/block-buster-helm-app \
  --interval 1m0s \
  --timeout 10s \
  --export > 6-demo-source-helm-bb-app.yml
```

This registers the Helm repository as a Flux source. The source-controller will periodically fetch the repository `index.yaml` and store a local artifact.

***

## 2) Prepare a values file for the release

Create a values file (for example `6-demo-values.yml`) to override chart defaults. This demo sets two replicas, uses `NodePort` service on port `30006`, and injects labels and namespace configuration.

Example `6-demo-values.yml`:

```yaml theme={null}
replicaCount: 2

service:
  type: NodePort
  nodePort: 30006

namespace:
  name: 6-demo

labels:
  app:
    name: block-buster
    version: 7.6.0
    env: dev
```

Remember to save the values file before running the `flux create helmrelease` command that references it — otherwise the CLI export won't include the values.

***

## 3) Create a HelmRelease that uses the HelmRepository source

Declare which chart and version to install, the target namespace, and the values file with a `HelmRelease`. You can create/export it with the `flux` CLI:

```bash theme={null}
flux create helmrelease 6-demo-helm-release-bb-app \
  --chart block-buster-helm-app \
  --interval 10s \
  --target-namespace 6-demo \
  --source HelmRepository/6-demo-source-helm-bb-app \
  --values ../../../6-demo-values.yml \
  --export > 6-demo-helm-release-bb-app.yml
```

Example exported `HelmRelease` manifest:

```yaml theme={null}
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: 6-demo-helm-release-bb-app
  namespace: flux-system
spec:
  chart:
    spec:
      chart: block-buster-helm-app
      reconcileStrategy: ChartVersion
      sourceRef:
        kind: HelmRepository
        name: 6-demo-source-helm-bb-app
  interval: 10s
  targetNamespace: 6-demo
  values:
    labels:
      app:
        env: dev
        name: block-buster
        version: 7.6.0
    namespace:
      name: 6-demo
    replicaCount: 2
    service:
      nodePort: 30006
      type: NodePort
```

Apply both the `HelmRepository` and `HelmRelease` manifests to your cluster (commit to the Git repo Flux watches or apply directly with `kubectl`).

***

## 4) How Flux source-controller fetches Helm artifacts (explanation)

* The `HelmRepository` resource tells source-controller to fetch the repository `index.yaml` from the Helm repo URL. The `index.yaml` maps chart names and versions to artifact URLs (for example, a GitHub Releases tarball URL).
* The `HelmRepository` artifact stored by source-controller contains index metadata and the URLs, but not the expanded chart contents.
* When a `HelmRelease` references a chart from that `HelmRepository`, the Helm controller creates a `HelmChart` reference and source-controller fetches the chart tarball (`.tgz`) and stores it as a HelmChart artifact. That tarball contains `Chart.yaml`, `values.yaml`, `templates/`, README, etc. — the actual chart contents that Helm will render.

Inspecting what source-controller stores:

1. Check the registered Flux Helm sources and readiness:

```bash theme={null}
flux get sources helm
# sample output:
# NAME                            REVISION              SUSPENDED   READY   MESSAGE
# 6-demo-source-helm-bb-app       sha256:09c7427d       False       True    stored artifact: revision 'sha256:09c7427d'
```

2. Exec into the source-controller pod to inspect on-disk artifacts:

```bash theme={null}
kubectl -n flux-system exec -it deployment/source-controller -- sh

# inside the container
cd /data/helmrepository/flux-system/6-demo-source-helm-bb-app
cat index.yaml
```

Sample trimmed `index.yaml` entry (shows the tarball URL):

```yaml theme={null}
apiVersion: v1
entries:
  block-buster-helm-app:
  - apiVersion: v2
    created: "2023-02-05T00:08:28.841396167+05:30"
    description: A Helm chart for Block Buster App
    digest: 2834bc26665ebfe199facd19fb0211565b003c8f2f0b13d77a9000c68abbe4f7
    name: block-buster-helm-app
    urls:
    - https://github.com/sidd-harth/block-buster-helm-app/releases/download/7.6.0/block-buster-helm-app-7.6.0.tgz
    version: 7.6.0

generated: "2023-02-05T00:08:28.840851262+05:30"
```

3. When the chart is fetched for the `HelmRelease`, the helmchart directory contains the downloaded artifact. You can list and inspect the tarball:

```sh theme={null}
cd /data/helmchart/flux-system/flux-system-6-demo-helm-release-bb-app
ls -ltr
# latest.tar.gz -> .../block-buster-helm-app-7.6.0.tgz
tar -tf latest.tar.gz
```

Sample tar listing:

```text theme={null}
block-buster-helm-app/Chart.yaml
block-buster-helm-app/values.yaml
block-buster-helm-app/templates/NOTES.txt
block-buster-helm-app/templates/_helpers.tpl
block-buster-helm-app/templates/deployment.yaml
block-buster-helm-app/templates/namespace.yaml
block-buster-helm-app/templates/service.yaml
block-buster-helm-app/README.md
```

Summary of the difference:

| Flux resource | What it stores | Purpose in this flow |
| - | - | - |
| `HelmRepository` | Helm repository index metadata (`index.yaml`) and chart URLs | Registers a remote Helm repo so Flux can discover charts |
| `HelmChart` (artifact created for a chart/version) | The downloaded chart package (`.tgz`) containing `Chart.yaml`, `values.yaml`, templates | The actual chart contents used by Helm to render templates |
| `HelmRelease` | Desired chart/version + values + reconcile strategy | Declares the intended release to be installed into the cluster |

***

## 5) Verify the HelmRelease and deployed resources

After committing/applying the manifests, Flux will reconcile and install the release.

Check HelmReleases:

```bash theme={null}
flux get helmreleases
# sample output:
# NAME                                REVISION  SUSPENDED  READY  MESSAGE
# 6-demo-helm-release-bb-app          7.6.0     False      True   Release reconciliation succeeded
```

Verify the namespace and resources — the `HelmRelease` targeted `targetNamespace: 6-demo`, `replicaCount=2`, and `nodePort=30006`:

```bash theme={null}
kubectl get namespaces
kubectl -n 6-demo get all
# sample output:
# NAME                                        READY   STATUS    RESTARTS   AGE
# pod/block-buster-helm-app-xxxxx             1/1     Running   0          5m
# pod/block-buster-helm-app-yyyyy             1/1     Running   0          5m
#
# NAME                        TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)           AGE
# service/block-buster-helm-app NodePort   10.108.248.3    <none>        80:30006/TCP      5m
#
# NAME                                  READY   UP-TO-DATE   AVAILABLE   AGE
# deployment.apps/block-buster-helm-app 2/2     2            2           5m
```

Access the application in the browser at `http://localhost:30006` (or the appropriate node IP and nodePort) to confirm the running app and version.

The application UI (Block Buster demo) is accessible and interactive:

![A colorful "BLOCK BUSTER" arcade-style Breakout screen showing rows of colored bricks, a paddle and a ball. The top panel displays pod/app info (Pod Name, Pod IP, Namespace, K8S Node, App Version) with level, score and lives, and a "START GAME" button at the bottom.](https://mintcdn.com/kodekloud-c4ac6d9a/AyhVWHpoMIYCWiei/images/GitOps-with-FluxCD/Helm-Controller-and-OCI-Registry/Demo-Helm-Controller-with-Helm-Repository-as-Source/k8s-breakout-arcade-pod-info.jpg?fit=max\&auto=format\&n=AyhVWHpoMIYCWiei\&q=85\&s=358e14615516d993308485e2d69ce383)

Using `NodePort` exposes the application on cluster nodes — ensure this is acceptable for your environment. For production, consider `LoadBalancer` services or an Ingress controller with authentication and TLS.

***

## Summary

* Registered a Helm repository in Flux using a `HelmRepository` source.
* Prepared a `values` file and created a `HelmRelease` that points to the `HelmRepository`.
* The source-controller fetched the repository `index.yaml` (which contains chart URLs). When the `HelmRelease` reconciled, Flux fetched the `.tgz` chart package and installed it into the cluster.
* Deployed application version `7.6.0` is running in namespace `6-demo` with two replicas and NodePort `30006`.

***

## Links and references

* Flux CLI and docs: [https://fluxcd.io/docs/flux-cli/](https://fluxcd.io/docs/flux-cli/)
* Flux source-controller: [https://fluxcd.io/docs/components/source/](https://fluxcd.io/docs/components/source/)
* Flux Helm controller (HelmRelease): [https://fluxcd.io/docs/components/helm/helmrelease/](https://fluxcd.io/docs/components/helm/helmrelease/)
* Artifact Hub: [https://artifacthub.io/](https://artifacthub.io/)
* GitHub Releases: [https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases)

That's it for this lesson — deploying a packaged Helm chart from a Helm repository using Flux's HelmRepository and HelmRelease.

> **[Watch Video](https://learn.kodekloud.com/user/courses/gitops-with-fluxcd/module/205ec7c7-4cb6-4ecb-9bb5-fa50419f1e68/lesson/ecf68189-22e7-42cb-8d37-42c920fc6eff)**

> **[Practice Lab](https://learn.kodekloud.com/user/courses/gitops-with-fluxcd/module/205ec7c7-4cb6-4ecb-9bb5-fa50419f1e68/lesson/a5be4a2b-b5d7-46ea-9b43-c41d097ba161)**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.