Run Jenkins JLNP Slave In Kubernetes

  1.  
  2.  
  3. Take note on text highlighted in red as they are parameters use to spawn container in kubernetes later.
  4. Then go to your terminal and run your kubectl command as below (assume you have exported your kubeconfig).
    Note: Replace all environment variables we captured just now as images above.

    kubectl run --image=jenkins/jnlp-slave jnlp-slave \
    --env="JENKINS_URL=https://YOUR_JENKINS_URL" \
    --env="JENKINS_SECRET=005097a22eadbf30b205ac9ecb4c18a1721c60fb2e182fd6104e03670f821184" \
    --env="JENKINS_AGENT_NAME=k8s-slave-1" \
    --env="JENKINS_AGENT_WORKDIR=/home/jenkins"
  5. Refresh your slave node page and you will see it’s now up and running.

Example demonstrate above use Docker container from https://hub.docker.com/r/jenkins/jnlp-slave/

 

dicksonkho

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.