Hey everyone! I have a decent grasp of Kubernetes but I'm new to Jenkins, and I'm seeking some guidance. I've recently started a new job where I need to work with Jenkins. I know it might not be the trendiest tool out there, but that's what we have to work with. My goal is to run a Jenkins agent similarly to how a GitLab runner works—polling for jobs or tasks, and executing them in the same cluster and namespace as the agent, using the right service account. Eventually, I want to be able to run `helm install` commands using that Jenkins executor. Has anyone set something like this up and can offer some advice? Thanks a lot!
2 Answers
You should check out the Kubernetes plugin for Jenkins. It can automatically spawn Jenkins executors whenever a new job is created, and the documentation is pretty comprehensive. During our transition to Jenkins on Kubernetes, we found that most of our existing jobs worked without any issues. I suggest creating custom agent images with the tools you need already installed, as we did. This way, you can easily configure the pod templates in Jenkins to match your old environment and make `helm install` operations more straightforward by adjusting the service account permissions accordingly. Good luck with your setup!
I totally understand the struggle! I had to manage and modernize a large Jenkins deployment on Kubernetes too. Make sure to dive into the Kubernetes plugin docs, as they're essential. One thing to note is that the Jenkins agent you use will be ephemeral, meaning it runs and is destroyed after the job is done. Also, be aware that Docker's traditional way of running builds on Kubernetes was affected by the removal of Docker Shim in version 1.24, so you might want to familiarize yourself with BuildKit if you're going that route. I've shared a demo of my setup if you want to take a look for reference!
Thanks for the tips! I'll definitely check out your demo for some insights.
That sounds great! Just a heads up, we also manage a Jenkins Kubernetes setup and we've seen success with custom agent images. It's definitely the way to go!