Skip to content

Instantly share code, notes, and snippets.

@ssmythe
Last active February 20, 2021 19:25
Show Gist options
  • Save ssmythe/52710ada97cf7d51f29968ba26cf8e65 to your computer and use it in GitHub Desktop.
Save ssmythe/52710ada97cf7d51f29968ba26cf8e65 to your computer and use it in GitHub Desktop.
Jenkins Kubernetes Setup
Configure Global Security
====
Agents
----
TCP port for inbound agents: 50000
Configure System
====
Main config
----
# of executors: 2
Labels: master
Usage: Only build jobs with label expressions matching this node
Jenkins URL: http://name.local:8080/
Kubernetes Cloud
----
Kubernetes URL: https://localhost:6443
Jenkins URL: <empty>
Jenkins tunnel: <empty>
Kubernetes Pod Template
----
Name: k8n-jnlp-slave
Labels: k8n-jnlp-slave
Containers:
Name: jnlp
Docker image: jenkins/jnlp-slave
Working directory: /tmp
Command to run: <empty>
Arguments to pass to the command: <empty>
----
Name: k8n-jnlp-agent-maven
Labels: k8n-jnlp-agent-maven
Containers:
Name: busybox
Docker image: jenkins/jnlp-agent-maven
Working directory: /tmp
Command to run: <empty>
Arguments to pass to the command: <empty>
Example pipeline script
====
pipeline {
agent none
stages {
stage('slave') {
agent { label 'k8n-jnlp-slave' }
steps {
sh 'echo hello jenkins/jnlp-slave!'
}
}
stage('maven') {
agent { label 'k8n-jnlp-agent-maven' }
steps {
sh 'echo hello jenkins/jnlp-agent-maven!'
sh 'mvn -version'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment