1

I want to deploy helm chart from Jenkins to Kubernetes but I don't find any Plugins in Jenkins for Helm.

How can I tell Jenkins to run Helm chart in Kubernetes ?

  • 1
    you can create an docker images with kubectl and helm installed, now you can use this images from jenkins, kind mind to configure helm to access to specific namespace and not to give access to all resources in your cluster – c4f4t0r Jan 11 at 12:56
  • Did you try to just run helm install on jenkins? I think that it should work to just run a helm command if jenkins is authenticated to the k8s cluster. – 030 Jan 12 at 15:35
1

Use a docker image within your pipeline that has helm and other tools installed.

To quote the docs:

Pipeline is designed to easily use Docker images as the execution environment for a single Stage or the entire Pipeline. Meaning that a user can define the tools required for their Pipeline, without having to manually configure agents. Practically any tool which can be packaged in a Docker container. can be used with ease by making only minor edits to a Jenkinsfile.

It then gives an example that we can modify to show running helm:

pipeline {
    agent {
        docker { image 'your_image:1.0' }
    }
    stages {
        stage('Deploy') {
            steps {
                sh 'helm list'
            }
        }
    }
}

This is a total game changer. Docker is the plugin to end all plugins. Before Docker you had to find a plug-in written in Java that to exposes a DSL to be scriptable in a Groovy sandbox. That was because it was not secure or scalable to let you simply run your own tools and scripts on a shared Jenkins. You were not even allowed use the full power of Groovy or Java. With Docker it is safe run any script or tools. So you no longer have the indirection of Java plugins and you can use the full power of any Linux tool on any Linux distro.

This approach is exactly how new cloud based build engines work. With bitbucket.com pipelines and cricleci.com you don’t need any plugins. You simply say which containers to use and what commands to run within them just like the example above. The build engine simply checks out the code where the docker container can see it.

Once you have used Docker based builds for a while doing it the old way feels very restricted and limiting. For example consider having to move files around in the build. In a pipeline with Groovy if you are new to Jenkins you have to look at a huge amount of (very ugly) documentation to just to basic things. If you use docker you can simply use standard bash and Linux commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.