Setup Jenkins Slave on Microsoft Azure for CICD with DTR

This is the third post in the series of ‘Continuous Integration and Delivery with Docker Trusted Registry on Microsoft Azure’. This is a step by step guidance for implementing http://www.docker.com/sites/default/files/UseCase/RA_CI%20with%20Docker_08.25.2015.pdf on Microsoft Azure.

You can read the previous post in this series at https://manesh.me/2015/11/15/continuous-integration-and-delivery-with-docker-trusted-registry-on-microsoft-azure/.

Prerequisites

  • Microsoft Azure Subscription

Setup Sequence

  • Create virtual machine for Jenkins Slave
  • Assign DNS name for Jenkins Slave machine
  • Install JRE on Jenkins Slave
  • Install and Configure Docker Engine on Jenkins Slave
  • Register slave node in Jenkins Master

Create virtual machine for Jenkins Slave

Open browser and navigate to https://portal.azure.com/

From Azure Portal, click New, then Compute, then Marketplace

Type Ubuntu Server in the search box and press Enter, then click on ‘Ubuntu Server 14‘ from the search results

Read virtual machine image description, choose Resource Manager as the deployment model and click Create

Note: It is important to choose ‘Resource Manager’ deployment model, to have this created in the same resource group of DTR and Jenkins Master.

Provide basic configuration details for the virtual machine (you can change details as per your environment) and click OK

  • Name: mme-j-slave01
  • User name: cicdagent
  • Authentication Type: Password
  • Password: Azure101!
  • Resource Group: DTR
    • Select existing Resource Group, you created for DTR virtual machine
  • Location: South Central US

For size configuration, choose D1 Standard and click Select

Choose default values for optional configurations, and click OK

Review summary details and click OK

Wait for virtual machine to get into state ‘Running’.

Assign DNS Name for Jenkins Slave

Follow the similar steps in previous post to create a DNS name label for the virtual machine. In my environment FQDN of the virtual machine is mme-j-slave01.southcentralus.cloudapp.azure.com

Install JRE on Jenkins Slave

Use SSH to connect to Jenkins Slave machine and execute the following commands.

ssh cicdagent@mme-j-slave01.southcentralus.cloudapp.azure.com

# install jre package on the virutal machine

sudo apt-get install default-jre

Install and Configure Docker Engine on Jenkins Slave

Use SSH to connect to Jenkins Slave machine and execute the following commands.

ssh cicdagent@mme-j-slave01.southcentralus.cloudapp.azure.com

# download and install CS Engine

curl -s https://packagecloud.io/install/repositories/Docker/cs-public/script.deb.sh | sudo bash

sudo apt-get install docker-engine-cs

Since we do not have a valid SSL certificate on Docker Trusted Registry server for HTTPS, we need to ensure that docker service starts with ‘–insecure-registry mme-dtr.southcentralus.cloudapp.azure.com’ option. For this we need to edit /etc/default/docker file.

You can use vim editor to make required changes on the file. To start inserting text in vim, press the ‘i’ key to enter insert mode. When you have finished editing, press ESC to exit insert mode, then type ‘:wq’ to save and exit the editor.

sudo vim /etc/default/docker

Once the file is updated, reboot the Jenkins Slave virtual machine.

sudo reboot

Register slave node in Jenkins Master

Open browser and navigate to http://mme-j-master.southcentralus.cloudapp.azure.com:8080

Click on Manage Jenkins

Click on Manage Nodes

Click on New Node

Enter mme-j-slave01 as the node name, choose option dump slave and click OK

On node details page, provide slave node information. Click on Add button for credentials and create a username with password credential. It is important to keep label for node as docker. This label is used later to associate Jenkins Job to the slave node.

You should see that the node is added and is in active state.

Next Blog

You can read the next post in this blog series here, <TODO>.

About Manesh

Manesh is a software consultant and solutions architect specializing in cloud, data, Linux and devops in the azure realm with key focus on hybrid workloads. He has been working on Azure technologies since its inception and has helped many enterprises to onboard and adapt to Azure cloud, build solutions for datacenter scale / high consumer applications and services. Currently, he is Microsoft certified for Developing Microsoft Azure Solutions (70-532), Implementing Microsoft Azure Infrastructure Solutions(70-533) and Architecting Microsoft Azure Solutions (70-534).

Posted on 2015/11/20, in DevOps, Microsoft Azure and tagged , , , , , , . Bookmark the permalink. 3 Comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

hyper-v.nu

My views on technology

yungchou

witnessing a clear cloudy day

Virtualization and some coffee

My views on technology

Thomas Maurer

Cloud and Virtualization

Cloud Administrator

Begin Your Journey to the Cloud with the Cloud Administrator

%d bloggers like this: