SlideShare a Scribd company logo
SCALING JENKINS WITH DOCKER
SWARM, KUBERNETES OR MESOS?
/ /Carlos Sanchez csanchez.org @csanchez
Watch online at carlossg.github.io/presentations
ABOUT ME
Engineer @ CloudBees, Private SaaS Edition Team
Contributor to
Jenkins Mesos plugin
Jenkins and Maven official Docker images
Author of Jenkins Kubernetes plugin
Long time OSS contributor at Apache, Eclipse, Puppet,…
DOCKER DOCKER
DOCKER
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
BUT IT IS NOT TRIVIAL
CLUSTER SCHEDULING
Running in public cloud, private cloud, VMs or bare metal
HA and fault tolerant
With Docker support of course
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
A distributed systems kernel
APACHE MESOS
Started before 2011
Runs tasks, any binary or Docker, rkt, appcimages
Frameworks run on top of Mesos
Mesosphere Marathon: long running services
Apache Aurora: long running services
Chronos: distributed cron-like system
Used in Twitter, Airbnb, eBay, Apple, Verizon, Yelp,...
DOCKER SWARM
DOCKER SWARM
By Docker Inc.
Uses the same Docker API
No need to modify existing tooling
DOCKER ENGINE SWARM MODE
New in Docker 1.12
No need to install extra so ware, each daemon can run as
a Swarm member
New serviceobject to describe distributed containers
Existing tooling needs to be updated
Swarm mode
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
KUBERNETES
Based on Google Borg
Run in local machine, virtual, cloud
Google provides Google Container Engine (GKE)
Other services run by stackpoint.io, CoreOS Tectonic,
Azure,...
Minikube for local testing
SCALING JENKINS
Two options:
More build agents per master
More masters
SCALING JENKINS: MORE BUILD
AGENTS
Pros
Multiple plugins to add more agents, even dynamically
Cons
The master is still a SPOF
Handling multiple configurations, plugin versions,...
There is a limit on how many build agents can be
attached
SCALING JENKINS: MORE MASTERS
Pros
Different sub-organizations can self service and operate
independently
Cons
Single Sign-On
Centralized configuration and operation
Covered by CloudBees Jenkins Operations Center and
CloudBees Jenkins Platform Private SaaS Edition
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
If you haven't automatically destroyed
something by mistake, you are not
automating enough
RUNNING IN DOCKER
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
CLUSTER SCHEDULING
Isolated build agents and jobs
Using Docker
Capabilities can be dropped
GROUPING CONTAINERS
Example:
Jenkins agent
Maven build
Selenium testing in
Firefox
Chrome
Safari
5 containers
GROUPING CONTAINERS
Mesos In progress
Swarm Supports grouping through Docker
Compose
Can force execution in the same host
Kubernetes Supports the concept of Pods natively
All running in the same host
MESOS-2449
MEMORY LIMITS
Scheduler needs to account for container memory
requirements and host available memory
Prevent containers for using more memory than allowed
Mesos required
Swarm optional
Kubernetes optional (plus namespaces)
Memory constrains translate to Docker --memory
WHAT DO YOU THINK HAPPENS WHEN?
Your container goes over memory quota?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
WHAT ABOUT THE JVM?
WHAT ABOUT THE CHILD PROCESSES?
CPU LIMITS
Scheduler needs to account for container CPU requirements
and host available CPUs
Mesos required
Swarm optional
Kubernetes optional (plus namespaces)
CPU translates into Docker --cpu-shares
WHAT DO YOU THINK HAPPENS WHEN?
Your container tries to access more than one CPU
Your container goes over CPU limits
Totally different from memory
STORAGE
Handling distributed storage
Jenkins masters need persistent storage, agents (typically)
don't
Mesos in 1.0+
Swarm Docker volume plugins: RexRay, Convoy,
Flocker,...
Kubernetes
Docker volume support
Persistent volumes
PERMISSIONS
Containers should not run as root
Container user id != host user id
i.e. jenkinsuser in container is always 1000 but matches
ubuntuuser in host
CAVEATS
Only a limited number of EBS volumes can be mounted
Docs say /dev/sd[f-p], but /dev/sd[q-z]seem to
work too
NFS users must be centralized and match in cluster and NFS
server
NETWORKING
Jenkins masters open several ports
HTTP
JNLP Build agent
SSH server (Jenkins CLI type operations)
Jenkins agents connect to master:
inbound (SSH)
outbound (JNLP)
Allows getting one IP per container
Mesos : Calico, Weave
Swarm , and others from plugins
Kubernetes Multiple : GCE, Weave,
Calico,...
Network Isolator Modules
Docker overlay
networking options
JENKINS PLUGINS
JENKINS DOCKER PLUGINS
Dynamic Jenkins agents with Docker plugin or Yet Another
Docker Plugin
No support yet for Docker 1.12 Swarm mode
Agent image needs to include Java, downloads slave jar
from Jenkins master
Multiple plugins for different tasks
Docker build and publish
Docker build step plugin
CloudBees Docker Hub/Registry Notification
CloudBees Docker Traceability
Great pipeline support
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
JENKINS DOCKER PIPELINE
def maven = docker.image('maven:3.3.9-jdk-8');
stage 'Mirror'
maven.pull()
docker.withRegistry('https://secure-registry/', 'docker-registry-login'
stage 'Build'
maven.inside {
sh "mvn -B clean package"
}
stage 'Bake Docker image'
def pcImg = docker.build("examplecorp/spring-petclinic:${env.BUILD_TAG}"
pcImg.push();
}
JENKINS DOCKER SLAVES PLUGIN
Use any Docker image, no need for Java
Definition in pipeline
Can have side containers
Just released!
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Building Maven
dockerNode("maven:3.3.3-jdk-8") {
sh "mvn -version"
}
JENKINS MESOS PLUGIN
Dynamic Jenkins agents, both Docker and isolated
processes
Agent image needs to include Java, grabs slave jar from
Mesos sandbox
Can run Docker commands on the host, outside of Mesos
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
JENKINS MESOS PLUGIN
Can use Docker pipelines with some tricks
Need Docker client installed
Shared docker.sock from host
Mount the workspace in the host, visible under same dir
MESOS PLUGIN AND PIPELINE
node('docker') {
docker.image('golang:1.6').inside {
stage 'Get sources'
git url: 'https://github.com/hashicorp/terraform.git', tag: "v0.6.15"
stage 'Build'
sh """#!/bin/bash -e
mkdir -p /go/src/github.com/hashicorp
ln -s `pwd` /go/src/github.com/hashicorp/terraform
pushd /go/src/github.com/hashicorp/terraform
make core-dev plugin-dev PLUGIN=provider-aws
popd
cp /go/bin/terraform-provider-aws .
"""
stage 'Archive'
archive "terraform-provider-aws"
}
}
JENKINS KUBERNETES PLUGIN
Dynamic Jenkins agents, running as Pods
Multiple container support
One jnlp image, others custom
Pipeline support for both agent Pod definition and
execution will be in next version
JENKINS KUBERNETES PIPELINE
podTemplate(label: 'mypod', containers: [
[name: 'jnlp', image: 'jenkinsci/jnlp-slave:alpine', args: '${compute
[name: 'maven', image: 'maven:3-jdk-8', ttyEnabled: true, command:
[name: 'golang', image: 'golang:1.6', ttyEnabled: true, command:
]) {
node ('mypod') {
stage 'Get a Maven project'
git 'https://github.com/jenkinsci/kubernetes-plugin.git'
container('maven') {
stage 'Build a Maven project'
sh 'mvn clean install'
}
stage 'Get a Golang project'
git url: 'https://github.com/hashicorp/terraform.git'
container('golang') {
stage 'Build a Go project'
sh """
mkdir -p /go/src/github.com/hashicorp
ln -s `pwd` /go/src/github.com/hashicorp/terraform
cd /go/src/github.com/hashicorp/terraform && make core-dev
"""
}
}
JENKINS PLUGINS RECAP
Dynamic Jenkins agent creation
Using JNLP slave jar
In complex environments need to use the tunnel
option to connect internally
Using the Cloud API
Not ideal for containerized workload
Agents take > 1 min to start provision and are kept
around
Agents can provide more than one executor
JENKINS ONE SHOT EXECUTOR
Improved API to handle one off agents
Optimized for containerized agents
Plugins need to support it
THANKS
csanchez.org
csanchez
carlossg

More Related Content

What's hot (20)

PDF
Kubernetes architecture
Janakiram MSV
 
PDF
Testing Distributed Micro Services. Agile Testing Days 2017
Carlos Sanchez
 
PDF
Docker on Google App Engine
Docker, Inc.
 
PPTX
Docker-hanoi meetup #1: introduction about Docker
Nguyen Anh Tu
 
PPTX
Docker Ecosystem on Azure
Patrick Chanezon
 
PDF
Continuous Deployment with Jenkins on Kubernetes
Matt Baldwin
 
PDF
Introduction to Docker - IndiaOpsUG
Ajeet Singh Raina
 
PPTX
Deploy at scale with CoreOS Kubernetes and Apache Stratos
Chris Haddad
 
PPTX
Docker 101 Checonf 2016
Patrick Chanezon
 
PDF
From Monolith to Docker Distributed Applications
Carlos Sanchez
 
PPTX
Compare Docker deployment options in the public cloud
Sreenivas Makam
 
PDF
Scaling Docker with Kubernetes
Carlos Sanchez
 
PPTX
Containers orchestrators: Docker vs. Kubernetes
Dmitry Lazarenko
 
PPTX
Scaling Docker Containers using Kubernetes and Azure Container Service
Ben Hall
 
PDF
Docker and Kubernetes 101 workshop
Sathish VJ
 
PPTX
Docker & Kubernetes intro
Arnon Rotem-Gal-Oz
 
PPTX
Orchestrating Docker Containers with Google Kubernetes on OpenStack
Trevor Roberts Jr.
 
PDF
Kubernetes - introduction
Sparkbit
 
PDF
Orchestrating Docker containers at scale
Maciej Lasyk
 
PDF
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Docker, Inc.
 
Kubernetes architecture
Janakiram MSV
 
Testing Distributed Micro Services. Agile Testing Days 2017
Carlos Sanchez
 
Docker on Google App Engine
Docker, Inc.
 
Docker-hanoi meetup #1: introduction about Docker
Nguyen Anh Tu
 
Docker Ecosystem on Azure
Patrick Chanezon
 
Continuous Deployment with Jenkins on Kubernetes
Matt Baldwin
 
Introduction to Docker - IndiaOpsUG
Ajeet Singh Raina
 
Deploy at scale with CoreOS Kubernetes and Apache Stratos
Chris Haddad
 
Docker 101 Checonf 2016
Patrick Chanezon
 
From Monolith to Docker Distributed Applications
Carlos Sanchez
 
Compare Docker deployment options in the public cloud
Sreenivas Makam
 
Scaling Docker with Kubernetes
Carlos Sanchez
 
Containers orchestrators: Docker vs. Kubernetes
Dmitry Lazarenko
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Ben Hall
 
Docker and Kubernetes 101 workshop
Sathish VJ
 
Docker & Kubernetes intro
Arnon Rotem-Gal-Oz
 
Orchestrating Docker Containers with Google Kubernetes on OpenStack
Trevor Roberts Jr.
 
Kubernetes - introduction
Sparkbit
 
Orchestrating Docker containers at scale
Maciej Lasyk
 
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Docker, Inc.
 

Viewers also liked (20)

PPTX
NGINX Plus PLATFORM For Flawless Application Delivery
Ashnikbiz
 
PDF
Migración de datos con OpenERP-Kettle
raimonesteve
 
PPTX
Introduction to docker swarm
Walid Ashraf
 
PPTX
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
Puppet
 
PDF
Introduction to GPU Programming
Chakkrit (Kla) Tantithamthavorn
 
PPSX
Business Intelligence and Big Data Analytics with Pentaho
Uday Kothari
 
PPTX
Indic threads pune12-accelerating computation in html 5
IndicThreads
 
PDF
Docker Ecosystem: Engine, Compose, Machine, Swarm, Registry
Mario IC
 
PPTX
Building Data Integration and Transformations using Pentaho
Ashnikbiz
 
PPTX
Docker Ecosystem - Part II - Compose
Mario IC
 
DOCX
Advanced ETL2 Pentaho
Sunny U Okoro
 
PDF
Pentaho | Data Integration & Report designer
Hamdi Hmidi
 
PDF
Jenkins Peru Meetup Docker Ecosystem
Mario IC
 
PDF
Tao zhang
harishk2
 
PDF
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Giovanni Toraldo
 
PPTX
Scaling Jenkins with Docker and Kubernetes
Carlos Sanchez
 
PPTX
Elementos ETL - Kettle Pentaho
valex_haro
 
PDF
Building a data warehouse with Pentaho and Docker
Wellington Marinho
 
PDF
Docker swarm introduction
Evan Lin
 
PPTX
Load Balancing Apps in Docker Swarm with NGINX
NGINX, Inc.
 
NGINX Plus PLATFORM For Flawless Application Delivery
Ashnikbiz
 
Migración de datos con OpenERP-Kettle
raimonesteve
 
Introduction to docker swarm
Walid Ashraf
 
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
Puppet
 
Introduction to GPU Programming
Chakkrit (Kla) Tantithamthavorn
 
Business Intelligence and Big Data Analytics with Pentaho
Uday Kothari
 
Indic threads pune12-accelerating computation in html 5
IndicThreads
 
Docker Ecosystem: Engine, Compose, Machine, Swarm, Registry
Mario IC
 
Building Data Integration and Transformations using Pentaho
Ashnikbiz
 
Docker Ecosystem - Part II - Compose
Mario IC
 
Advanced ETL2 Pentaho
Sunny U Okoro
 
Pentaho | Data Integration & Report designer
Hamdi Hmidi
 
Jenkins Peru Meetup Docker Ecosystem
Mario IC
 
Tao zhang
harishk2
 
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Giovanni Toraldo
 
Scaling Jenkins with Docker and Kubernetes
Carlos Sanchez
 
Elementos ETL - Kettle Pentaho
valex_haro
 
Building a data warehouse with Pentaho and Docker
Wellington Marinho
 
Docker swarm introduction
Evan Lin
 
Load Balancing Apps in Docker Swarm with NGINX
NGINX, Inc.
 
Ad

Similar to Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos? (20)

PDF
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
Carlos Sanchez
 
PDF
Using containers for continuous integration and continuous delivery - Carlos ...
Paris Container Day
 
PDF
Using Containers for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Carlos Sanchez
 
PDF
Docker + jenkins in the enterprise (3)
Kurt Madel
 
PDF
Dockerized maven
Matthias Bertschy
 
PDF
Using Docker for Testing
Carlos Sanchez
 
PDF
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
Troublemaker Khunpech
 
PDF
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Steve Hoffman
 
PPTX
To Build My Own Cloud with Blackjack…
Sergey Dzyuban
 
PDF
From Monolith to Docker Distributed Applications
Carlos Sanchez
 
PDF
Effective Data Pipelines with Docker & Jenkins - Brian Donaldson
Docker, Inc.
 
PDF
JUC Europe 2015: Scaling Your Jenkins Master with Docker
CloudBees
 
ODP
Scaling your jenkins master with docker
Christophe Muller
 
PDF
Achieving CI/CD with Kubernetes
Ramit Surana
 
PDF
Highly efficient container orchestration and continuous delivery with DC/OS a...
Christian Bogeberg
 
PDF
Dockers zero to hero
Nicolas De Loof
 
PDF
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Carlos Sanchez
 
PDF
Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)
Docker, Inc.
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
Carlos Sanchez
 
Using containers for continuous integration and continuous delivery - Carlos ...
Paris Container Day
 
Using Containers for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Carlos Sanchez
 
Docker + jenkins in the enterprise (3)
Kurt Madel
 
Dockerized maven
Matthias Bertschy
 
Using Docker for Testing
Carlos Sanchez
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
Troublemaker Khunpech
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Steve Hoffman
 
To Build My Own Cloud with Blackjack…
Sergey Dzyuban
 
From Monolith to Docker Distributed Applications
Carlos Sanchez
 
Effective Data Pipelines with Docker & Jenkins - Brian Donaldson
Docker, Inc.
 
JUC Europe 2015: Scaling Your Jenkins Master with Docker
CloudBees
 
Scaling your jenkins master with docker
Christophe Muller
 
Achieving CI/CD with Kubernetes
Ramit Surana
 
Highly efficient container orchestration and continuous delivery with DC/OS a...
Christian Bogeberg
 
Dockers zero to hero
Nicolas De Loof
 
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Carlos Sanchez
 
Building Web Scale Apps with Docker and Mesos by Alex Rukletsov (Mesosphere)
Docker, Inc.
 
Ad

More from Carlos Sanchez (16)

PDF
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Carlos Sanchez
 
PDF
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Carlos Sanchez
 
PDF
Scaling Jenkins with Docker and Kubernetes
Carlos Sanchez
 
PDF
Scaling Docker with Kubernetes
Carlos Sanchez
 
PDF
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
PDF
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Carlos Sanchez
 
PDF
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
Carlos Sanchez
 
PDF
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Carlos Sanchez
 
KEY
Puppet for Java developers - JavaZone NO 2012
Carlos Sanchez
 
PDF
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 
KEY
From Dev to DevOps - FOSDEM 2012
Carlos Sanchez
 
KEY
From Dev to DevOps - ApacheCON NA 2011
Carlos Sanchez
 
KEY
From Dev to DevOps - Apache Barcamp Spain 2011
Carlos Sanchez
 
KEY
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
KEY
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
KEY
Eclipse IAM, Maven Integration For Eclipse
Carlos Sanchez
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Carlos Sanchez
 
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Carlos Sanchez
 
Scaling Jenkins with Docker and Kubernetes
Carlos Sanchez
 
Scaling Docker with Kubernetes
Carlos Sanchez
 
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Carlos Sanchez
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
Carlos Sanchez
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Carlos Sanchez
 
Puppet for Java developers - JavaZone NO 2012
Carlos Sanchez
 
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 
From Dev to DevOps - FOSDEM 2012
Carlos Sanchez
 
From Dev to DevOps - ApacheCON NA 2011
Carlos Sanchez
 
From Dev to DevOps - Apache Barcamp Spain 2011
Carlos Sanchez
 
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
Enterprise Build And Test In The Cloud
Carlos Sanchez
 
Eclipse IAM, Maven Integration For Eclipse
Carlos Sanchez
 

Recently uploaded (20)

PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Tally software_Introduction_Presentation
AditiBansal54083
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 

Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?

  • 1. SCALING JENKINS WITH DOCKER SWARM, KUBERNETES OR MESOS? / /Carlos Sanchez csanchez.org @csanchez Watch online at carlossg.github.io/presentations
  • 2. ABOUT ME Engineer @ CloudBees, Private SaaS Edition Team Contributor to Jenkins Mesos plugin Jenkins and Maven official Docker images Author of Jenkins Kubernetes plugin Long time OSS contributor at Apache, Eclipse, Puppet,…
  • 5. BUT IT IS NOT TRIVIAL
  • 6. CLUSTER SCHEDULING Running in public cloud, private cloud, VMs or bare metal HA and fault tolerant With Docker support of course
  • 9. APACHE MESOS Started before 2011 Runs tasks, any binary or Docker, rkt, appcimages Frameworks run on top of Mesos Mesosphere Marathon: long running services Apache Aurora: long running services Chronos: distributed cron-like system Used in Twitter, Airbnb, eBay, Apple, Verizon, Yelp,...
  • 11. DOCKER SWARM By Docker Inc. Uses the same Docker API No need to modify existing tooling
  • 12. DOCKER ENGINE SWARM MODE New in Docker 1.12 No need to install extra so ware, each daemon can run as a Swarm member New serviceobject to describe distributed containers Existing tooling needs to be updated Swarm mode
  • 14. KUBERNETES Based on Google Borg Run in local machine, virtual, cloud Google provides Google Container Engine (GKE) Other services run by stackpoint.io, CoreOS Tectonic, Azure,... Minikube for local testing
  • 15. SCALING JENKINS Two options: More build agents per master More masters
  • 16. SCALING JENKINS: MORE BUILD AGENTS Pros Multiple plugins to add more agents, even dynamically Cons The master is still a SPOF Handling multiple configurations, plugin versions,... There is a limit on how many build agents can be attached
  • 17. SCALING JENKINS: MORE MASTERS Pros Different sub-organizations can self service and operate independently Cons Single Sign-On Centralized configuration and operation Covered by CloudBees Jenkins Operations Center and CloudBees Jenkins Platform Private SaaS Edition
  • 19. If you haven't automatically destroyed something by mistake, you are not automating enough
  • 22. CLUSTER SCHEDULING Isolated build agents and jobs Using Docker Capabilities can be dropped
  • 23. GROUPING CONTAINERS Example: Jenkins agent Maven build Selenium testing in Firefox Chrome Safari 5 containers
  • 24. GROUPING CONTAINERS Mesos In progress Swarm Supports grouping through Docker Compose Can force execution in the same host Kubernetes Supports the concept of Pods natively All running in the same host MESOS-2449
  • 25. MEMORY LIMITS Scheduler needs to account for container memory requirements and host available memory Prevent containers for using more memory than allowed Mesos required Swarm optional Kubernetes optional (plus namespaces) Memory constrains translate to Docker --memory
  • 26. WHAT DO YOU THINK HAPPENS WHEN? Your container goes over memory quota?
  • 28. WHAT ABOUT THE JVM? WHAT ABOUT THE CHILD PROCESSES?
  • 29. CPU LIMITS Scheduler needs to account for container CPU requirements and host available CPUs Mesos required Swarm optional Kubernetes optional (plus namespaces) CPU translates into Docker --cpu-shares
  • 30. WHAT DO YOU THINK HAPPENS WHEN? Your container tries to access more than one CPU Your container goes over CPU limits
  • 32. STORAGE Handling distributed storage Jenkins masters need persistent storage, agents (typically) don't Mesos in 1.0+ Swarm Docker volume plugins: RexRay, Convoy, Flocker,... Kubernetes Docker volume support Persistent volumes
  • 33. PERMISSIONS Containers should not run as root Container user id != host user id i.e. jenkinsuser in container is always 1000 but matches ubuntuuser in host
  • 34. CAVEATS Only a limited number of EBS volumes can be mounted Docs say /dev/sd[f-p], but /dev/sd[q-z]seem to work too NFS users must be centralized and match in cluster and NFS server
  • 35. NETWORKING Jenkins masters open several ports HTTP JNLP Build agent SSH server (Jenkins CLI type operations) Jenkins agents connect to master: inbound (SSH) outbound (JNLP)
  • 36. Allows getting one IP per container Mesos : Calico, Weave Swarm , and others from plugins Kubernetes Multiple : GCE, Weave, Calico,... Network Isolator Modules Docker overlay networking options
  • 38. JENKINS DOCKER PLUGINS Dynamic Jenkins agents with Docker plugin or Yet Another Docker Plugin No support yet for Docker 1.12 Swarm mode Agent image needs to include Java, downloads slave jar from Jenkins master Multiple plugins for different tasks Docker build and publish Docker build step plugin CloudBees Docker Hub/Registry Notification CloudBees Docker Traceability Great pipeline support
  • 43. JENKINS DOCKER PIPELINE def maven = docker.image('maven:3.3.9-jdk-8'); stage 'Mirror' maven.pull() docker.withRegistry('https://secure-registry/', 'docker-registry-login' stage 'Build' maven.inside { sh "mvn -B clean package" } stage 'Bake Docker image' def pcImg = docker.build("examplecorp/spring-petclinic:${env.BUILD_TAG}" pcImg.push(); }
  • 44. JENKINS DOCKER SLAVES PLUGIN Use any Docker image, no need for Java Definition in pipeline Can have side containers Just released!
  • 47. JENKINS MESOS PLUGIN Dynamic Jenkins agents, both Docker and isolated processes Agent image needs to include Java, grabs slave jar from Mesos sandbox Can run Docker commands on the host, outside of Mesos
  • 53. JENKINS MESOS PLUGIN Can use Docker pipelines with some tricks Need Docker client installed Shared docker.sock from host Mount the workspace in the host, visible under same dir
  • 54. MESOS PLUGIN AND PIPELINE node('docker') { docker.image('golang:1.6').inside { stage 'Get sources' git url: 'https://github.com/hashicorp/terraform.git', tag: "v0.6.15" stage 'Build' sh """#!/bin/bash -e mkdir -p /go/src/github.com/hashicorp ln -s `pwd` /go/src/github.com/hashicorp/terraform pushd /go/src/github.com/hashicorp/terraform make core-dev plugin-dev PLUGIN=provider-aws popd cp /go/bin/terraform-provider-aws . """ stage 'Archive' archive "terraform-provider-aws" } }
  • 55. JENKINS KUBERNETES PLUGIN Dynamic Jenkins agents, running as Pods Multiple container support One jnlp image, others custom Pipeline support for both agent Pod definition and execution will be in next version
  • 56. JENKINS KUBERNETES PIPELINE podTemplate(label: 'mypod', containers: [ [name: 'jnlp', image: 'jenkinsci/jnlp-slave:alpine', args: '${compute [name: 'maven', image: 'maven:3-jdk-8', ttyEnabled: true, command: [name: 'golang', image: 'golang:1.6', ttyEnabled: true, command: ]) { node ('mypod') { stage 'Get a Maven project' git 'https://github.com/jenkinsci/kubernetes-plugin.git' container('maven') { stage 'Build a Maven project' sh 'mvn clean install' } stage 'Get a Golang project' git url: 'https://github.com/hashicorp/terraform.git' container('golang') { stage 'Build a Go project' sh """ mkdir -p /go/src/github.com/hashicorp ln -s `pwd` /go/src/github.com/hashicorp/terraform cd /go/src/github.com/hashicorp/terraform && make core-dev """ } }
  • 57. JENKINS PLUGINS RECAP Dynamic Jenkins agent creation Using JNLP slave jar In complex environments need to use the tunnel option to connect internally Using the Cloud API Not ideal for containerized workload Agents take > 1 min to start provision and are kept around Agents can provide more than one executor
  • 58. JENKINS ONE SHOT EXECUTOR Improved API to handle one off agents Optimized for containerized agents Plugins need to support it