- Lab
- A Cloud Guru
Configuring Build Agents in Jenkins
In this hands-on lab, we will create build agent accounts on our remote agents that will then be used to connect those to the Jenkins server to allow us to build remote jobs in a more secure way. We will use specific accounts for the build agents that are not used by normal users and are accessed by the Jenkins server via SSH keys. This can be done as part of a more secure strategy for deploying build agents, and it also allows for better Audit Trail management.
Path Info
Table of Contents
-
Challenge
Log In to the Jenkins Master, and Set Up Keys for the `cloud_user` on the Agent Server
- Log in to the Jenkins server via SSH using the
cloud_user
credentials provided. - From the Jenkins server, access the agent as the
jagent
user via SSH. - Ensure
jagent
's home directory is in/var/lib
, and then exit the agent machine. - On the Jenkins server as
cloud_user
, generate SSH keys using all defaults (no passphrase). - Copy the keys from
cloud_user
on the Jenkins server tojagent
on the agent server. - Verify you are able to log in to the agent server as
jagent
without a password.
- Log in to the Jenkins server via SSH using the
-
Challenge
Copy the `.ssh` Information from `cloud_user` to the `jenkins` User
- Log in to the Jenkins server via SSH using the
cloud_user
credentials provided. - Verify there is not an
.ssh
directory in thejenkins
user's home directory. - Using
sudo
, copy the contents of the.ssh
directory from/home/cloud_user/.ssh
to/var/lib/jenkins/.ssh
. - Verify the necessary items are located in the
/var/lib.jenkins/.ssh
directory and the permissions are correct. - Correct the permissions on the /
var/lib/jenkins/.ssh
directory sojenkins
is the owner.
- Log in to the Jenkins server via SSH using the
-
Challenge
Configure the Agent in the Jenkins GUI
- Copy the contents of
/var/lib/jenkins/.ssh/id_rsa
. - Log in to the Jenkins GUI using the credentials provided on the lab page.
- Navigate to Manage Jenkins > Manage Nodes and Clouds > New Node.
- The agent should be named
Ubuntu_Agent
, and select Permanent Agent. - Configure the agent with four executors, and set the IP address as the hostname.
- Add the credentials as SSH with private key.
- Complete the configuration using the parameters provided.
- Verify the agent comes online.
- Copy the contents of
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.