简体   繁体   中英

Setting up the Kubernetes Plugin on Jenkins

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.

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 'sa good video tutorial and here you'll find a nice tutorial which explains everything in detail.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM