• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
  • License
    Apache License 2.0
  • Created about 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kubernetes examples running Jenkins master and slaves

Running Jenkins master and slaves in a Kubernetes cluster

Kubernetes examples running Jenkins master and slaves

Creating a cluster

Local with Docker Compose

A local testing cluster with one node can be created with Docker Compose

docker-compose up

When using boot2docker or Docker Engine with a remote host, the remote Kubernetes API can be exposed with docker-machine ssh MACHINE_NAME -L 0.0.0.0:8080:localhost:8080 or boot2docker ssh -L 0.0.0.0:8080:localhost:8080

More info

Google Compute Engine

export KUBERNETES_HOME=~/kubernetes
export KUBERNETES_PROVIDER=gce
export KUBERNETES_NUM_MINIONS=2
export KUBE_GCE_ZONE=us-central1-a
$KUBERNETES_HOME/cluster/kube-up.sh

Creating the pods and services

GKE

gcloud compute disks create --size 20GB jenkins-data-disk
kubectl get nodes
kubectl create -f jenkins-master-gke.yml
kubectl get rc
kubectl get pods
kubectl create -f service-gke.yml
kubectl get services
kubectl create -f jenkins-slaves.yml
kubectl get rc
kubectl get pods
kubectl scale replicationcontrollers --replicas=2 jenkins-slave
kubectl describe services/jenkins
gcloud compute forwarding-rules list

AWS

This assumes a working kubernetes installation. I generate mine with kops. If kubectl cluster-info gives you output about the location of the API server, you are likely in pretty good shape. Next, create the working volume for jenkins: `aws ec2 create-volume --availability-zone us-east-1a --size 20 --volume-type gp2

You'll get a response back that looks something like this:

{
    "AvailabilityZone": "us-east-1a",
    "Encrypted": false,
    "VolumeType": "gp2",
    "VolumeId": "vol-002d2b99000000000", # Write this value down
    "State": "creating",
    "Iops": 100,
    "SnapshotId": "",
    "CreateTime": "2016-12-24T17:39:34.725Z",
    "Size": 20
}

Edit jenkins-master-aws.yml and put the VolumeID in the volumeID field`.

kubectl create -f jenkins-master-aws.yml
kubectl get rc
kubectl get pods
kubectl create -f service-aws.yml
kubectl get services
kubectl describe service jenkins
kubectl create -f jenkins-slaves.yml
kubectl get rc
kubectl get pods
kubectl scale replicationcontrollers --replicas=2 jenkins-slave
kubectl describe services/jenkins

These instructions get you a publically accessible Jenkins dashboard at the load balancer specified in kubectl describe service jenkins. This is likely not ideal for a production environment for a number of reasons to be explored at some future date.

Vagrant

kubectl get nodes
kubectl create -f jenkins-master-vagrant.yml
kubectl get rc
kubectl get pods
kubectl create -f service-vagrant.yml
kubectl get services
kubectl describe services/jenkins
kubectl create -f jenkins-slaves.yml
kubectl get rc
kubectl get pods
kubectl scale replicationcontrollers --replicas=2 jenkins-slave

Rolling update

kubectl rolling-update jenkins-slave --update-period=10s -f replication-v2.yml

Tearing down

kubectl stop replicationcontrollers jenkins-slave
kubectl stop replicationcontrollers jenkins
kubectl delete services jenkins
$KUBERNETES_HOME/cluster/kube-down.sh

Demo

Kubernetes cluster up asciicast

Jenkins master and slaves provisioning asciicast

Kubernetes cluster teardown asciicast

More Repositories

1

docker-maven

Official Docker image with Maven
Dockerfile
484
star
2

jenkinsfile-runner-lambda

Run Jenkinsfiles in AWS Lambda
Java
52
star
3

glacier-cli

Amazon AWS Glacier command line interface
Java
50
star
4

continuous-delivery

Continuous deployment examples using Puppet, Jenkins, Maven, Tomcat,...
Ruby
48
star
5

jenkins-swarm-slave-docker

Docker image for Jenkins swarm slaves
Shell
44
star
6

puppet-for-java-devs

Vagrant and Puppet examples for Java developers
Ruby
33
star
7

croc-hunter-jenkinsx-serverless

MOVED TO https://github.com/carlossg/croc-hunter-jenkinsx
Go
22
star
8

croc-hunter-jenkinsx

Croc Hunter demo, deployed with Jenkins X
Go
20
star
9

jenkins-slave-docker

Jenkins slave to run in Docker
Shell
17
star
10

jenkins-swarm-docker

Jenkins docker image with swarm plugin
Groovy
15
star
11

jenkins-for-volumes-docker

Jenkins Docker image to use easilty with volume mounts
Shell
13
star
12

scaling-jenkins-with-docker-and-mesos

Scaling Jenkins with Docker and Mesos
11
star
13

jenkinsfile-runner-google-cloud-run

Serverless Jenkins pipelines on Google Cloud Run
Java
10
star
14

docker-foreman

Docker image to run Foreman
Shell
10
star
15

kaniko-demo

Demo using kaniko to build Docker images
Go
6
star
16

croc-hunter-java

Croc Hunter demo using Quarkus and GraalVM, deployed with Jenkins X
Java
6
star
17

appfuse-selenium

Selenium test environment for Appfuse
Java
5
star
18

jenkinsfile-runner-fn

Serverless Jenkins pipelines on Project Fn
Java
5
star
19

jenkinsfile-runner-example

Dockerfile
3
star
20

presentations

Slides from multiple conferences
JavaScript
3
star
21

jenkinsfile-runner-lambda-example

Java
3
star
22

mesos-jenkins

Jenkins running on mesos
Groovy
3
star
23

jroller-export

Simple code to export JRoller blog entries, for instance to migrate to Wordpress
Java
3
star
24

jenkinsfile-runner-fn-example

Java
2
star
25

puppet-ninjablocks

A Puppet module to install and configure ninjablocks software
Puppet
2
star
26

puppet-ddclient

DDclient module for Puppet
Ruby
2
star
27

ninja-timer

A NinjaBlocks driver to time things
JavaScript
2
star
28

docker-jvm-memory

Docker example to understand JVM memory
Java
2
star
29

kubernetes-java-resources

Demos of Java resource usage in Kubernetes
Java
1
star
30

selenium-example

A simple selenium example for talks and workshops
Java
1
star
31

ansible-maven-repo

Access artifacts in maven repo with ansible
1
star
32

puppet-owncloud

Puppet module to instal owncloud
Ruby
1
star
33

heatmiser-node

A nodejs module to talk to heatmiser thermostats
JavaScript
1
star
34

hello-world-jenkinsx

Makefile
1
star
35

croc-hunter-argo

The croc-hunter demo running on Argo
JavaScript
1
star
36

jenkins-x-cloud-environments-alibaba-china

Makefile
1
star
37

puppet-skype

Puppet module to install Skype
Ruby
1
star
38

puppet-plex

Puppet module to install Plex Media Server
Ruby
1
star