Search code examples
kuberneteskubernetes-helmgitops

GitOps (Flex) install of standard Jenkins Helm chart in Kubernetes via HelmRelease operator


I've just started working with Weavework's Flux GitOps system in Kubernetes. I have regular deployments (deployments, services, volumes, etc.) working fine. I'm trying for the first time to deploy a Helm chart.

I've followed the instructions in this tutorial: https://github.com/fluxcd/helm-operator-get-started and have its sample service working after making a few small changes. So I believe that I have all the right tooling in place, including the custom HelmRelease K8s operator.

I want to deploy Jenkins via Helm, which if I do manually is as simple as this Helm command:

helm install --set persistence.existingClaim=jenkins --set master.serviceType=LoadBalancer jenkins stable/jenkins

I want to convert this to a HelmRelease object in my Flex-managed GitHub repo. Here's what I've got, per what documentation I can find:

apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
  name: jenkins
  namespace: jenkins
updating-applications/
    fluxcd.io/ignore: "false"
spec:
  releaseName: jenkins
  chart:
    git: https://github.com/helm/charts/tree/master
    path: stable/jenkins
    ref: master
  values:
    persistence:
        existingClaim: jenkins
    master:
        serviceType: LoadBalancer

I have this in the file 'jenkins/jenkins.yaml' from the root of the location in my git repo that Flex is monitoring. Adding this file does nothing...I get no new K8s objects, no HelmRelease object, and no new Helm release when I run "helm list -n jenkins".

I see some mention of having to have 'image' tags in my 'values' section, but since I don't need to specify any images in my manual call to Helm, I'm not sure what I would add in terms of 'image' tags. I've also seen examples of HelmRelease definitions that don't have 'image' tags, so it seems that they aren't absolutely necessary.

I've played around with adding a few annotations to my 'metadata' section:

annotations:
#    fluxcd.io/automated: "true"
    # per: https://blog.baeke.info/2019/10/10/gitops-with-weaveworks-flux-installing-and-updating-applications/
    fluxcd.io/ignore: "false"

But none of that has helped to get things rolling. Can anyone tell me what I have to do to get the equivalent of the simple Helm command I gave at the top of this post to work with Flex/GitOps?


Solution

  • Have you tried checking the logs on the fluxd and flux-helm-operator pods? I would start there to see what error message you're getting. One thing that i'm seeing is that you're using https for git. You may want to double check, but I don't recall ever seeing any documentation configuring chart pulls via git to use anything other than SSH. Moreover, I'd recommend just pulling that chart from the stable helm repository anyhow:

    apiVersion: helm.fluxcd.io/v1
    kind: HelmRelease
    metadata:
      name: jenkins
      namespace: jenkins
      annotations: #not sure what updating-applications/ was?
        fluxcd.io/ignore: "false" #pretty sure this is false by default and can be omitted
    spec:
      releaseName: jenkins
      chart:
        repository: https://kubernetes-charts.storage.googleapis.com/
        name: jenkins
        version: 1.9.16
      values:
        persistence:
            existingClaim: jenkins
        master:
            serviceType: LoadBalancer