Last active
February 20, 2021 19:25
-
-
Save ssmythe/52710ada97cf7d51f29968ba26cf8e65 to your computer and use it in GitHub Desktop.
Jenkins Kubernetes Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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