Skip to content

FluxCD HelmRelease — declarative Helm via GitOps

Drive Helm releases from Git with FluxCD HelmRelease — sources, repository controller, dependency ordering, and the operator pattern we deploy.

FluxCD’s HelmRelease is the GitOps-native way to manage Helm releases on Kubernetes. A HelmRelease is a custom resource: it points at a chart source, a values snippet, and a target, and the helm-controller reconciles the actual release against the desired definition. Unlike helm install from a CI pipeline, the reconciler runs in-cluster on a loop — drift is automatically corrected, and the source of truth is a git commit, not a Tiller-style imperative call. This article covers the controller install, the HelmRelease lifecycle, dependency ordering, and the operational gotchas we hit in production.

How to verify

flux get sources helm
flux get helmreleases -A
kubectl get helmrelease -n monitoring kube-prometheus-stack -o yaml
flux reconcile helmrelease kube-prometheus-stack -n monitoring --with-source
helm list -A
kubectl -n flux-system logs deploy/helm-controller --tail=200

flux reconcile forces an out-of-band reconciliation; useful when you’ve just pushed a change to the source repo and don’t want to wait the default 10-minute interval. The controller logs surface chart pull failures and template render errors that don’t appear on the HelmRelease status if you don’t look.

What’s happening

FluxCD splits Helm into three pieces:

  • HelmRepository (managed by source-controller) — points at a Helm chart repo URL; pulls the index periodically and caches it.
  • HelmChart (auto-created by helm-controller from a HelmRelease) — pins a specific chart name + version from a HelmRepository.
  • HelmRelease (managed by helm-controller) — declares the desired release: chart reference, values, target namespace, upgrade strategy, dependencies.

The helm-controller runs helm install or helm upgrade to reconcile. It keeps the Helm secret in the target namespace just like a normal helm install, so helm list -A shows the release exactly as if a human had installed it. Drift correction means: if someone kubectl edits a deployment that Helm manages, the next reconciliation re-applies the chart and reverts the edit.

The two key behaviors:

  1. spec.interval is how often the controller re-reconciles. Default 5-15 minutes; for prod releases we typically use 10m. Lower means faster drift correction but more API server load.
  2. spec.install / spec.upgrade / spec.rollback control retry and rollback. Set upgrade.remediation.retries: 3 so a flaky upgrade retries; set rollback.enable: true so a failed upgrade auto-rolls-back.

The procedure

  1. Install Flux. Boot the controllers and bootstrap the repo:

    flux check --pre
    flux bootstrap github \
      --owner=acme --repository=platform \
      --branch=main --path=clusters/prod \
      --personal=false --components-extra=image-reflector-controller,image-automation-controller
  2. HelmRepository — clusters/prod/sources/prometheus-community.yaml:

    apiVersion: source.toolkit.fluxcd.io/v1
    kind: HelmRepository
    metadata:
      name: prometheus-community
      namespace: flux-system
    spec:
      interval: 1h
      url: https://prometheus-community.github.io/helm-charts
  3. HelmRelease — clusters/prod/apps/monitoring/kube-prometheus-stack.yaml:

    apiVersion: helm.toolkit.fluxcd.io/v2
    kind: HelmRelease
    metadata:
      name: kube-prometheus-stack
      namespace: monitoring
    spec:
      interval: 10m
      timeout: 15m
      chart:
        spec:
          chart: kube-prometheus-stack
          version: "59.x"           # or pinned "59.0.0"
          sourceRef:
            kind: HelmRepository
            name: prometheus-community
            namespace: flux-system
          interval: 1h
      install:
        crds: CreateReplace
        remediation:
          retries: 3
      upgrade:
        crds: CreateReplace
        cleanupOnFail: true
        remediation:
          retries: 3
          remediateLastFailure: true
      rollback:
        cleanupOnFail: true
      valuesFrom:
        - kind: ConfigMap
          name: kps-values
        - kind: Secret
          name: kps-secret-values
          valuesKey: values.yaml
      values:
        grafana:
          enabled: true
          persistence:
            enabled: true
            size: 20Gi

    valuesFrom lets you keep secret values in a Secret (managed by SOPS or Sealed Secrets — see /en/knowledge-base/gitops-secrets-sealed-sops-external/) and non-secret values in a ConfigMap or inline.

  4. Dependencies. When release A must be installed before release B:

    spec:
      dependsOn:
        - name: cert-manager
          namespace: cert-manager

    The controller waits for the named HelmRelease to be Ready before installing this one. Cyclic dependencies are rejected at admission.

  5. Image automation (optional). Pair with ImagePolicy to auto-bump image tags inside HelmRelease values:

    spec:
      values:
        image:
          tag: 1.42.3 # {"$imagepolicy": "apps:my-app:tag"}

    The image-reflector and image-automation controllers track the registry, decide a new tag is the policy match, and commit the change to git. Flux then reconciles.

  6. CRD handling. Charts that include CRDs need explicit handling — install.crds: CreateReplace says “create CRDs on install, update them on upgrade”. Without this, CRD updates are skipped and the chart starts shipping resources the cluster doesn’t understand.

  7. Reconciliation cadence. flux suspend helmrelease NAME -n NS halts reconciliation for that release — useful when you’re debugging and don’t want Flux to revert your manual changes. flux resume brings it back.

Operational notes

  • Status conditions are the diagnostic. kubectl get helmrelease X -o yaml | yq '.status.conditions' shows Ready, Reconciling, and last-applied chart version. The error text in Released is the actual helm upgrade output.
  • spec.timeout: 5m is the default — large charts (Kafka Strimzi, KubeVirt) routinely take longer. Bump to 15-20m.
  • Helm secret bloat. Every release stores its history as a Helm secret; with maxHistory: 10 (controller default), you accumulate 10 secrets per release. For high-churn releases, set spec.install.disableWait: false and historyMax: 3.
  • spec.chart.spec.interval is separate from spec.interval. Chart interval is how often source-controller re-pulls the chart; release interval is how often helm-controller reconciles the release. Mismatch causes “I bumped the version, why isn’t it applying” — increase chart pull frequency.
  • CRDs from another release. A HelmRelease that needs CRDs from cert-manager must dependsOn cert-manager. Without the dependency, the install races; the CRDs may not exist when the dependent chart renders.

Common pitfalls

  • spec.values and spec.valuesFrom collision. Both are merged but the order matters; the last entry wins. Document your order or you’ll spend an afternoon hunting an override.
  • Chart version range with ~ or ^. Reconciliations resolve to “newest matching” — you’ll silently upgrade on every chart push. Pin to an exact version in prod.
  • HelmRelease without dependsOn, deployment depends on namespace from another release. Race condition; works on a quiet cluster, fails under load.
  • Suspended HelmRelease that nobody resumes. Drift stays uncorrected; alert on flux get helmreleases -A showing Suspended longer than expected.
  • Helm secrets too large for etcd. Charts with thousands of templated lines hit the 1 MiB secret limit. Use Helm chart’s --reuse-values strategy (upgrade.disableTakeOwnership: false) or break the chart into sub-releases.

We operate FluxCD as the GitOps reconciler for many Kubernetes engagements where the client wants the controller pattern rather than the CI-driven Helmfile pattern. The controllers, the source/release split, image automation, and the runbook for “HelmRelease stuck Reconciling” are part of /en/services/managed-operations/. For engagements that prefer Argo CD’s app-of-apps model, see /en/knowledge-base/argocd-gitops-application-pattern/ — same reconciler concept, different UX and primitives.