configuration-as-code-plugin icon indicating copy to clipboard operation
configuration-as-code-plugin copied to clipboard

Helm and multiple kubernetes clusters

Open wrender opened this issue 3 years ago • 4 comments

Description

We are trying to setup one Jenkins in a kubernetes cluster, and that Jenkins will deploy and build software in multiple other kubernetes clusters as well.

Using helm with the Jenkins helm chart and values.yaml file I can't seem to figure out how to define multiple kubernetes clouds. I've tried something like:

jenkins:
  clouds:
  - kubernetes:
    jenkinsTunnel: "jenkins-agent.jenkins.svc.cluster.local:50000"
    jenkinsUrl: "http://jenkins.jenkins.svc.cluster.local:8080"
    name: "kubernetes"
    namespace: "jenkins-agents"
    podLabels:
      - key: "jenkins/jenkins-agent"
        value: "true"
    serverUrl: "https://kubernetes.default"
  - kubernetes:
    jenkinsTunnel: "myjenkins.domain.local:50000"
    jenkinsUrl: "http://myjenkins.domain.local:8080"
    name: "second-kubernetes-cluster"
    namespace: "jenkins-agents"
    podLabels:
      - key: "jenkins/jenkins-agent"
        value: "true"
    serverUrl: "https://remotecluster.blah.blah.blah"

(I can do it through the gui but then the kubernetes Jenkins pod restarts and it is gone.) Other config as code settings seem to work.

Does anyone have an example helm chart values.yaml of this? I couldnt seem to find one that shows multiple kubernetes clusters. Also not sure if I need a controller or what in each kubernetes cluster to make this work.

As well wanting to set it up so that certain kubernetes clouds are only accessible to certain Jenkins users. Ideally separated by folder.

wrender avatar May 25 '22 23:05 wrender

Did you find an example?

hervelemeur avatar May 27 '22 13:05 hervelemeur

No. Seems like maybe a bug too. See here https://github.com/jenkinsci/helm-charts/issues/634

wrender avatar May 27 '22 14:05 wrender

Configure in GUI and export? https://github.com/jenkinsci/configuration-as-code-plugin/blob/master/docs/features/configExport.md

jetersen avatar May 31 '22 08:05 jetersen

No. Seems like maybe a bug too. See here jenkinsci/helm-charts#634

I made a patch that may be what you were looking for: https://github.com/jenkinsci/helm-charts/pull/973

mparada-suva avatar Dec 18 '23 16:12 mparada-suva