Setting up the Kubernetes Plugin on Jenkins

11/18/2015

I've been struggling with setting up the Jenkins Kubernetes Plugin on the Google Container Engine.

I have the plugin installed but I think all my builds are still running on master.

I haven't found any good documentation or guides on configuring this.

UPDATE

I removed the master executor from my Jenkins image. So now my builds aren't running on master but now they have no executor so they don't run at all. Just waits in the queue forever.

-- anthonator
jenkins
jenkins-plugins
kubernetes

3 Answers

10/17/2019

There's also a helm chart for easy deployment if that helps :)

This example might also help once you've set the plugin up too.

-- superNES64
Source: StackOverflow

11/20/2015

You'll need to tell Jenkins how and where to run your builds by adding your Kubernetes cluster as a 'cloud' in the Jenkins configuration. Go to Manage Jenkins -> Configure System -> Cloud -> Add new cloud and select 'Kubernetes'. You'll find the server certificate key, user name and password in your local kubectl configuration (usually in ~/.kube/config). The values for 'Kubernetes URL' and 'Jenkins URL' depend on your cluster setup.

Next, you'll need to configure the docker images that should be used to run your builds by selecting 'Add Docker Template'. Use labels to define which tasks should be run with which image!

Here's a good video tutorial and here you'll find a nice tutorial which explains everything in detail.

-- Marco Lamina
Source: StackOverflow

11/11/2016

The important bit after you've installed the plugin, set up access to your Kubernetes cluster, and set up your first Kubernetes Pod Template with a label like jnlp-slave, is that in your Jenkinsfile you need to begin with something like node('jnlp-slave') {}. Then the pod will be started when you trigger a build.

-- diffalot
Source: StackOverflow