Jenkins Slaves in OpenShift Using an External Jenkins Environment

Posted: February 14th, 2016 | Author: | Filed under: Technology | No Comments »

Configuring the Jenkins Master

With the OpenShift components in place, let’s focus on the existing Jenkins environment and the steps necessary to configure the master to leverage OpenShift to run slave instances. First, there must be communication channels between OpenShift and the Jenkins master. This includes communication from OpenShift and Jenkins on the port exposed by the web console as well as a TCP port that is used for the JNLP slaves to communicate with the master. Port 50000 is the recommended JNLP slave port but it is possible to utilize a different port if necessary. The Jenkins master must also be able to communicate with the OpenShift API when leveraging the Kubernetes Jenkins plugin to dynamically provision slaves. On the Jenkins master, ensure the requisite firewall ports are opened. If systemd is the firewall implementation that is being used, execute the following commands to enable communication on ports 8080 and 50000 and to reload the configuration.

firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=50000/tcp --permanent
firewall-cmd --reload

The majority of the functionality to enable the dynamic capabilities between Jenkins and OpenShift is through the use of several Jenkins plugins. The following are a list of plugins that need to be installed in the Jenkins environment:

Plugins can be installed in Jenkins by logging onto the master web interface and selecting the Manage Jenkins link on the lefthand side, and then selecting Manage Plugins. On the Available tab, mark the checkboxes next to the plugins listed above and scroll down to the bottom of the page and select Download now and install after and Restart. This will download and install the plugins and then restart the Jenkins instance when no jobs are actively being run.

Jenkins Install Plugins

Next, configure the JNLP port which slave instances use to communicate with the Jenkins master. Select the Manage Jenkins link on the lefthand side and select System Security. Select Enable Security if this checkbox is not currently checked, and next to TCP port for JNLP slave agents, select the Fixed radio button and enter 50000 (or the value of the chosen JNLP port as described above). Click Save to apply the changes.

Jenkins JNLP Configuration

To completely disable jobs from executing on the master and to solely utilize slave, the executors count on the master needs to be set to 0. This value is set on the Jenkins system configuration page which can be accessed by selecting Manage Jenkins on the lefthand size of the master landing page and selecting Configure System. Next to # of executors, enter 0 and then hit Save to apply the changes.

Jenkins Executors



Leave a Reply