- Take note on text highlighted in red as they are parameters use to spawn container in kubernetes later.
- 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"
- 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/