<p>Use a docker image within your pipeline that has <code>helm</code> and other tools installed.</p>

<p>To <a href="https://jenkins.io/doc/book/pipeline/docker/" rel="nofollow noreferrer">quote the docs</a>:</p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>It then gives an example that we can modify to show running helm:</p>

<pre><code>pipeline {
    agent {
        docker { image 'your_image:1.0' }
    }
    stages {
        stage('Deploy') {
            steps {
                sh 'helm list'
            }
        }
    }
}
</code></pre>

<p>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.</p>

<p>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.</p>

<p>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.  </p>

CC BY-SA 4.0
2020-01-20T12:38:57.277Z
i am using jenkins server on kubernetes meaning jenkins is running as a docker containr...now trying to use this am getting this error `Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get` what is way around this? how can i allow the daemon socket mounted with kubernetes server without having to manually allow permissions on kubernetes nodes?
uberrebu
CC BY-SA 4.0
2020-01-20T12:52:24.927Z
am getting this error `Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/containers/alpine/helm/json: dial unix /var/run/docker.sock: connect: permission denied`
uberrebu
CC BY-SA 4.0
2021-04-19T22:36:10.467Z
@uberrebu: You've been bitten by the [inability to run containers inside containers](https://stackoverflow.com/questions/66470618/how-to-run-a-container-from-within-another-container-when-building-a-tool-utilit) issue. Sorry.
Peter V. Mørch
CC BY-SA 4.0
2021-10-31T10:21:48.860Z
Hey @uberrebu, I had a similar issue. I was running jenkins inside a container. This pod has no docker installed. I needed to expose the parent's docker daemon to tcp 0.0.0.0, then go to dashboard -> Configure Clouds, and add a new docker. The address I used to connect from the 'configure cloud' page was  'tcp://172.17.0.1:2375' (my port might be a bit different). It's prob not the safest thing in the world to do but for playing around, it'll work.
Killesk
CC BY-SA 4.0
2019-01-12T22:34:46.210Z
2019-01-12T22:52:11.420Z
2019-01-12T22:52:11.420Z
simbo1905
<p>I want to deploy helm chart from Jenkins to Kubernetes but I don't find any Plugins in Jenkins for Helm.</p>

<p>How can I tell Jenkins to run Helm chart in Kubernetes ? </p>

CC BY-SA 4.0
2019-01-11T12:56:35.070Z
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
CC BY-SA 4.0
2019-01-12T15:35:37.500Z
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
<jenkins><kubernetes><jenkins-plugins><helm>
Deploy helm chart from Jenkins to Kubernetes
pioupiou
# Deploy helm chart from Jenkins to Kubernetes

(Asked by: username_0 on 2019-01-11)

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 ?

**Tags:** jenkins, kubernetes, jenkins-plugins, helm

> **Comments:**
> **username_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  
> **username_2**: 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.  

---

## 1 answers

### Answer by username_3 on 2019-01-12. Score: 2

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.

> **Comments:**
> **username_4**: i am using jenkins server on kubernetes meaning jenkins is running as a docker containr...now trying to use this am getting this error `Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get` what is way around this? how can i allow the daemon socket mounted with kubernetes server without having to manually allow permissions on kubernetes nodes?  
> **username_4**: am getting this error `Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/containers/alpine/helm/json: dial unix /var/run/docker.sock: connect: permission denied`  
> **username_5**: @username_4: You've been bitten by the [inability to run containers inside containers](https://stackoverflow.com/questions/66470618/how-to-run-a-container-from-within-another-container-when-building-a-tool-utilit) issue. Sorry.  
> **username_6**: Hey @username_4, I had a similar issue. I was running jenkins inside a container. This pod has no docker installed. I needed to expose the parent's docker daemon to tcp 0.0.0.0, then go to dashboard -> Configure Clouds, and add a new docker. The address I used to connect from the 'configure cloud' page was  'tcp://172.17.0.1:2375' (my port might be a bit different). It's prob not the safest thing in the world to do but for playing around, it'll work.  

---

