DevOps, Day - 28
Setting Up Jenkins Agent on AWS EC2 and Running Jobs with Master-Triggered Builds
Jenkins Master is the central control and management system that oversees and orchestrates various tasks and jobs in a Jenkins automation environment. It's responsible for scheduling, monitoring, and controlling the execution of tasks on connected agents (slaves), ensuring efficient and automated software builds and deployments.
A Jenkins Agent, also known as a Jenkins Slave, is like a worker that carries out tasks assigned by the Jenkins Master. It's a separate machine or node that helps to execute jobs, such as building and testing software, under the direction of the Jenkins Master. Agents enable Jenkins to distribute work and perform tasks in parallel, making the automation process more efficient.
Step 1: Launch and Connect your EC2 instance through SSH
Step 2: Start and enable Jenkins service:
Step 3: Generate SSH keys on “Jenkins-server” by running ssh-keygen
command.
Step 4: Navigate to the '.ssh' folder on the Jenkins server.
In this folder, you will find the public key (usually named id_rsa.pub
) and the private key (usually named id_rsa
) if they were generated during the Jenkins setup. If they have different names or you want to modify other keys, adjust the commands accordingly.
Step 5: To modify the keys, you can use a text editor like nano
or vim
to edit them:
vim authorised_keys
Make the necessary modifications to the keys. Be very careful while editing the keys, as any changes can affect the SSH connectivity.
Save your changes and exit the text editor.
If you made changes to the private key, you may need to update your Jenkins agent configuration to use the new private key for SSH authentication. Follow the steps outlined in Task-01 to update the Jenkins agent's configuration with the new private key.
After modifying the keys, you may need to restart Jenkins to apply the changes:
sudo systemctl restart jenkins
Remember that modifying SSH keys should be done with caution, and it's essential to understand the implications of any changes, especially in a production environment.
Step 6: Log in to Jenkins --> localhost:8080
Step 7: Dashboard --> Manage Jenkins --> Select Nodes and Clouds under system configuration.
Step 8: click on the New node
Step 9: Name the Node --> click Permanent Agent --> Create
Step 10: Fill in the details Carefully --> Save
Step 11: Now we can see our node is created.
Step 12: Head to the configuration settings and add a label with the same name as your designated node.
Step 13: Now click on Build Now
Step 14: The Build was successful :)
Thank you so much for reading.
Follow me on LinkedIn to see interesting posts like this : )
Subscribe to my newsletter
Read articles from Vrishni Shree V B directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Vrishni Shree V B
Vrishni Shree V B
💻 Python | Docker | Jenkins | Networking | Git | Linux 💻 Passionate about leveraging technology to drive efficiency and deliver innovative solutions. Proficient in Python development, Docker containerization, Jenkins automation, computer networking, Git version control, and Linux administration. Skilled in collaborating with diverse teams to deliver high-quality software products. Proficient in AWS EC2 instance management and deployment. Seeking new opportunities to apply my expertise and contribute to impactful projects. Let's connect and explore how we can work together! Inter-personal Skills: Communication, Adaptability, Emotional intelligence, Active listening, Collaboration. Happy To Connect🔗😊 Feel free to reach me out😃@ --> vrishnishreevb531@gmail.com 📬