GitOps with FluxCD

Helm Controller and OCI Registry

DEMO HELM Controller with Helm Repository as Source

In this walkthrough, we’ll package a Helm chart as a .tgz artifact, host it in a Helm repository (via GitHub Pages and Artifact Hub), then use Flux’s Source Controller and Helm Controller to automate its deployment.


1. Helm Chart Package on GitHub Releases

We’ve bundled our application into block-buster-helm-app-7.6.0.tgz and published it on the GitHub Releases page. Below is an example of the default values.yaml included in the chart:

# Sample values.yaml (for reference)
replicaCount: 1

service:
  type: NodePort
  nodePort: 30006

namespace:
  name: 6-demo

This image shows a GitHub release page for the "block-buster-helm-app" version 7.6.0, with assets available for download.


2. Chart Listing on Artifact Hub

Our chart is also discoverable on Artifact Hub. Artifact Hub provides metadata, download statistics, and security reports for Helm charts.

# Extended sample values.yaml
replicaCount: 1

service:
  type: NodePort
  nodePort: 30006

namespace:
  name: 6-demo

labels:
  app:
    name: block-buster
    version: 7.6.0
    env: dev
FeatureDescription
Repository URLhttps://sidd-harth.github.io/block-buster-helm-app
Chart Version7.6.0
Maintainersidd-harth
Install Commandhelm install my-app block-buster-app --version 7.6.0

The image shows a webpage from Artifact Hub displaying a search result for a Helm chart named "block-buster-helm-app." It includes details like the repository, publisher, and version information.

The image shows a dashboard from Artifact Hub displaying a bar chart of package views over the last 30 days, along with related package information and a security report indicating vulnerabilities.

You could install manually:

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

3. Defining a HelmRepository in Flux

To automate updates, Flux’s Source Controller can track the Helm repository for new chart versions.

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 1m \
  --timeout 10s \
  --export > 6-demo-source-helm-bb-app.yaml

This generates:

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
  name: 6-demo-source-helm-bb-app
  namespace: flux-system
spec:
  url: https://sidd-harth.github.io/block-buster-helm-app
  interval: 1m0s
  timeout: 10s

Note

Adjust --interval and --timeout to suit your release cadence and network conditions.


4. Customizing Chart Values

Create a file named 6-demo-values.yaml to override default settings:

replicaCount: 2

service:
  type: NodePort
  nodePort: 30006

namespace:
  name: 6-demo

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

Save it alongside your Flux manifests.


5. Creating a HelmRelease with Flux

Now define a HelmRelease to instruct Flux’s Helm Controller to deploy the chart:

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.yaml \
  --export > 6-demo-helm-release-bb-app.yaml

Generated manifest:

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

6. Committing to Git and Triggering Flux

git add \
  6-demo-source-helm-bb-app.yaml \
  6-demo-helm-release-bb-app.yaml \
  6-demo-values.yaml

git commit -m "Add HelmRepository and HelmRelease for block-buster-app v7.6.0"
git push

Flux will detect the new manifests and begin reconciliation.


7. Verifying Flux Resources

Check the status of your HelmRepository:

flux get sources helm -n flux-system

NAME                          READY  MESSAGE
6-demo-source-helm-bb-app     True   stored artifact: revision 'sha256:...'

List all source types:

flux get sources -A

Inspect your HelmRelease:

flux get helmreleases -A

NAME                          READY  MESSAGE
6-demo-helm-release-bb-app    True   Release reconciliation succeeded

8. Exploring Source Controller Data

Enter the source-controller pod to view how Flux stores chart artifacts:

The image shows a Visual Studio Code interface with a terminal open at the bottom and a YAML file being edited. The terminal is in a directory related to a Kubernetes cluster setup.

kubectl -n flux-system exec deploy/source-controller -- sh
/data$ ls -d */
gitrepository/  bucket/  helmchart/  helmrepository/
/data$ cd helmrepository/flux-system/6-demo-source-helm-bb-app/
/data/helmrepository/...$ cat index-*.yaml
/data$ cd ../helmchart/flux-system/6-demo-helm-release-bb-app/
/data/...$ tar -tf latest.tar.gz
# Shows Chart.yaml, values.yaml, templates/, etc.
ResourceStored Data
HelmRepositoryIndex files (versions, URLs)
HelmChartUnpacked chart with templates & defaults

9. Validating the Deployment

Once reconciled, Flux will create the target namespace (6-demo) and deploy your app:

kubectl -n 6-demo get all

You should see:

  • 2 Pods (as per replicaCount)
  • A Deployment
  • A NodePort Service on port 30006

Access the game in your browser:

http://<node-ip>:30006

The image shows a "Block Buster" game interface with colorful blocks, a paddle, and a ball. It includes game details like level, score, and lives, along with some technical information about the app.

Try It Out

Starting with version 7.6.0, Block Buster introduces multiple levels. Complete Level One to unlock Level Two!


Congratulations—you’ve automated the deployment of a Helm chart .tgz artifact using Flux’s Helm Controller and Source Controller!

Watch Video

Watch video content

Practice Lab

Practice lab

Previous
DEMO HELM Controller with Git as Source