<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Tung Leo</title>
    <description>The latest articles on Forem by Tung Leo (@tungbq).</description>
    <link>https://forem.com/tungbq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F746777%2F7c177fe8-af48-4eaf-9c9a-583c0457dba6.jpg</url>
      <title>Forem: Tung Leo</title>
      <link>https://forem.com/tungbq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tungbq"/>
    <language>en</language>
    <item>
      <title>Wrapping Up 2024: IIS and Apache Tomcat Join the DevOps Basics Journey! 🎉</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Wed, 25 Dec 2024 06:16:59 +0000</pubDate>
      <link>https://forem.com/tungbq/wrapping-up-2024-iis-and-apache-tomcat-join-the-devops-basics-journey-5gai</link>
      <guid>https://forem.com/tungbq/wrapping-up-2024-iis-and-apache-tomcat-join-the-devops-basics-journey-5gai</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As we close out an exciting and productive 2024, I’m thrilled to share the latest updates to the &lt;a href="https://github.com/tungbq/devops-basics" rel="noopener noreferrer"&gt;&lt;strong&gt;DevOps Basics&lt;/strong&gt;&lt;/a&gt; repository. This year has been a remarkable journey, thanks to the incredible support from all of you—our growing community of learners and practitioners. Your feedback, contributions, and encouragement have been instrumental in pushing this project forward. 🙏  &lt;/p&gt;

&lt;p&gt;To wrap up 2024, I’m excited to introduce two new topics: &lt;strong&gt;IIS Web Server&lt;/strong&gt; and &lt;strong&gt;Apache Tomcat Web Server&lt;/strong&gt;. These additions mark another step in our mission to provide a comprehensive foundation for anyone exploring the DevOps landscape.  &lt;/p&gt;




&lt;h2&gt;
  
  
  2024 Highlights ✨
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The repository now has &lt;strong&gt;1.7k stars&lt;/strong&gt; (and counting!), and it's all because of your amazing support.&lt;/li&gt;
&lt;li&gt;We have &lt;strong&gt;34&lt;/strong&gt; topics for both Dev and DevOps. Each topic includes documentation, a "getting started" guide, and hands-on examples.&lt;/li&gt;
&lt;li&gt;There are &lt;strong&gt;148&lt;/strong&gt; forks with &lt;strong&gt;34&lt;/strong&gt; contributors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Release v0.35.0
&lt;/h2&gt;

&lt;p&gt;Here's a quick overview of what’s new in the latest &lt;a href="https://github.com/tungbq/devops-basics/releases" rel="noopener noreferrer"&gt;&lt;strong&gt;release&lt;/strong&gt;&lt;/a&gt;:  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;New Topics 🚀&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IIS Web Server&lt;/strong&gt;: Dive into the world of Microsoft’s Internet Information Services, learn how to set it up, and explore hosting capabilities for websites and web applications.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apache Tomcat&lt;/strong&gt;: A lightweight yet powerful Java-based web server, ideal for hosting Java web applications and implementing Java Servlet and JSP technologies.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;More Improvements 📈&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VirtualBox Basics&lt;/strong&gt;: A starting point for mastering virtualization.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynatrace Basics&lt;/strong&gt;: Understand monitoring and observability tools for modern applications.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bug Fixes and Enhancements&lt;/strong&gt;: Improved documentation and user experience across various topics.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out the &lt;a href="https://github.com/tungbq/devops-basics/compare/v0.34.0...v0.35.0" rel="noopener noreferrer"&gt;full changelog&lt;/a&gt; for all updates.  &lt;/p&gt;




&lt;h2&gt;
  
  
  Looking Ahead to 2025 🛠️
&lt;/h2&gt;

&lt;p&gt;As we turn the page to 2025, I’m excited to keep building and improving the DevOps Basics repository. Plans include:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding more &lt;strong&gt;hands-on examples&lt;/strong&gt; to existing topics.
&lt;/li&gt;
&lt;li&gt;Expanding into &lt;strong&gt;new tools and technologies&lt;/strong&gt; that align with the evolving DevOps landscape.
&lt;/li&gt;
&lt;li&gt;Refining content to ensure it's beginner-friendly yet valuable for experienced engineers.
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Thank You 💖
&lt;/h2&gt;

&lt;p&gt;To everyone who has starred, forked, contributed, or simply explored this repository—&lt;strong&gt;thank you!&lt;/strong&gt; Your support means the world to me, and it inspires me to continue growing this resource.  &lt;/p&gt;

&lt;p&gt;If you haven’t already, please consider starring the repository ⭐️ on GitHub to help us reach &lt;strong&gt;2,000 stars&lt;/strong&gt; and beyond! Every star is a testament to the value of shared knowledge and a community-driven approach.&lt;br&gt;&lt;br&gt;
Here’s to another year of learning, growth, and success. See you in 2025! 🎉  &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/tungbq/devops-basics" rel="noopener noreferrer"&gt;&lt;strong&gt;Star devops-basics ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;If you have suggestions for future topics or improvements, feel free to open an issue or reach out. Together, let’s make DevOps Basics an even better resource for everyone. 🚀  &lt;/p&gt;

</description>
      <category>devops</category>
      <category>opensource</category>
      <category>tooling</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Introducing TheDevOpsHub: Your Central Hub for DevOps Learning! 🚀</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Sat, 19 Oct 2024 15:21:43 +0000</pubDate>
      <link>https://forem.com/tungbq/introducing-thedevopshub-your-central-hub-for-devops-learning-4d30</link>
      <guid>https://forem.com/tungbq/introducing-thedevopshub-your-central-hub-for-devops-learning-4d30</guid>
      <description>&lt;p&gt;Welcome to &lt;a href="https://github.com/thedevopshub" rel="noopener noreferrer"&gt;&lt;strong&gt;TheDevOpsHub&lt;/strong&gt;&lt;/a&gt;, a new initiative designed to provide a comprehensive learning experience for anyone passionate about DevOps. Whether you're a beginner or an advanced practitioner, TheDevOpsHub is your one-stop resource for documentation, hands-on demos, and projects that span the entire DevOps landscape—from cloud computing to CI/CD pipelines, containerization, and infrastrucure as code (IaC).&lt;/p&gt;

&lt;h3&gt;
  
  
  What is TheDevOpsHub?
&lt;/h3&gt;

&lt;p&gt;TheDevOpsHub is a free online platform that curates a wide array of DevOps resources, organized into easy-to-navigate categories. It offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In-depth documentation&lt;/strong&gt;: covering popular DevOps tools, workflows, and best practices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hands-on demos and projects&lt;/strong&gt;: to help you apply what you’ve learned in real-world scenarios.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community engagement&lt;/strong&gt;: currently maintained by me (&lt;a href="https://github.com/tungbq" rel="noopener noreferrer"&gt;&lt;strong&gt;Tung Leo&lt;/strong&gt;&lt;/a&gt;) and supported by a growing community of DevOps enthusiasts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub organization&lt;/strong&gt;: &lt;a href="https://github.com/thedevopshub" rel="noopener noreferrer"&gt;https://github.com/thedevopshub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Official website&lt;/strong&gt;: &lt;a href="https://thedevopshub.org" rel="noopener noreferrer"&gt;https://thedevopshub.org&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Featured Projects
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;1. The Trio DevOps Projects&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;We’ve divided our core projects into three categories for structured learning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/devops-basics" rel="noopener noreferrer"&gt;&lt;strong&gt;devops-basics&lt;/strong&gt;&lt;/a&gt; (&lt;strong&gt;1.6k&lt;/strong&gt; stars ⭐): Practical starting points for understanding key DevOps concepts and tools.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/devops-practice" rel="noopener noreferrer"&gt;&lt;strong&gt;devops-practice&lt;/strong&gt;&lt;/a&gt;: Hands-on exercises to reinforce your skills through real-world scenarios.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/devops-project" rel="noopener noreferrer"&gt;&lt;strong&gt;devops-project&lt;/strong&gt;&lt;/a&gt;: Advanced projects designed to elevate your DevOps skills to the next level.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2. Cloud Learning&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Our cloud-focused repositories include resources for Azure and AWS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Azure&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/AzureHub" rel="noopener noreferrer"&gt;&lt;strong&gt;AzureHub&lt;/strong&gt;&lt;/a&gt;: Learning resources and documentation for Azure services.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/AZ-104" rel="noopener noreferrer"&gt;&lt;strong&gt;AZ-104&lt;/strong&gt;&lt;/a&gt;: A complete guide for preparing for the AZ-104 certification.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;AWS&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/AWSHub" rel="noopener noreferrer"&gt;&lt;strong&gt;AWSHub&lt;/strong&gt;&lt;/a&gt;: A collection of AWS service resources.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;3. Linux and OS&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/LinuxHub" rel="noopener noreferrer"&gt;&lt;strong&gt;LinuxHub&lt;/strong&gt;&lt;/a&gt;: Resources for Linux best practices, tips, and tricks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;4. CI/CD Tools&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/JenkinsHub" rel="noopener noreferrer"&gt;&lt;strong&gt;JenkinsHub&lt;/strong&gt;&lt;/a&gt;: All things Jenkins—from setup to automation pipelines.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;5. Infrastructure as Code (IaC)&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Terraform&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/TerraformHub" rel="noopener noreferrer"&gt;&lt;strong&gt;TerraformHub&lt;/strong&gt;&lt;/a&gt;: Extensive practical resources for mastering Terraform.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/terraform-template" rel="noopener noreferrer"&gt;&lt;strong&gt;terraform-template&lt;/strong&gt;&lt;/a&gt;: Best-practice templates for multi-environment, modular deployments.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Ansible&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/AnsibleHub" rel="noopener noreferrer"&gt;&lt;strong&gt;AnsibleHub&lt;/strong&gt;&lt;/a&gt;: Ansible learning resources and templates.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/ansible-template" rel="noopener noreferrer"&gt;&lt;strong&gt;ansible-template&lt;/strong&gt;&lt;/a&gt;: Ansible template repository with CI, linting, containerization, and more...&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;6. Containerization &amp;amp; Kubernetes&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/microservices-deployment" rel="noopener noreferrer"&gt;&lt;strong&gt;microservices-deployment&lt;/strong&gt;&lt;/a&gt;: A complete microservices deployment setup on Kubernetes, including monitoring and logging features.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/k8sHub" rel="noopener noreferrer"&gt;&lt;strong&gt;k8sHub&lt;/strong&gt;&lt;/a&gt;: Comprehensive Kubernetes examples and practices.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;7. Monitoring&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/MonitoringHub" rel="noopener noreferrer"&gt;&lt;strong&gt;MonitoringHub&lt;/strong&gt;&lt;/a&gt;: Prometheus, Grafana, and more for end-to-end system monitoring.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Explore More Resources...
&lt;/h3&gt;

&lt;p&gt;Looking for daily-used command-line tools or DevOps books? Check out our cheatsheets and book collections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://tungbq.github.io/cmd" rel="noopener noreferrer"&gt;&lt;strong&gt;cmd&lt;/strong&gt;&lt;/a&gt;: Bookmark essential command-line tools.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/TheDevOpsHub/Books" rel="noopener noreferrer"&gt;&lt;strong&gt;Books&lt;/strong&gt;&lt;/a&gt;: Our curated list of DevOps books to deepen your knowledge.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Stay Connected and Up-to-Date
&lt;/h3&gt;

&lt;p&gt;This is just the beginning! I will be actively maintaining TheDevOpsHub, adding fresh content, and releasing new projects and demos to keep it growing. Expect more learning resources and hands-on examples to be added regularly. So, stay tuned and follow our GitHub organization to stay updated! ⭐&lt;/p&gt;

&lt;p&gt;If you'd like to support my work and help sustain TheDevOpsHub for everyone’s benefit, you can contribute at &lt;a href="https://github.com/sponsors/TheDevOpsHub" rel="noopener noreferrer"&gt;&lt;strong&gt;TheDevOpsHub Sponsors&lt;/strong&gt;&lt;/a&gt; ❤️. Your support allows me to keep creating high-quality content and resources for the DevOps community!&lt;/p&gt;

&lt;p&gt;Feel free to reach out via email at &lt;a href="mailto:info@thedevopshub.org"&gt;info@thedevopshub.org&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Start your DevOps journey today by exploring &lt;a href="https://thedevopshub.org" rel="noopener noreferrer"&gt;&lt;strong&gt;TheDevOpsHub&lt;/strong&gt;&lt;/a&gt; and level up your skills with hands-on projects and comprehensive resources!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>learning</category>
      <category>opensource</category>
      <category>documentation</category>
    </item>
    <item>
      <title>DevOps Basics reaches 200 stars: A milestone celebration 🎉</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Sun, 15 Sep 2024 09:38:13 +0000</pubDate>
      <link>https://forem.com/tungbq/devops-basics-reaches-200-stars-a-milestone-celebration-3hji</link>
      <guid>https://forem.com/tungbq/devops-basics-reaches-200-stars-a-milestone-celebration-3hji</guid>
      <description>&lt;p&gt;I am thrilled to announce that my GitHub repository, &lt;a href="https://github.com/tungbq/devops-basics" rel="noopener noreferrer"&gt;&lt;strong&gt;devops-basics&lt;/strong&gt;&lt;/a&gt;, has just reached an exciting milestone of &lt;strong&gt;200&lt;/strong&gt; stars! 🎉 This achievement is a testament to the growing interest in DevOps practices and the value the community finds in this resource.&lt;/p&gt;

&lt;h2&gt;
  
  
  Impressive Metrics 📈
&lt;/h2&gt;

&lt;p&gt;I'm proud to share some impressive numbers that showcase the community's engagement with this project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;200+ Stars&lt;/strong&gt;: A clear indication of the value and popularity of the repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;56 Forks&lt;/strong&gt;: Demonstrating how many users are actively engaging with and building upon the content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1100+ Commits&lt;/strong&gt;: Reflecting mythe community dedication to continually improving and expanding the resource.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;30+ Topics&lt;/strong&gt;: Covering a comprehensive range of DevOps subjects, from containerization. CI/CD tools to cloud services and beyond.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;34 Contributors&lt;/strong&gt;:Thank you all for your contributions! 💖&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These metrics highlight not only the project's growth but also the active development, extensive coverage, and community interest in DevOps practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is devops-basics?
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;devops-basics&lt;/strong&gt; repository is a comprehensive resource I created to share my information and experience in DevOps with everyone. It's designed to help both newcomers and experienced professionals enhance their DevOps skills. The repository covers a wide range of topics including Docker, Kubernetes, Terraform, Ansible, cloud services, system architecture, monitoring, and much more. With over &lt;strong&gt;30+&lt;/strong&gt; important DevOps subjects, each topic comes with an overview, official documentation links, cheatsheets, and additional resources to facilitate learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features 🚀
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Wide range of topics&lt;/strong&gt;: Explore &lt;strong&gt;30+&lt;/strong&gt; important DevOps subjects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Useful resources&lt;/strong&gt;: Each topic includes overviews, documentation links, cheatsheets, and extra learning materials&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hands-On practice&lt;/strong&gt;: Basic examples for each topic allow you to apply what you've learned&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced examples&lt;/strong&gt;: Further elevate your skills with more complex scenarios&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Thank You to the Supporters 💖
&lt;/h2&gt;

&lt;p&gt;I want to extend my heartfelt gratitude to everyone who has shown interest in and supported this project. Your stars, forks, and contributions have been instrumental in reaching this milestone. This achievement wouldn't have been possible without the DevOps community's engagement and enthusiasm.&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking Ahead 👓
&lt;/h2&gt;

&lt;p&gt;Reaching &lt;strong&gt;200&lt;/strong&gt; stars is just the beginning! I am committed to maintaining and frequently updating the content in the devops-basics repository. My goal is to continue providing valuable resources and practical examples to help DevOps enthusiasts at all levels improve their skills and knowledge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Involved 💎
&lt;/h2&gt;

&lt;p&gt;Your feedback and contributions are always welcome! If you have suggestions for new topics, improvements to existing content, or want to contribute your own examples, please don't hesitate to open an issue or submit a pull request on GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Star the Repository ⭐️
&lt;/h2&gt;

&lt;p&gt;If you find the &lt;strong&gt;devops-basics&lt;/strong&gt; repository helpful and haven't starred it yet, I'd greatly appreciate your support!&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/tungbq/devops-basics" rel="noopener noreferrer"&gt;&lt;strong&gt;Star devops-basics ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;Thank you once again for being part of this journey. Let's continue learning and growing together in the exciting world of DevOps! Happy coding! 🚀&lt;/p&gt;

</description>
      <category>devops</category>
      <category>opensource</category>
      <category>tooling</category>
      <category>cicd</category>
    </item>
    <item>
      <title>Introducing DevOps Toolkit CLI 🐳</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Sun, 01 Sep 2024 03:26:28 +0000</pubDate>
      <link>https://forem.com/tungbq/introducing-devops-toolkit-cli-4nl0</link>
      <guid>https://forem.com/tungbq/introducing-devops-toolkit-cli-4nl0</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;If you've been following the &lt;a href="https://github.com/tungbq/devops-toolkit" rel="noopener noreferrer"&gt;DevOps Toolkit&lt;/a&gt; project, you know how it simplifies the management of multiple DevOps tools in a containerized environment. We've continuously improved the toolkit, from its initial release to the recent addition of Configuration Reusability. Today, I'm excited to introduce our latest feature: the &lt;strong&gt;DevOps Toolkit CLI&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The DevOps Toolkit CLI
&lt;/h2&gt;

&lt;p&gt;The DevOps Toolkit CLI is a powerful new tool designed to enhance your experience with the DevOps Toolkit. It provides a streamlined interface for managing your DevOps Toolkit containers, making it easier than ever to initialize, run, update, and clean up your DevOps environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features of DevOps Toolkit CLI
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Container Management&lt;/strong&gt;: Initialize and manage multiple DevOps Toolkit containers, each with its own configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy Initialization&lt;/strong&gt;: Quickly set up new DevOps Toolkit containers with a single command.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficient Updates&lt;/strong&gt;: Update your containers to the latest DevOps Toolkit image with ease.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Streamlined Execution&lt;/strong&gt;: Run commands in your containers without having to manually attach to them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple Cleanup&lt;/strong&gt;: Remove individual containers or clean up all DevOps Toolkit containers at once.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Getting Started with DevOps Toolkit CLI
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Ensure you have &lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; installed on your system. If you're new to Docker, check out this &lt;a href="https://github.com/tungbq/devops-basic/tree/main/topics/docker" rel="noopener noreferrer"&gt;Docker guide&lt;/a&gt; to get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-o&lt;/span&gt; devops-toolkit-cli https://raw.githubusercontent.com/tungbq/devops-toolkit/main/devops-toolkit-cli
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x devops-toolkit-cli
&lt;span class="nb"&gt;sudo mv &lt;/span&gt;devops-toolkit-cli /usr/local/bin/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Basic Usage
&lt;/h3&gt;

&lt;p&gt;Here are some example commands to get you started with the DevOps Toolkit CLI:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Navigate to your workspace folder:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# For example:&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /home/user/working/coding/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Initialize a new container:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;devops-toolkit-cli init my_toolkit_01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run a command in a container:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;devops-toolkit-cli run my_toolkit_01 python3 &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Update a container to the latest DevOps Toolkit image:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;devops-toolkit-cli update my_toolkit_01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Clean up a specific container:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;devops-toolkit-cli cleanup my_toolkit_01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Clean up all DevOps Toolkit containers:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;devops-toolkit-cli cleanup &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;List all initialized containers:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;devops-toolkit-cli list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more commands instruction, run &lt;code&gt;devops-toolkit-cli help&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;➜ devops-toolkit-cli help

Usage: /usr/local/bin/devops-toolkit-cli [command] &amp;lt;container_name&amp;gt; [options]
Commands:
  init &amp;lt;container_name&amp;gt; [version]: Initialize a new container and configuration directory. If version is omitted, initializes with the latest image.
  run &amp;lt;container_name&amp;gt; [command]: Start a new container and run a command
  exec &amp;lt;container_name&amp;gt; [command]: Execute a command in an existing container
  cleanup --all: Remove all DevOps Toolkit containers
  cleanup &amp;lt;container_name&amp;gt;: Remove the specified container
  update &amp;lt;container_name&amp;gt; [version]: Update the container image. If version is omitted, updates to latest.
  version &amp;lt;container_name&amp;gt;: Display version information for the specified container
  list-versions: List available versions of the DevOps toolkit
  health &amp;lt;container_name&amp;gt;: Perform a health check on the specified running container
  logs &amp;lt;container_name&amp;gt;: View the logs of the specified running container
  shell &amp;lt;container_name&amp;gt;: Get a shell inside the specified running container
  list: List all initialized containers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The DevOps Toolkit CLI is a significant step forward in our mission to simplify DevOps workflows. By providing an efficient way to manage your DevOps Toolkit containers, we're making it easier than ever to leverage the power of our pre-configured DevOps environment.&lt;/p&gt;

&lt;p&gt;We encourage you to try out the DevOps Toolkit CLI and share your feedback. Your input is invaluable in helping us improve and expand the capabilities of this tool.&lt;/p&gt;

&lt;p&gt;Happy coding, and may your DevOps journey be smoother than ever! 💖&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/tungbq/devops-toolkit" rel="noopener noreferrer"&gt;&lt;strong&gt;Star devops-toolkit ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>devops</category>
      <category>tooling</category>
      <category>docker</category>
      <category>toolbox</category>
    </item>
    <item>
      <title>Introducing the cmd: Essential commands for your daily work 🔖</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Wed, 14 Aug 2024 17:40:05 +0000</pubDate>
      <link>https://forem.com/tungbq/introducing-the-cmd-your-new-go-to-bookmark-for-essential-software-engineering-commands-o8</link>
      <guid>https://forem.com/tungbq/introducing-the-cmd-your-new-go-to-bookmark-for-essential-software-engineering-commands-o8</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;As a software engineer, are you tired of constantly searching for that one CLI command you can't quite remember? Look no further! I'm excited to introduce my new CLI Commands Reference project (&lt;a href="https://github.com/tungbq/cmd" rel="noopener noreferrer"&gt;cmd&lt;/a&gt;), a comprehensive collection of essential command-line commands for your daily tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;This newly created project aims to be your go-to resource for quickly looking up commands across a wide range of technologies.&lt;br&gt;
The &lt;a href="https://github.com/tungbq/cmd" rel="noopener noreferrer"&gt;cmd&lt;/a&gt; repository collects essential command-line commands for a software engineer's daily tasks 📑&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Website: &lt;a href="https://tungbq.github.io/cmd/" rel="noopener noreferrer"&gt;tungbq.github.io/cmd&lt;/a&gt; (&lt;strong&gt;auto-deploy&lt;/strong&gt; on source code changed)&lt;/li&gt;
&lt;li&gt;Source code: &lt;a href="https://github.com/tungbq/cmd" rel="noopener noreferrer"&gt;tungbq/cmd&lt;/a&gt; ⭐&lt;/li&gt;
&lt;li&gt;Contributing guideline: &lt;a href="https://github.com/tungbq/cmd/blob/main/CONTRIBUTING.md" rel="noopener noreferrer"&gt;here&lt;/a&gt; 📖&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As this is a &lt;strong&gt;growing project&lt;/strong&gt; and &lt;strong&gt;may not&lt;/strong&gt; be the &lt;strong&gt;perfect&lt;/strong&gt; version as of now. So if you have any tools or commands you'd like to see added, please feel free to comment or create a pull request. Your contributions are what will make this resource truly valuable for the entire community.&lt;/p&gt;

&lt;p&gt;Now lets check the content that we had so far in the first release &lt;a href="https://github.com/tungbq/cmd/releases/tag/v0.1.0" rel="noopener noreferrer"&gt;v0.1.0&lt;/a&gt; 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Linux Commands&lt;/li&gt;
&lt;li&gt;SSH Commands&lt;/li&gt;
&lt;li&gt;JQ Commands&lt;/li&gt;
&lt;li&gt;Git Commands&lt;/li&gt;
&lt;li&gt;Docker Commands&lt;/li&gt;
&lt;li&gt;Kubernetes Commands&lt;/li&gt;
&lt;li&gt;Helm Commands&lt;/li&gt;
&lt;li&gt;Ansible Commands&lt;/li&gt;
&lt;li&gt;Terraform Commands&lt;/li&gt;
&lt;li&gt;PostgreSQL Commands&lt;/li&gt;
&lt;li&gt;Python Commands&lt;/li&gt;
&lt;li&gt;Azure CLI Commands&lt;/li&gt;
&lt;li&gt;...and more upcoming content, stay tuneeeeed!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Linux Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clear terminal output&lt;/span&gt;
clear

&lt;span class="c"&gt;# List files in the current directory with details&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt;

&lt;span class="c"&gt;# Check system stats&lt;/span&gt;
&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/os-release
&lt;span class="nb"&gt;cat&lt;/span&gt; /proc/meminfo
&lt;span class="nb"&gt;nproc&lt;/span&gt;

&lt;span class="c"&gt;# Working with linux service&lt;/span&gt;
systemctl status target_service
systemctl start target_service
systemctl stop target_service
journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; target_service

&lt;span class="c"&gt;# Change file mode&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x some_file.sh

&lt;span class="c"&gt;# Change directory owner&lt;/span&gt;
&lt;span class="nb"&gt;chown &lt;/span&gt;0600 /path/to/directory

&lt;span class="c"&gt;# Create new directory&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; /path/to/directory

&lt;span class="c"&gt;# Change directory&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/directory

&lt;span class="c"&gt;# Copy a file or directory&lt;/span&gt;
&lt;span class="nb"&gt;cp source &lt;/span&gt;destination

&lt;span class="c"&gt;# Move or rename a file or directory&lt;/span&gt;
&lt;span class="nb"&gt;mv &lt;/span&gt;old-name new-name

&lt;span class="c"&gt;# Remove a file&lt;/span&gt;
&lt;span class="nb"&gt;rm &lt;/span&gt;file-name

&lt;span class="c"&gt;# Show disk usage of directories and files&lt;/span&gt;
&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt; &lt;span class="nt"&gt;--max-depth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1

&lt;span class="c"&gt;# Search for a pattern in files&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s2"&gt;"pattern"&lt;/span&gt; /path/to/search

&lt;span class="c"&gt;# Display the current directory's path&lt;/span&gt;
&lt;span class="nb"&gt;pwd&lt;/span&gt;

&lt;span class="c"&gt;# History&lt;/span&gt;
&lt;span class="nb"&gt;history&lt;/span&gt;

&lt;span class="c"&gt;# CURL, add '-k' to ignore certificate verification&lt;/span&gt;
curl https://abc.example.com

&lt;span class="c"&gt;# wget - Download a file from a URL&lt;/span&gt;
wget http://example.com/file.zip

&lt;span class="c"&gt;# wget - Download a file and save it with a different name&lt;/span&gt;
wget &lt;span class="nt"&gt;-O&lt;/span&gt; newfile.zip http://example.com/file.zip

&lt;span class="c"&gt;# Check network&lt;/span&gt;
netstat &lt;span class="nt"&gt;-anpt&lt;/span&gt;

&lt;span class="c"&gt;# Check system metric (CPU/RAM/...)&lt;/span&gt;
top

&lt;span class="c"&gt;# Tar&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-cvf&lt;/span&gt; sampleArchive.tar /home/sampleArchive

&lt;span class="c"&gt;# Extract&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xvf&lt;/span&gt; sampleArchive.tar
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xvf&lt;/span&gt; sampleArchive.tar.gz &lt;span class="nt"&gt;-C&lt;/span&gt; /home/ExtractedFiles/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  SSH Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Generate SSH keys&lt;/span&gt;
ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa

&lt;span class="c"&gt;# SSH to a server using username/password&lt;/span&gt;
ssh user@1.2.3.4

&lt;span class="c"&gt;# SSH to a server using key&lt;/span&gt;
ssh &lt;span class="nt"&gt;-i&lt;/span&gt; user_key.pem user@1.2.3.4

&lt;span class="c"&gt;# Use locally available keys to authorise logins on a remote machine&lt;/span&gt;
ssh-copy-id user@1.2.3.4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  JQ Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Pretty-print JSON data&lt;/span&gt;
jq &lt;span class="s1"&gt;'.'&lt;/span&gt;

&lt;span class="c"&gt;# Extract a specific field from a JSON object&lt;/span&gt;
jq &lt;span class="s1"&gt;'.fieldName'&lt;/span&gt; file.json

&lt;span class="c"&gt;# Filter JSON data by a specific condition&lt;/span&gt;
jq &lt;span class="s1"&gt;'select(.fieldName == "value")'&lt;/span&gt; file.json

&lt;span class="c"&gt;# Parse JSON from an API response&lt;/span&gt;
curl &lt;span class="nt"&gt;-s&lt;/span&gt; http://api.example.com/data | jq &lt;span class="s1"&gt;'.'&lt;/span&gt;

&lt;span class="c"&gt;# Flatten a nested JSON structure&lt;/span&gt;
jq &lt;span class="s1"&gt;'.[].nestedField'&lt;/span&gt; file.json

&lt;span class="c"&gt;# Format JSON output into a more readable structure&lt;/span&gt;
jq &lt;span class="s1"&gt;'.'&lt;/span&gt; file.json | less
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  Git Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone repo via HTTPS&lt;/span&gt;
git clone https://github.com/REPO_OWNER/repo.git

&lt;span class="c"&gt;# Clone repo via SSH&lt;/span&gt;
git clone git@github.com:REPO_OWNER/repo.git

&lt;span class="c"&gt;# Create a new branch&lt;/span&gt;
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; new-branch

&lt;span class="c"&gt;# Pull the latest changes from the remote repository&lt;/span&gt;
git pull origin main

&lt;span class="c"&gt;# Check the status of your working directory&lt;/span&gt;
git status

&lt;span class="c"&gt;# Add all changes to the staging area&lt;/span&gt;
git add &lt;span class="nb"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;# Commit changes with a message&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Your commit message"&lt;/span&gt;

&lt;span class="c"&gt;# View log&lt;/span&gt;
git log

&lt;span class="c"&gt;# Push to remote feature branch&lt;/span&gt;
git push origin new-branch

&lt;span class="c"&gt;# Reset staging area to match the lastest origin commit&lt;/span&gt;
git reset origin/main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# List all running containers&lt;/span&gt;
docker ps

&lt;span class="c"&gt;# List all containers (including stopped ones)&lt;/span&gt;
docker ps &lt;span class="nt"&gt;-a&lt;/span&gt;

&lt;span class="c"&gt;# Build an image from a Dockerfile&lt;/span&gt;
docker build &lt;span class="nt"&gt;-t&lt;/span&gt; your-image-name &lt;span class="nb"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;# Run a container from an image&lt;/span&gt;
docker run &lt;span class="nt"&gt;--name&lt;/span&gt; container-name your-image-name

&lt;span class="c"&gt;# Stop a running container&lt;/span&gt;
docker stop container-name

&lt;span class="c"&gt;# Remove a stopped container&lt;/span&gt;
docker &lt;span class="nb"&gt;rm &lt;/span&gt;container-name

&lt;span class="c"&gt;# Remove an image&lt;/span&gt;
docker rmi image-name

&lt;span class="c"&gt;# Show container logs&lt;/span&gt;
docker logs container-name

&lt;span class="c"&gt;# List all Docker images&lt;/span&gt;
docker images

&lt;span class="c"&gt;# Enter a running container's shell&lt;/span&gt;
docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; container-name /bin/bash

&lt;span class="c"&gt;# Cleanup docker (add `-f` flag to force cleanup)&lt;/span&gt;
docker system prune

&lt;span class="c"&gt;## Docker Compose&lt;/span&gt;
&lt;span class="c"&gt;# Start up containers as defined in the Docker Compose file&lt;/span&gt;
docker compose up

&lt;span class="c"&gt;# Start up containers in detached mode&lt;/span&gt;
docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;

&lt;span class="c"&gt;# Stop running containers&lt;/span&gt;
docker compose down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  Kubernetes Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Export KUBECONFIG to access the cluster&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;KUBECONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/path/to/kubeconfig.conf

&lt;span class="c"&gt;# Check nodes&lt;/span&gt;
kubectl get nodes

&lt;span class="c"&gt;# Get all pods in the target namespace&lt;/span&gt;
kubectl get pods &lt;span class="nt"&gt;-n&lt;/span&gt; your_namespace

&lt;span class="c"&gt;# Get all services in the current namespace&lt;/span&gt;
kubectl get svc &lt;span class="nt"&gt;-n&lt;/span&gt; your_namespace

&lt;span class="c"&gt;# Get all resources in all namespace&lt;/span&gt;
kubectl get all &lt;span class="nt"&gt;-A&lt;/span&gt;

&lt;span class="c"&gt;# Describe a pod&lt;/span&gt;
kubectl describe pod pod-name

&lt;span class="c"&gt;# Apply a configuration to a resource by filename or stdin&lt;/span&gt;
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; config-file.yaml

&lt;span class="c"&gt;# Delete resources by filenames, stdin, resources, and names&lt;/span&gt;
kubectl delete &lt;span class="nt"&gt;-f&lt;/span&gt; config-file.yaml

&lt;span class="c"&gt;# Get logs from a pod&lt;/span&gt;
kubectl logs pod-name

&lt;span class="c"&gt;# Execute a command in a container&lt;/span&gt;
kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; pod-name &lt;span class="nt"&gt;--&lt;/span&gt; /bin/bash

&lt;span class="c"&gt;# Forward a port from a pod to the local machine&lt;/span&gt;
kubectl port-forward pod-name 8080:80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  Helm Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Add a Helm repository&lt;/span&gt;
helm repo add repo-name https://example.com/repo

&lt;span class="c"&gt;# Update all Helm repositories&lt;/span&gt;
helm repo update

&lt;span class="c"&gt;# Search for charts in a Helm repository&lt;/span&gt;
helm search repo repo-name

&lt;span class="c"&gt;# Install a Helm chart&lt;/span&gt;
helm &lt;span class="nb"&gt;install &lt;/span&gt;release-name repo-name/chart-name

&lt;span class="c"&gt;# List all Helm releases across all namespaces&lt;/span&gt;
helm list &lt;span class="nt"&gt;--all-namespaces&lt;/span&gt;

&lt;span class="c"&gt;# Uninstall a Helm release&lt;/span&gt;
helm uninstall release-name

&lt;span class="c"&gt;# Upgrade an existing Helm release&lt;/span&gt;
helm upgrade release-name repo-name/chart-name

&lt;span class="c"&gt;# Get the status of a Helm release&lt;/span&gt;
helm status release-name

&lt;span class="c"&gt;# Show the history of a Helm release&lt;/span&gt;
helm &lt;span class="nb"&gt;history &lt;/span&gt;release-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  Ansible Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run an Ansible playbook&lt;/span&gt;
ansible-playbook playbook.yml &lt;span class="nt"&gt;-i&lt;/span&gt; inventory.ini

&lt;span class="c"&gt;# Run a single Ansible ad-hoc command&lt;/span&gt;
ansible all &lt;span class="nt"&gt;-m&lt;/span&gt; ping

&lt;span class="c"&gt;# List all available Ansible roles&lt;/span&gt;
ansible-galaxy list

&lt;span class="c"&gt;# Install a role from Ansible Galaxy&lt;/span&gt;
ansible-galaxy &lt;span class="nb"&gt;install &lt;/span&gt;role-name

&lt;span class="c"&gt;# Test an Ansible inventory file&lt;/span&gt;
ansible-inventory &lt;span class="nt"&gt;--list&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; inventory.ini

&lt;span class="c"&gt;# Run an Ansible playbook with increased verbosity&lt;/span&gt;
ansible-playbook playbook.yml &lt;span class="nt"&gt;-vvv&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  Terraform Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Initialize a Terraform configuration directory&lt;/span&gt;
terraform init

&lt;span class="c"&gt;# Plan the changes required by the Terraform configuration&lt;/span&gt;
terraform plan

&lt;span class="c"&gt;# Apply the changes required by the Terraform configuration&lt;/span&gt;
terraform apply

&lt;span class="c"&gt;# Create a Terraform execution plan and save it to a file (recommended)&lt;/span&gt;
terraform plan &lt;span class="nt"&gt;-out&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"tfplan.out"&lt;/span&gt;

&lt;span class="c"&gt;# Apply the changes from saved plan&lt;/span&gt;
terraform apply &lt;span class="s2"&gt;"tfplan.out"&lt;/span&gt;

&lt;span class="c"&gt;# Apply the changes automatically (use with your own risk, suitable for automation tasks)&lt;/span&gt;
terraform apply &lt;span class="nt"&gt;--auto-aprove&lt;/span&gt;

&lt;span class="c"&gt;# Destroy all the resources managed by Terraform&lt;/span&gt;
terraform destroy

&lt;span class="c"&gt;# Validate the Terraform configuration files&lt;/span&gt;
terraform validate

&lt;span class="c"&gt;# Format Terraform configuration files&lt;/span&gt;
terraform &lt;span class="nb"&gt;fmt&lt;/span&gt;

&lt;span class="c"&gt;# Show the current state of Terraform-managed infrastructure&lt;/span&gt;
terraform show

&lt;span class="c"&gt;# Refresh the state file with the real infrastructure&lt;/span&gt;
terraform refresh

&lt;span class="c"&gt;# List the available Terraform providers&lt;/span&gt;
terraform providers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  PostgreSQL Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Connect to a PostgreSQL database&lt;/span&gt;
psql &lt;span class="nt"&gt;-h&lt;/span&gt; &lt;span class="nb"&gt;hostname&lt;/span&gt; &lt;span class="nt"&gt;-U&lt;/span&gt; username &lt;span class="nt"&gt;-d&lt;/span&gt; database_name

&lt;span class="c"&gt;# List all databases&lt;/span&gt;
psql &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\l&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# List all tables in the current database&lt;/span&gt;
psql &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\d&lt;/span&gt;&lt;span class="s2"&gt;t"&lt;/span&gt;

&lt;span class="c"&gt;# Show the structure of a specific table&lt;/span&gt;
psql &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\d&lt;/span&gt;&lt;span class="s2"&gt; table_name"&lt;/span&gt;

&lt;span class="c"&gt;# Create a new database&lt;/span&gt;
createdb new_database_name

&lt;span class="c"&gt;# Drop an existing database&lt;/span&gt;
dropdb database_name

&lt;span class="c"&gt;# Create a new user&lt;/span&gt;
createuser new_user_name

&lt;span class="c"&gt;# Drop an existing user&lt;/span&gt;
dropuser user_name

&lt;span class="c"&gt;# Grant all privileges on a database to a user&lt;/span&gt;
psql &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"GRANT ALL PRIVILEGES ON DATABASE database_name TO user_name"&lt;/span&gt;

&lt;span class="c"&gt;# Revoke all privileges on a database from a user&lt;/span&gt;
psql &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"REVOKE ALL PRIVILEGES ON DATABASE database_name FROM user_name"&lt;/span&gt;

&lt;span class="c"&gt;# Backup a PostgreSQL database to a file&lt;/span&gt;
pg_dump database_name &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; backup_file.sql

&lt;span class="c"&gt;# Restore a PostgreSQL database from a backup file&lt;/span&gt;
psql database_name &amp;lt; backup_file.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  Python Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run a python script&lt;/span&gt;
python python_script.py

&lt;span class="c"&gt;# Install a package using pip&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;package-name

&lt;span class="c"&gt;# Install a specific version of a package&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;package-name&lt;span class="o"&gt;==&lt;/span&gt;1.2.3

&lt;span class="c"&gt;# Uninstall a package&lt;/span&gt;
pip uninstall package-name

&lt;span class="c"&gt;# List all installed packages&lt;/span&gt;
pip list

&lt;span class="c"&gt;# Freeze installed packages into a requirements file&lt;/span&gt;
pip freeze &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; requirements.txt

&lt;span class="c"&gt;# Install packages from a requirements file&lt;/span&gt;
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure CLI Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Login to Azure&lt;/span&gt;
az login

&lt;span class="c"&gt;# Login with device code&lt;/span&gt;
az login &lt;span class="nt"&gt;--use-device-code&lt;/span&gt;

&lt;span class="c"&gt;# Get the details of a subscription&lt;/span&gt;
az account show

&lt;span class="c"&gt;# List all subscriptions associated with your account&lt;/span&gt;
az account list &lt;span class="nt"&gt;--output&lt;/span&gt; table

&lt;span class="c"&gt;# Set a specific subscription as default&lt;/span&gt;
az account &lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;--subscription&lt;/span&gt; &lt;span class="s2"&gt;"SUBSCRIPTION_ID"&lt;/span&gt;

&lt;span class="c"&gt;# List all resource groups&lt;/span&gt;
az group list &lt;span class="nt"&gt;--output&lt;/span&gt; table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back to top 🔝&lt;/p&gt;

&lt;p&gt;...and I am sure there are more upcoming content, stay tuneeeeed!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This CLI Commands Reference project is a &lt;strong&gt;living document&lt;/strong&gt;, and I'm committed to keeping it updated and expanding it with your help. I hope this resource will become an useful resource for your daily work.&lt;/p&gt;

&lt;p&gt;Final words, &lt;strong&gt;thank you for reading this post&lt;/strong&gt;. If you have suggestions for new commands, improvements to existing ones, or even new categories to add, please don't hesitate to get involved. Let's work together to create the most comprehensive and up-to-date CLI reference for software engineers everywhere, &lt;strong&gt;your contributions can make a significant impact!&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;Don't forget to &lt;strong&gt;star&lt;/strong&gt; the repository or &lt;strong&gt;bookmark&lt;/strong&gt; the GitHub page &lt;a href="https://tungbq.github.io/cmd/" rel="noopener noreferrer"&gt;tungbq.github.io/cmd&lt;/a&gt; if you found it useful, and happy coding ❤️!&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/tungbq/cmd" rel="noopener noreferrer"&gt;&lt;strong&gt;Star tungbq/cmd ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>cli</category>
      <category>softwareengineering</category>
      <category>cheatsheet</category>
    </item>
    <item>
      <title>DevOps Basics: 3 new topics to boost your skills ✨</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Tue, 30 Jul 2024 17:05:25 +0000</pubDate>
      <link>https://forem.com/tungbq/devops-basics-3-new-topics-to-boost-your-skills-43ah</link>
      <guid>https://forem.com/tungbq/devops-basics-3-new-topics-to-boost-your-skills-43ah</guid>
      <description>&lt;p&gt;In this post I will keep it short, I'm excited to inform that the &lt;a href="https://github.com/tungbq/devops-basics" rel="noopener noreferrer"&gt;DevOps Basics&lt;/a&gt; repository on GitHub has just expanded its offerings with 3 exciting new topics (via version &lt;a href="https://github.com/tungbq/devops-basics/releases/tag/v0.30.0" rel="noopener noreferrer"&gt;v0.30.0&lt;/a&gt;). This update continues the project's mission to provide a comprehensive resource for DevOps enthusiasts and professionals alike.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. HAProxy: Load Balancing Made Easy
&lt;/h3&gt;

&lt;p&gt;HAProxy, a reliable, high-performance TCP/HTTP load balancer, is now part of the DevOps Basics curriculum. This addition will help you understand how to efficiently distribute network traffic across multiple servers, ensuring high availability and improved performance for your applications. See: &lt;a href="https://github.com/tungbq/devops-basics/tree/main/topics/haproxy" rel="noopener noreferrer"&gt;devops-basics/topics/haproxy&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Agile and Scrum: Embracing Modern Development Methodologies
&lt;/h3&gt;

&lt;p&gt;The repository now includes a section on Agile and Scrum methodologies. This topic is crucial for understanding the iterative, collaborative approach that underpins many DevOps practices. Learn how these methodologies can streamline your development process and improve team productivity. See: &lt;a href="https://github.com/tungbq/devops-basics/tree/main/topics/agile" rel="noopener noreferrer"&gt;devops-basics/topics/agile&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3.Packer: Automating Machine Image Creation
&lt;/h3&gt;

&lt;p&gt;Hashicorp's Packer tool has been added to the lineup, complete with hands-on examples. Packer allows you to create identical machine images for multiple platforms from a single source configuration. This addition will teach you how to automate the creation of consistent, reproducible machine images for your infrastructure. See: &lt;a href="https://github.com/tungbq/devops-basics/tree/main/topics/packer" rel="noopener noreferrer"&gt;devops-basics/topics/packer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These new topics, along with continuous updates to existing content, make DevOps Basics an even more valuable resource for anyone looking to enhance their DevOps skills. Whether you're a beginner or an experienced practitioner, there's always something new to learn in this ever-evolving field.&lt;/p&gt;

&lt;p&gt;Check out the DevOps Basics repository on GitHub to explore these new topics and much more. Also let me know if you have any feedback or topic would like to add to the devops basics repository. Thank you and happy learning! 🔥&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/tungbq/devops-basics" rel="noopener noreferrer"&gt;&lt;strong&gt;Star devops-basics ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>devops</category>
      <category>web</category>
      <category>tutorial</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Automating GitLab Runner Setup on AWS EC2 Using Terraform 🦊☁️</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Thu, 25 Jul 2024 17:57:42 +0000</pubDate>
      <link>https://forem.com/tungbq/automating-gitlab-runner-setup-on-aws-ec2-using-terraform-bhc</link>
      <guid>https://forem.com/tungbq/automating-gitlab-runner-setup-on-aws-ec2-using-terraform-bhc</guid>
      <description>&lt;h2&gt;
  
  
  Introduction 👋
&lt;/h2&gt;

&lt;p&gt;As DevOps engineers, our daily tasks often involve setting up and managing infrastructure to support CI/CD pipelines. Automating these processes can significantly enhance our efficiency and consistency. In this blog post, I'll walk you through provisioning and configuring a &lt;strong&gt;GitLab Runner&lt;/strong&gt; on an &lt;strong&gt;AWS EC2&lt;/strong&gt; instance using &lt;strong&gt;Terraform&lt;/strong&gt;. This setup will allow you to integrate GitLab CI/CD with AWS infrastructure seamlessly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we start, make sure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A GitLab account: &lt;a href="https://gitlab.com/" rel="noopener noreferrer"&gt;https://gitlab.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Create new group &amp;gt; new project on GitLab if needed, e.g: &lt;code&gt;thedevopshub/hello-gitlab.git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;An active AWS account: &lt;a href="https://signin.aws.amazon.com/signup?request_type=register" rel="noopener noreferrer"&gt;https://signin.aws.amazon.com/signup?request_type=register&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Terraform installed on your machine&lt;/li&gt;
&lt;li&gt;AWS CLI installed and configured on your machine&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can refer to my previous Terraform post &lt;a href="https://dev.to/tungbq/the-terraform-getting-started-guide-3oe2"&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt; to learn more about Terraform&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Prepare the environment&lt;/li&gt;
&lt;li&gt;Configure Terraform&lt;/li&gt;
&lt;li&gt;Provision the GitLab Runner on AWS&lt;/li&gt;
&lt;li&gt;Verify GitLab CI/CD pipeline runs on new EC2 runner&lt;/li&gt;
&lt;li&gt;Clean up resources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; All the code for this blog post are available at: &lt;a href="https://github.com/TheDevOpsHub/TerraformHub/tree/main/AWS/aws-ec2-gitlab-runner" rel="noopener noreferrer"&gt;https://github.com/TheDevOpsHub/TerraformHub/tree/main/AWS/aws-ec2-gitlab-runner&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Prepare the Environment
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create an AWS Key Pair:
&lt;/h3&gt;

&lt;p&gt;Follow the AWS documentation to create a key pair: &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Generate a GitLab Runner Registration Token:
&lt;/h3&gt;

&lt;p&gt;Navigate to your GitLab project or group, then go to Settings &amp;gt; CI/CD &amp;gt; Runners, and register a new runner to get the token. Register GitLab Runner&lt;/p&gt;

&lt;h3&gt;
  
  
  Clone the Repository:
&lt;/h3&gt;

&lt;p&gt;Clone the repository containing the Terraform configuration or create a new directory for your Terraform files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone git@github.com:TheDevOpsHub/TerraformHub.git
&lt;span class="c"&gt;# or creating your file manually: `mkdir -p TerraformHub/AWS/aws-ec2-gitlab-runner`&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;TerraformHub/AWS/aws-ec2-gitlab-runner
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Configure Terraform
&lt;/h2&gt;

&lt;p&gt;Create a &lt;code&gt;main.tf&lt;/code&gt; file with the following content to define the AWS resources:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_security_group"&lt;/span&gt; &lt;span class="s2"&gt;"gitlab_runner"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"gitlab-runner-sg"&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Security group for GitLab Runner"&lt;/span&gt;

  &lt;span class="nx"&gt;ingress&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;from_port&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;
    &lt;span class="nx"&gt;to_port&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;
    &lt;span class="nx"&gt;protocol&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tcp"&lt;/span&gt;
    &lt;span class="nx"&gt;cidr_blocks&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;egress&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;from_port&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="nx"&gt;to_port&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="nx"&gt;protocol&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"-1"&lt;/span&gt;
    &lt;span class="nx"&gt;cidr_blocks&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"gitlab_runner"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;# Check all available us-east-1 AMIs at: https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#AMICatalog&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt;             &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-03972092c42e8c0ca"&lt;/span&gt; &lt;span class="c1"&gt;# Amazon Linux 2 AMI&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;instance_type&lt;/span&gt;
  &lt;span class="nx"&gt;key_name&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key_name&lt;/span&gt;
  &lt;span class="nx"&gt;security_groups&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;gitlab_runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="nx"&gt;user_data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;templatefile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"install_runner.tpl"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;gitlab_runner_registration_token&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;gitlab_runner_registration_token&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AWS EC2 GitLab Runner"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an &lt;code&gt;install_runner.tpl&lt;/code&gt; file for the user data script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# Install necessary dependencies&lt;/span&gt;
&lt;span class="c"&gt;# set -x enables a mode of the shell where all executed commands are printed to the terminal&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello from EC2 user data script"&lt;/span&gt;

yum update &lt;span class="nt"&gt;-y&lt;/span&gt;
yum &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; curl git

&lt;span class="c"&gt;# Install GitLab Runner&lt;/span&gt;
curl &lt;span class="nt"&gt;-L&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x /usr/local/bin/gitlab-runner


useradd &lt;span class="nt"&gt;--comment&lt;/span&gt; &lt;span class="s1"&gt;'GitLab Runner'&lt;/span&gt; &lt;span class="nt"&gt;--create-home&lt;/span&gt; gitlab-runner &lt;span class="nt"&gt;--shell&lt;/span&gt; /bin/bash

&lt;span class="c"&gt;# Start the GitLab Runner service&lt;/span&gt;
/usr/local/bin/gitlab-runner &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gitlab-runner &lt;span class="nt"&gt;--working-directory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/home/gitlab-runner
/usr/local/bin/gitlab-runner start

&lt;span class="c"&gt;# Register the GitLab Runner&lt;/span&gt;
/usr/local/bin/gitlab-runner register &lt;span class="nt"&gt;--non-interactive&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--url&lt;/span&gt; &lt;span class="s2"&gt;"https://gitlab.com/"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--registration-token&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;gitlab_runner_registration_token&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--executor&lt;/span&gt; &lt;span class="s2"&gt;"shell"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--description&lt;/span&gt; &lt;span class="s2"&gt;"AWS GitLab Runner"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--tag-list&lt;/span&gt; &lt;span class="s2"&gt;"aws,linux"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--run-untagged&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"true"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--locked&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"false"&lt;/span&gt;

systemctl status &lt;span class="nt"&gt;-l&lt;/span&gt; gitlab-runner.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a &lt;code&gt;variables.tf&lt;/code&gt; file to define variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"aws_region"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"The AWS region to create resources in."&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"instance_type"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"The type of instance to create."&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"key_name"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"The name of the key pair to use for the instance."&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ec2-ssh-key"&lt;/span&gt; &lt;span class="c1"&gt;# change to yours&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"gitlab_runner_registration_token"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"The GitLab Runner registration token."&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;sensitive&lt;/span&gt;   &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a &lt;code&gt;terraform.tfvars&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;aws_region&lt;/span&gt; &lt;span class="err"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
&lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="err"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;
&lt;span class="nx"&gt;key_name&lt;/span&gt; &lt;span class="err"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"your-key-name"&lt;/span&gt;
&lt;span class="nx"&gt;gitlab_runner_registration_token&lt;/span&gt; &lt;span class="err"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"your-registration-token"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an &lt;code&gt;output.tf&lt;/code&gt; file to display outputs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"instance_id"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"The ID of the instance."&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;gitlab_runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"instance_public_ip"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"The public IP of the instance."&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;gitlab_runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;public_ip&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Provision the GitLab Runner on AWS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Initialize Terraform:
&lt;/h3&gt;

&lt;p&gt;Navigate to your project directory and initialize Terraform.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;terraform&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Plan the Configuration:
&lt;/h3&gt;

&lt;p&gt;Create a plan to see the actions Terraform will take.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;terraform&lt;/span&gt; &lt;span class="nx"&gt;plan&lt;/span&gt; &lt;span class="nx"&gt;-out&lt;/span&gt; &lt;span class="s2"&gt;"runner.tfplan"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Apply the Configuration:
&lt;/h3&gt;

&lt;p&gt;Apply the Terraform plan to provision the infrastructure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform apply &lt;span class="s2"&gt;"runner.tfplan"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Verify the Deployment:
&lt;/h3&gt;

&lt;p&gt;After Terraform completes, verify that the GitLab Runner is running on the EC2 instance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Connect to your instance&lt;/span&gt;
ssh &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"your-key-name.pem"&lt;/span&gt; ec2-user@your-instance-public-ip

&lt;span class="c"&gt;# Check GitLab Runner status&lt;/span&gt;
systemctl status gitlab-runner.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On GitLab, navigate to your project &amp;gt; Setting &amp;gt; CICD &amp;gt; Expand the runner you would see the new active runner available.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1zbm3p678xr30c0evjj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1zbm3p678xr30c0evjj.png" alt="Image description" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbh56ljr916pzyrv1dhl9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbh56ljr916pzyrv1dhl9.png" alt="Image description" width="634" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Verify GitLab CI/CD pipeline runs on new EC2 runner
&lt;/h2&gt;

&lt;p&gt;Add the &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; file to the root directory of &lt;code&gt;main&lt;/code&gt; branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .gitlab-ci.yml&lt;/span&gt;
&lt;span class="na"&gt;stages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;verify-runner&lt;/span&gt;

&lt;span class="na"&gt;verify-runner&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;verify-runner&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo "Hello, World!"&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;cat /etc/os-release&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;hostname -f&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;date&lt;/span&gt;
  &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;aws&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit the change and our pipeline will be run successfully on your newly registered EC2 runner:&lt;/p&gt;

&lt;p&gt;Pipeline flow:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Farjq7k8aybutr74e6rbd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Farjq7k8aybutr74e6rbd.png" alt="Image description" width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Logs:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxg4syeuwacx6d6dvnk91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxg4syeuwacx6d6dvnk91.png" alt="Image description" width="589" height="433"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 5: Clean Up Resources
&lt;/h2&gt;

&lt;p&gt;Once you no longer need the runner, you can destroy the resources to avoid unnecessary costs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform destroy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By following these steps, you can automate the setup of a GitLab Runner on AWS EC2 using Terraform. This approach not only saves time but also ensures consistency and repeatability in your CI/CD pipeline infrastructure. If you have any questions or suggestions, feel free to leave a comment below.&lt;/p&gt;




&lt;p&gt;Want to learn more about DevOps? Visit &lt;a href="https://github.com/TheDevOpsHub" rel="noopener noreferrer"&gt;https://github.com/TheDevOpsHub&lt;/a&gt; to explore various repositories from document/hands-on/practical guide&lt;/p&gt;

&lt;p&gt;Thank you for reading and Happy DevOps-ing! 🚀&lt;/p&gt;

</description>
      <category>devops</category>
      <category>terraform</category>
      <category>aws</category>
      <category>gitlab</category>
    </item>
    <item>
      <title>The Terraform Getting Started Guide 🚀</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Fri, 12 Jul 2024 16:51:41 +0000</pubDate>
      <link>https://forem.com/tungbq/the-terraform-getting-started-guide-3oe2</link>
      <guid>https://forem.com/tungbq/the-terraform-getting-started-guide-3oe2</guid>
      <description>&lt;p&gt;As a DevOps engineers, our daily routine often revolves around deploying and managing infrastructure. Mastering the features and functionalities Terraform offers is one of the best investments you can make in yourself as a DevOps.&lt;/p&gt;

&lt;p&gt;In this post we will go through the Terraform introduction, concepts, then get hands on by building, changing, destroying the AWS EC2 instance.&lt;br&gt;
If you think I've overlooked something or should delve deeper into a particular topic, please leave a comment below. I'll update this post accordingly. Thanks in advance!&lt;/p&gt;

&lt;p&gt;Now let’s get started 🔥🔥🔥&lt;/p&gt;


&lt;h2&gt;
  
  
  What is Terraform?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.terraform.io/" rel="noopener noreferrer"&gt;Terraform&lt;/a&gt; is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision a datacenter infrastructure using a declarative configuration language known as HashiCorp Configuration Language (HCL), or optionally JSON.&lt;/p&gt;


&lt;h2&gt;
  
  
  Key Concepts
&lt;/h2&gt;

&lt;p&gt;Understanding the core concepts of Terraform is crucial to effectively managing infrastructure. Here are the foundational elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Providers&lt;/strong&gt;: Providers are responsible for understanding API interactions and exposing resources. AWS, Azure, and Google Cloud are all examples of providers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;: Resources are the most important element in the Terraform language. Each resource block describes one or more infrastructure objects, such as virtual networks, compute instances, or higher-level components such as DNS records.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Modules&lt;/strong&gt;: Modules are containers for multiple resources that are used together. They are the primary way to package and reuse resource configurations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;State&lt;/strong&gt;: Terraform state is used to map real-world resources to your configuration, keep track of metadata, and improve performance for large infrastructures. The state is stored in a &lt;code&gt;.tfstate&lt;/code&gt; file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Provisioners&lt;/strong&gt;: Provisioners are used to execute scripts on a local or remote machine as part of the resource creation or destruction.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Sources&lt;/strong&gt;: Data sources allow Terraform to use information defined outside of Terraform, defined by another separate Terraform configuration, or modified by functions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Installing Terraform
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Check this document: &lt;a href="https://developer.hashicorp.com/terraform/install" rel="noopener noreferrer"&gt;https://developer.hashicorp.com/terraform/install&lt;/a&gt; to install terraform on your machine.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Terraform with AWS Setup
&lt;/h2&gt;

&lt;p&gt;In this guide we will demonstrate the integration between Terraform and AWS infrastructure, to setup AWS with Terraform you will need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Terraform CLI (1.2.0+) installed.&lt;/li&gt;
&lt;li&gt;The AWS CLI installed (&lt;a href="https://aws.amazon.com/cli/" rel="noopener noreferrer"&gt;https://aws.amazon.com/cli/&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;AWS account and associated credentials that allow you to create resources (&lt;a href="https://aws.amazon.com/console/" rel="noopener noreferrer"&gt;https://aws.amazon.com/console/&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To use your IAM credentials to authenticate the Terraform AWS provider, to set the AWS credentials permanently, use &lt;code&gt;aws configure&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws configure

&lt;span class="c"&gt;## Then input your AWS information:&lt;/span&gt;
&lt;span class="c"&gt;# AWS Access Key ID [****************53GT]:&lt;/span&gt;
&lt;span class="c"&gt;# AWS Secret Access Key [****************IGNx]:&lt;/span&gt;
&lt;span class="c"&gt;# Default region name [us-east-1]:&lt;/span&gt;
&lt;span class="c"&gt;# Default output format [None]:&lt;/span&gt;

&lt;span class="c"&gt;## Check your credential by running:&lt;/span&gt;
aws configure list

&lt;span class="c"&gt;## Output&lt;/span&gt;
&lt;span class="c"&gt;# ➜  ~ aws configure list&lt;/span&gt;
&lt;span class="c"&gt;#       Name                    Value             Type    Location&lt;/span&gt;
&lt;span class="c"&gt;#       ----                    -----             ----    --------&lt;/span&gt;
&lt;span class="c"&gt;#    profile                &amp;lt;not set&amp;gt;             None    None&lt;/span&gt;
&lt;span class="c"&gt;# access_key     ****************53GT shared-credentials-file&lt;/span&gt;
&lt;span class="c"&gt;# secret_key     ****************IGNx shared-credentials-file&lt;/span&gt;
&lt;span class="c"&gt;#     region                us-east-1      config-file    ~/.aws/config&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Your First Terraform Configuration
&lt;/h2&gt;

&lt;p&gt;Create a new directory for your project and navigate into it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;terraform-aws-demo
&lt;span class="nb"&gt;cd &lt;/span&gt;terraform-aws-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a file named &lt;code&gt;main.tf&lt;/code&gt; and open it in your favorite text editor. This file will contain your Terraform configuration.&lt;/p&gt;

&lt;p&gt;Here’s a simple configuration to create an EC2 Ubuntu 22.04 instance on AWS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;provider&lt;/span&gt; &lt;span class="s2"&gt;"aws"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;region&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"example"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt;             &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0e001c9271cf7f3b9"&lt;/span&gt; &lt;span class="c1"&gt;# Ubuntu 22.04&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Terraform Demo"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check all available AMI in &lt;code&gt;us-east-1&lt;/code&gt; region at: &lt;a href="https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#AMICatalog" rel="noopener noreferrer"&gt;https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#AMICatalog&lt;/a&gt;&lt;br&gt;
&lt;br&gt;NOTE: You could find the terraform code in this blog post &lt;a href="https://github.com/TheDevOpsHub/TerraformHub/tree/main/common/getting-started" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Initializing Terraform
&lt;/h2&gt;

&lt;p&gt;Before Terraform can perform any operations, it needs to be initialized. This is done by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform init

&lt;span class="c"&gt;## Sample output:&lt;/span&gt;
&lt;span class="c"&gt;# Initializing the backend...&lt;/span&gt;
&lt;span class="c"&gt;# Initializing provider plugins...&lt;/span&gt;
&lt;span class="c"&gt;# - Finding latest version of hashicorp/aws...&lt;/span&gt;
&lt;span class="c"&gt;# - Installing hashicorp/aws v5.58.0...&lt;/span&gt;
&lt;span class="c"&gt;# - Installed hashicorp/aws v5.58.0 (signed by HashiCorp)&lt;/span&gt;
&lt;span class="c"&gt;# ...&lt;/span&gt;
&lt;span class="c"&gt;# Terraform has been successfully initialized!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command downloads the necessary provider plugins and prepares your environment.&lt;/p&gt;




&lt;h2&gt;
  
  
  Creating the Infrastructure
&lt;/h2&gt;

&lt;p&gt;To see what Terraform will do before actually applying changes, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform plan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything looks good, apply the changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform apply

&lt;span class="c"&gt;## Sample output:&lt;/span&gt;
&lt;span class="c"&gt;# Enter a value: yes&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Creating...&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Still creating... [10s elapsed]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Still creating... [20s elapsed]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Still creating... [30s elapsed]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Creation complete after 38s [id=i-099dc08ae004bb7f7]&lt;/span&gt;

&lt;span class="c"&gt;# Apply complete! Resources: 1 added, 0 changed, 0 destroyed.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Terraform will prompt you to confirm. Type &lt;code&gt;yes&lt;/code&gt; to proceed. Terraform will now provision the resources defined in your configuration.&lt;br&gt;
&lt;br&gt;Now visit &lt;a href="https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#Instances:instanceState=running" rel="noopener noreferrer"&gt;AWS EC2 Console&lt;/a&gt; you can see your &lt;code&gt;Terraform Demo&lt;/code&gt; instance up and running:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv88lbpm6px9tlkd2air0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv88lbpm6px9tlkd2air0.png" alt="ec2" width="785" height="186"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Inspecting the State
&lt;/h2&gt;

&lt;p&gt;Terraform's state is stored in a file named terraform.tfstate. You can inspect the current state by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform show

&lt;span class="c"&gt;## Output&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example:&lt;/span&gt;
&lt;span class="c"&gt;# resource "aws_instance" "example" {&lt;/span&gt;
&lt;span class="c"&gt;#     ami                                  = "ami-0e001c9271cf7f3b9"&lt;/span&gt;
&lt;span class="c"&gt;#     arn                                  = "arn:aws:ec2:us-east-1:992382371456:instance/i-099dc08ae004bb7f7"&lt;/span&gt;
&lt;span class="c"&gt;#     associate_public_ip_address          = true&lt;/span&gt;
&lt;span class="c"&gt;#     availability_zone                    = "us-east-1b"&lt;/span&gt;
&lt;span class="c"&gt;#     cpu_core_count                       = 1&lt;/span&gt;
&lt;span class="c"&gt;#     ...&lt;/span&gt;
&lt;span class="c"&gt;#     host_id                              = null&lt;/span&gt;
&lt;span class="c"&gt;#     iam_instance_profile                 = null&lt;/span&gt;
&lt;span class="c"&gt;#     id                                   = "i-099dc08ae004bb7f7"&lt;/span&gt;
&lt;span class="c"&gt;#     instance_initiated_shutdown_behavior = "stop"&lt;/span&gt;
&lt;span class="c"&gt;#     instance_lifecycle                   = null&lt;/span&gt;
&lt;span class="c"&gt;#     instance_state                       = "running"&lt;/span&gt;
&lt;span class="c"&gt;#     instance_type                        = "t2.micro"&lt;/span&gt;
&lt;span class="c"&gt;# ...other information&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command displays all the infrastructure managed by Terraform.&lt;/p&gt;




&lt;h2&gt;
  
  
  Modifying Infrastructure
&lt;/h2&gt;

&lt;p&gt;To make changes to your infrastructure, modify the main.tf file. For example, you can modify the tags associated with the EC2 instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"example"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0e001c9271cf7f3b9"&lt;/span&gt; &lt;span class="c1"&gt;# Ubuntu 22.04&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Updated Terraform Demo"&lt;/span&gt; &lt;span class="c1"&gt;# Update instance tag name&lt;/span&gt;
    &lt;span class="nx"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Development"&lt;/span&gt; &lt;span class="c1"&gt;# Adding new tag&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Initializing Changes
&lt;/h2&gt;

&lt;p&gt;After modifying your configuration, initialize Terraform again to update its state and refresh dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Applying Changes
&lt;/h2&gt;

&lt;p&gt;After initializing, you can apply your changes to update the infrastructure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform apply

&lt;span class="c"&gt;## Sample output&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Refreshing state... [id=i-099dc08ae004bb7f7]&lt;/span&gt;

&lt;span class="c"&gt;# Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:&lt;/span&gt;
&lt;span class="c"&gt;#   ~ update in-place&lt;/span&gt;

&lt;span class="c"&gt;# Terraform will perform the following actions:&lt;/span&gt;
&lt;span class="c"&gt;#   # aws_instance.example will be updated in-place&lt;/span&gt;
&lt;span class="c"&gt;#   ~ resource "aws_instance" "example" {&lt;/span&gt;
&lt;span class="c"&gt;#         id                                   = "i-099dc08ae004bb7f7"&lt;/span&gt;
&lt;span class="c"&gt;#       ~ tags                                 = {&lt;/span&gt;
&lt;span class="c"&gt;#           + "Environment" = "Development"&lt;/span&gt;
&lt;span class="c"&gt;#           ~ "Name"        = "Terraform Demo" -&amp;gt; "Updated Terraform Demo"&lt;/span&gt;
&lt;span class="c"&gt;#         }&lt;/span&gt;
&lt;span class="c"&gt;#       ~ tags_all                             = {&lt;/span&gt;
&lt;span class="c"&gt;#           + "Environment" = "Development"&lt;/span&gt;
&lt;span class="c"&gt;#           ~ "Name"        = "Terraform Demo" -&amp;gt; "Updated Terraform Demo"&lt;/span&gt;
&lt;span class="c"&gt;#         }&lt;/span&gt;
&lt;span class="c"&gt;#         # (38 unchanged attributes hidden)&lt;/span&gt;
&lt;span class="c"&gt;#         # (8 unchanged blocks hidden)&lt;/span&gt;
&lt;span class="c"&gt;#     }&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm by typing &lt;code&gt;yes&lt;/code&gt; when prompted. Terraform will then update the tags for the existing EC2 instance to reflect your changes.&lt;br&gt;
&lt;br&gt;Visit &lt;a href="https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#Instances:instanceState=running" rel="noopener noreferrer"&gt;AWS EC2 Console&lt;/a&gt; you can see your instance name is changed to &lt;code&gt;Updated Terraform Demo&lt;/code&gt;:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8nn5qzg2shxxow5f324i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8nn5qzg2shxxow5f324i.png" alt="ec2-updated" width="796" height="187"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Using Variables and Outputs
&lt;/h2&gt;

&lt;p&gt;Variables in Terraform allow you to parameterize your configurations. They can make your configurations more dynamic and reusable. Here's an example of using variables:&lt;/p&gt;

&lt;p&gt;Create a &lt;code&gt;variables.tf&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"instance_name"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Name of the EC2 instance"&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Variable Terraform Demo"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"environment"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Name of the environment"&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"development"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Modify main.tf to use the variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"example"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0e001c9271cf7f3b9"&lt;/span&gt; &lt;span class="c1"&gt;# Ubuntu 22.04&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t2.micro"&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;instance_name&lt;/span&gt;
    &lt;span class="nx"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;environment&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;instance_name&lt;/code&gt; is a variable that defaults to "Variable Terraform Demo". You can override this value when running terraform apply.&lt;/p&gt;

&lt;p&gt;Outputs in Terraform allow you to extract and display information about your infrastructure. Add an &lt;code&gt;outputs.tf&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"instance_id"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ID of the EC2 instance"&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;output&lt;/span&gt; &lt;span class="s2"&gt;"instance_public_ip"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Public IP address of the EC2 instance"&lt;/span&gt;
  &lt;span class="nx"&gt;value&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;public_ip&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apply your configuration by runnint &lt;code&gt;terraform apply&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform apply
&lt;span class="c"&gt;## Sample output&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Modifying... [id=i-099dc08ae004bb7f7]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Modifications complete after 7s [id=i-099dc08ae004bb7f7]&lt;/span&gt;

&lt;span class="c"&gt;# Apply complete! Resources: 0 added, 1 changed, 0 destroyed.&lt;/span&gt;

&lt;span class="c"&gt;# Outputs:&lt;/span&gt;

&lt;span class="c"&gt;# instance_id = "i-099dc08ae004bb7f7"&lt;/span&gt;
&lt;span class="c"&gt;# instance_public_ip = "44.202.163.210"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can view the output by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Get Instance ID&lt;/span&gt;
terraform output instance_id
&lt;span class="c"&gt;## i-099dc08ae004bb7f7&lt;/span&gt;

&lt;span class="c"&gt;# Get Public IP&lt;/span&gt;
terraform output instance_public_ip
&lt;span class="c"&gt;## "x.x.x.x"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Destroying Infrastructure
&lt;/h2&gt;

&lt;p&gt;To tear down the infrastructure managed by Terraform, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform destroy

&lt;span class="c"&gt;## Output:&lt;/span&gt;
&lt;span class="c"&gt;# ...&lt;/span&gt;
&lt;span class="c"&gt;# Do you really want to destroy all resources?&lt;/span&gt;
&lt;span class="c"&gt;#   Terraform will destroy all your managed infrastructure, as shown above.&lt;/span&gt;
&lt;span class="c"&gt;#   There is no undo. Only 'yes' will be accepted to confirm.&lt;/span&gt;

&lt;span class="c"&gt;#   Enter a value: yes&lt;/span&gt;

&lt;span class="c"&gt;# aws_instance.example: Destroying... [id=i-099dc08ae004bb7f7]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Still destroying... [id=i-099dc08ae004bb7f7, 10s elapsed]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Still destroying... [id=i-099dc08ae004bb7f7, 20s elapsed]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Still destroying... [id=i-099dc08ae004bb7f7, 30s elapsed]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Still destroying... [id=i-099dc08ae004bb7f7, 40s elapsed]&lt;/span&gt;
&lt;span class="c"&gt;# aws_instance.example: Destruction complete after 44s&lt;/span&gt;

&lt;span class="c"&gt;# Destroy complete! Resources: 1 destroyed.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confirm by typing &lt;code&gt;yes&lt;/code&gt; when prompted. Terraform will then proceed to destroy all resources defined in your configuration.&lt;/p&gt;




&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;p&gt;Here are some best practices to follow when working with Terraform:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Version Control: Always keep your Terraform configuration files in version control (e.g., Git).&lt;/li&gt;
&lt;li&gt;Use Remote State: Store your state file remotely to collaborate with others and avoid potential issues with local state files.&lt;/li&gt;
&lt;li&gt;Modularize: Use modules to organize your configuration into reusable components.&lt;/li&gt;
&lt;li&gt;Backup State Files: Regularly back up your state files to prevent data loss.&lt;/li&gt;
&lt;li&gt;Use Variables and Outputs: Use variables to make your configuration flexible and outputs to expose information about your infrastructure.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Common Commands Cheat Sheet
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;terraform init&lt;/code&gt; - Initialize a Terraform configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;terraform plan&lt;/code&gt; - Show changes required by the current configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;terraform apply&lt;/code&gt; - Apply the changes required by the current configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;terraform destroy&lt;/code&gt; - Destroy the Terraform-managed infrastructure&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;terraform fmt&lt;/code&gt; - Reformat your configuration in the standard style&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;terraform validate&lt;/code&gt; - Validate the configuration files in a directory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;terraform state&lt;/code&gt; - Advanced state management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;terraform output&lt;/code&gt; - Show output values from a state file&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Useful Resources
&lt;/h2&gt;

&lt;p&gt;Here are some tools and resources to help you along your Terraform journey:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.hashicorp.com/terraform/docs" rel="noopener noreferrer"&gt;terraform/docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/shuaibiyy/awesome-tf" rel="noopener noreferrer"&gt;Awesome Terraform&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/TheDevOpsHub/TerraformHub" rel="noopener noreferrer"&gt;Terraform Hub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Book: &lt;code&gt;Terraform: Up and Running&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In this post, we introduced the fundamentals of Terraform, covering key concepts like providers, resources, and modules. We demonstrated installing Terraform, creating a basic EC2 instance on AWS, and performing essential operations like initializing, applying, modifying, and destroying infrastructure. Additionally, we highlighted best practices and basic usage of variables and outputs to enhance your Terraform configurations.&lt;br&gt;
&lt;br&gt;I hope this help you for the Terraform journey. Thank you for reading and happy coding! 💖&lt;/p&gt;

</description>
      <category>devops</category>
      <category>terraform</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Introducing the new feature of DevOps Toolkit: Configuration Reusability 🚀</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Tue, 09 Jul 2024 15:11:18 +0000</pubDate>
      <link>https://forem.com/tungbq/introducing-the-new-feature-of-devops-toolkit-configuration-reusability-4mnn</link>
      <guid>https://forem.com/tungbq/introducing-the-new-feature-of-devops-toolkit-configuration-reusability-4mnn</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;In the world of DevOps, managing multiple tools on your computer can be quite a challenge. I know this struggle firsthand. Setting up each tool, ensuring they work together, and keeping them updated is a time-consuming and often frustrating process.&lt;/p&gt;

&lt;p&gt;That's why I created the &lt;a href="https://github.com/tungbq/devops-toolkit" rel="noopener noreferrer"&gt;&lt;strong&gt;DevOps Toolkit&lt;/strong&gt;&lt;/a&gt; to solve these problems. It's built on top of the &lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; platform. I wanted to make it easier for developers and operations teams to get started with DevOps without the headaches of tool compatibility, setup, maintenance, and keeping everything up to date.&lt;br&gt;
You could find my previous post for this tool &lt;a href="https://dev.to/tungbq/introducing-devops-toolkit-32fa"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The DevOps Toolkit 🧰
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub repository:&lt;/strong&gt; &lt;a href="https://github.com/tungbq/devops-toolkit" rel="noopener noreferrer"&gt;tungbq/devops-toolkit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image on Dockerhub&lt;/strong&gt;: &lt;a href="https://hub.docker.com/r/tungbq/devops-toolkit" rel="noopener noreferrer"&gt;tungbq/devops-toolkit:latest&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Description:&lt;/strong&gt; DevOps toolkit is a container image for an all-in-one DevOps environment with popular tools like Ansible, Terraform, kubectl, helm, AWS CLI, Azure CLI, Git, Python, and more...&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Announcing Configuration Reusability
&lt;/h2&gt;

&lt;p&gt;In our latest release, we're excited to introduce a powerful new feature: &lt;strong&gt;Configuration Reusability&lt;/strong&gt;. This feature allows you to mount a configuration folder from the host to the container, enabling the reuse of configurations within the container, such as AWS and Azure login sessions. This enhancement simplifies the workflow, ensuring that you don't have to log in repeatedly and can maintain a consistent environment across multiple runs.&lt;/p&gt;
&lt;h3&gt;
  
  
  Key Updates in This Release 🚀
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Core Updates&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Updated tool versions&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New Features&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Enabled toolkit container configuration reusable&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improvements&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Installed SSH client&lt;/li&gt;
&lt;li&gt;Ansible documentation improvement and minor image name change&lt;/li&gt;
&lt;li&gt;Updated deploy-docker-image-release.yml to replace deprecated set-output&lt;/li&gt;
&lt;li&gt;Updated instructions&lt;/li&gt;
&lt;li&gt;Adjusted note in quick start section&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can checkout all devops-toolkit releases and new features &lt;a href="https://github.com/tungbq/devops-toolkit/releases" rel="noopener noreferrer"&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Quick Start Guide 📖
&lt;/h2&gt;

&lt;p&gt;Before you begin, ensure that you have &lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; installed. It's also helpful to have a basic understanding of Docker concepts. If you are new to Docker, don't worry, you can refer to this &lt;a href="https://github.com/tungbq/devops-basic/tree/main/topics/docker" rel="noopener noreferrer"&gt;&lt;strong&gt;docker document&lt;/strong&gt;&lt;/a&gt; to get started.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1: Pull the Official Image from Docker Hub
&lt;/h3&gt;

&lt;p&gt;DockerHub image: &lt;a href="https://hub.docker.com/r/tungbq/devops-toolkit" rel="noopener noreferrer"&gt;tungbq/devops-toolkit&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker pull tungbq/devops-toolkit:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Start and Explore the Toolkit Container
&lt;/h3&gt;

&lt;p&gt;To start using the toolkit, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.devops-toolkit-config
docker run &lt;span class="nt"&gt;--network&lt;/span&gt; host &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; ~/.devops-toolkit-config:/config tungbq/devops-toolkit:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command mounts your host's &lt;code&gt;.devops-toolkit-config&lt;/code&gt; directory to the container, allowing the reuse of configurations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Work on the Toolkit Container
&lt;/h3&gt;

&lt;p&gt;Once inside the container, you can try login to AWS and/or Azure with aws or az CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@docker-desktop:~# aws configure
root@docker-desktop:~# az login &lt;span class="nt"&gt;--use-device-code&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exit the container and move to the next step&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Verify the Configuration Reusability
&lt;/h3&gt;

&lt;p&gt;Run the new container, you can find your previous configurations without login or configure again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--network&lt;/span&gt; host &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; ~/.devops-toolkit-config:/config tungbq/devops-toolkit:latest
root@docker-desktop:~# aws configure list
root@docker-desktop:~# az account show
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similar feature will happen with other tools like Ansible/Terraform/...&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In summary, the DevOps Toolkit simplifies the complexities of managing multiple DevOps tools and keeping them updated, in this new &lt;strong&gt;Configuration Reusability&lt;/strong&gt; feature it will help us more. If you're interested, give it a try, share your feedback, and let's continue improving together. Happy coding! 💖&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/tungbq/devops-toolkit" rel="noopener noreferrer"&gt;&lt;strong&gt;Star devops-toolkit ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>tooling</category>
      <category>opensource</category>
    </item>
    <item>
      <title>The Azure Hub ☁️ Your Azure learning resources 📚</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Sat, 15 Jun 2024 09:58:47 +0000</pubDate>
      <link>https://forem.com/tungbq/the-azure-hub-your-azure-learning-resources-3b6n</link>
      <guid>https://forem.com/tungbq/the-azure-hub-your-azure-learning-resources-3b6n</guid>
      <description>&lt;h2&gt;
  
  
  Greetings 👋
&lt;/h2&gt;

&lt;p&gt;Hi there! Tung Leo here. Previously, I've published &lt;a href="https://dev.to/tungbq/the-aws-hub-4phb"&gt;&lt;strong&gt;The AWS Hub ☁️ Your new AWS learning resources&lt;/strong&gt;&lt;/a&gt; post to help everyone with the AWS learning repository.&lt;/p&gt;

&lt;p&gt;This time, we'll dive into another cloud provider - the Azure cloud, and I'm excited to introduce you to a new comprehensive repository packed with Azure learning resources and documentation. This is &lt;a href="https://github.com/TheDevOpsHub/AzureHub" rel="noopener noreferrer"&gt;&lt;strong&gt;AzureHub&lt;/strong&gt;&lt;/a&gt; ⭐&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction ☁️
&lt;/h2&gt;

&lt;p&gt;Whether you're a new member of the Azure community or a developer/cloud engineer seeking a centralized document hub for all things Azure, the &lt;a href="https://github.com/TheDevOpsHub/AzureHub" rel="noopener noreferrer"&gt;&lt;strong&gt;AzureHub&lt;/strong&gt;&lt;/a&gt; repository will assist you. Consider this repository as your bookmark for all essential Azure resources, including &lt;strong&gt;Azure Certification&lt;/strong&gt; materials, &lt;strong&gt;documentation for Azure services&lt;/strong&gt;, and &lt;strong&gt;Azure Architecture&lt;/strong&gt; insights. 🔥&lt;/p&gt;

&lt;p&gt;In the following sections, I'll walk you through key content within the &lt;strong&gt;AzureHub&lt;/strong&gt; repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started 🚀
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is Azure? ➡️ &lt;a href="https://youtu.be/oPSHs71mTVU" rel="noopener noreferrer"&gt;&lt;strong&gt;Watch here&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Azure Documentation: 📖 &lt;a href="https://learn.microsoft.com/en-us/azure/?product=popular" rel="noopener noreferrer"&gt;&lt;strong&gt;Explore here&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Azure Portal: &lt;a href="https://portal.azure.com/#home" rel="noopener noreferrer"&gt;&lt;strong&gt;Explore here&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Azure Services Learning Resources 📘
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;This section provides links to detailed documentation, introduction videos, and FAQs for popular Azure services&lt;/li&gt;
&lt;li&gt;For the full Azure services learning resources, visit: &lt;a href="https://github.com/TheDevOpsHub/AzureHub/blob/main/Azure_Services.md" rel="noopener noreferrer"&gt;&lt;strong&gt;Azure_Services.md&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Azure Certification Resources 💯
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Preparing for the AWS Certification Exam? Here are my top personal recommendations for learning resources:&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1. Free Exam Preparation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Certification exam preparation by Azure: &lt;a href="https://learn.microsoft.com/en-us/credentials/browse/?credential_types=certification" rel="noopener noreferrer"&gt;&lt;strong&gt;here&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Study guide: &lt;a href="https://learn.microsoft.com/en-us/credentials/certifications/resources/study-guides/az-104" rel="noopener noreferrer"&gt;Study guide for Exam&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Guides/Cheat Sheets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tutorials Dojo - Azure Cheat Sheets: &lt;a href="https://tutorialsdojo.com/microsoft-azure-cheat-sheets/" rel="noopener noreferrer"&gt;https://tutorialsdojo.com/microsoft-azure-cheat-sheets/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Azure Certifications Sub-Reddit
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.reddit.com/r/AzureCertification/" rel="noopener noreferrer"&gt;&lt;strong&gt;r/AzureCertification&lt;/strong&gt;&lt;/a&gt; brings in your discussions, questions , opinions, news and comments around Azure certifications areas like prep tips, clarifications, lessons learned.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Specific Azure Certification resources
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Certification Name&lt;/th&gt;
&lt;th&gt;Learning path&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Azure 900&lt;/td&gt;
&lt;td&gt;Microsoft Certified: Azure Fundamentals&lt;/td&gt;
&lt;td&gt;📖 &lt;a href="https://github.com/TheDevOpsHub/AzureHub/blob/main/certification/az-900.md" rel="noopener noreferrer"&gt;az-900.md&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Azure 104&lt;/td&gt;
&lt;td&gt;Microsoft Certified: Azure Administrator Associate&lt;/td&gt;
&lt;td&gt;📖 &lt;a href="https://github.com/TheDevOpsHub/AzureHub/blob/main/certification/az-104.md" rel="noopener noreferrer"&gt;az-104.md&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;And more upcoming certification resources ⏩ ...&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure Training 📚
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/training/azure/" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/training/azure/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Azure Architecture Center
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Azure Architecture: 📖 &lt;a href="https://learn.microsoft.com/en-us/azure/architecture/browse/" rel="noopener noreferrer"&gt;&lt;strong&gt;Explore here&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Learn Azure on Youtube ▶️
&lt;/h2&gt;

&lt;p&gt;Some popular Youtube channels to learn Azure&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Microsoft Azure Official: &lt;a href="https://www.youtube.com/@MicrosoftAzure" rel="noopener noreferrer"&gt;https://www.youtube.com/@MicrosoftAzure&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Adam Marczak - Azure for Everyone: &lt;a href="https://www.youtube.com/@AdamMarczakYT" rel="noopener noreferrer"&gt;https://www.youtube.com/@AdamMarczakYT&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;John Savill's Technical Training: &lt;a href="https://www.youtube.com/@NTFAQGuy" rel="noopener noreferrer"&gt;https://www.youtube.com/@NTFAQGuy&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A Guide To Cloud: &lt;a href="https://www.youtube.com/@AGuideToCloud" rel="noopener noreferrer"&gt;https://www.youtube.com/@AGuideToCloud&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Github Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Microsoft Learning: &lt;a href="https://github.com/MicrosoftLearning" rel="noopener noreferrer"&gt;https://github.com/MicrosoftLearning&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;johnthebrit/CertificationMaterials: &lt;a href="https://github.com/johnthebrit/CertificationMaterials" rel="noopener noreferrer"&gt;https://github.com/johnthebrit/CertificationMaterials&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Contributing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;See: &lt;a href="https://github.com/TheDevOpsHub/AzureHub/blob/main/CONTRIBUTING.md" rel="noopener noreferrer"&gt;CONTRIBUTING.md&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;If you find this repository helpful, kindly consider showing your appreciation by giving it a star ⭐ Thanks! 💖&lt;/li&gt;
&lt;li&gt;Looking for the issue to work on? Check the list of our open issues good first issue&lt;/li&gt;
&lt;li&gt;Feel free to open a new issue or let us know if you want to request more content about Azure&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;We will keep updating this repository with the latest resources and changes. If you would like to contribute more useful resources, please open a PR, and we will review it to add to the list. Thanks 💖&lt;/p&gt;

&lt;h2&gt;
  
  
  Feedback 🗣️
&lt;/h2&gt;

&lt;p&gt;Got any feedback, suggestions, or issues with the &lt;strong&gt;AzureHub&lt;/strong&gt; repository? Feel free to reach out to me via &lt;a href="https://github.com/TheDevOpsHub/AzureHub/issues" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub Issues&lt;/strong&gt;&lt;/a&gt; or leave a comment in this blog post 🔗&lt;/p&gt;




&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/TheDevOpsHub/AzureHub" rel="noopener noreferrer"&gt;&lt;strong&gt;Star AzureHub ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Thank you and happy learning! 🎉&lt;/p&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>cloud</category>
      <category>learning</category>
    </item>
    <item>
      <title>Jenkins up and running on Kubernetes 🚀</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Tue, 04 Jun 2024 16:32:02 +0000</pubDate>
      <link>https://forem.com/tungbq/jenkins-on-kubernetes-a-comprehensive-guide-5d6a</link>
      <guid>https://forem.com/tungbq/jenkins-on-kubernetes-a-comprehensive-guide-5d6a</guid>
      <description>&lt;h2&gt;
  
  
  Introduction 👋
&lt;/h2&gt;

&lt;p&gt;In this hands-on, we'll cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploy Jenkins controller on k8s cluster&lt;/li&gt;
&lt;li&gt;Configure k8s cluster as Jenkins agents&lt;/li&gt;
&lt;li&gt;Create and run a sample pipeline on a k8s Pod Jenkins agent&lt;/li&gt;
&lt;li&gt;Watch the Pod life cycle for a pipeline run&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Environment ☁️
&lt;/h2&gt;

&lt;p&gt;This hands-on is for a PoC or Pilot environment, to explore the Jenkins and Kubernetes features&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites 🔓
&lt;/h2&gt;

&lt;p&gt;Before you start, ensure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A running &lt;a href="https://kubernetes.io/docs/setup/" rel="noopener noreferrer"&gt;Kubernetes cluster&lt;/a&gt; (I used &lt;a href="https://kind.sigs.k8s.io/" rel="noopener noreferrer"&gt;kind&lt;/a&gt; for my k8s local environment).&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://kubernetes.io/docs/tasks/tools/" rel="noopener noreferrer"&gt;kubectl&lt;/a&gt; configured to interact with your cluster.&lt;/li&gt;
&lt;li&gt;Basic knowledge of Kubernetes and Jenkins.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Documentation Reference 📖
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/home/" rel="noopener noreferrer"&gt;kubernetes.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.jenkins.io/doc/book/installing/kubernetes/" rel="noopener noreferrer"&gt;Installing Jenkins on Kubernetes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.jenkins.io/doc/" rel="noopener noreferrer"&gt;www.jenkins.io/doc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/tungbq/devops-basics" rel="noopener noreferrer"&gt;devops-basics&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Deploy Jenkins on Kubernetes and run your pipeline 🔥
&lt;/h2&gt;

&lt;p&gt;Let's start deploying and using Jenkins on Kubernetes by following below steps:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Prepare K8s Manifest YAML files
&lt;/h3&gt;

&lt;p&gt;Before start, we need to prepare the K8s YAML files.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;NOTE&lt;/em&gt;: All the YAML files to deploy Jenkins controller on Kubernetes are available at: &lt;a href="https://github.com/tungbq/K8sHub" rel="noopener noreferrer"&gt;K8sHub&lt;/a&gt; (&lt;strong&gt;hands-on/jenkins-on-k8s/yamls&lt;/strong&gt;). If you want to use the hands-on example and all-in-one script from my repo (desrible later in the next section), you do not need to create these files manually, just refer them as captured version of the ones in hands-on repository. Otherwise, create these files in your PC with following content and name:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/K8sHub/blob/main/hands-on/jenkins-on-k8s/yamls/volume.yaml" rel="noopener noreferrer"&gt;volume.yaml&lt;/a&gt;: To create the persitent volumne for our Jenkins instance on k8s (Replace the &lt;code&gt;demo-jenkins-cluster-control-plane&lt;/code&gt; by your node name)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="c1"&gt;## volume.yaml&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;StorageClass&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;storage.k8s.io/v1&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local-storage&lt;/span&gt;
  &lt;span class="na"&gt;provisioner&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kubernetes.io/no-provisioner&lt;/span&gt;
  &lt;span class="na"&gt;volumeBindingMode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;WaitForFirstConsumer&lt;/span&gt;
  &lt;span class="s"&gt;---&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PersistentVolume&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-pv-volume&lt;/span&gt;
    &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local&lt;/span&gt;
  &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;storageClassName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local-storage&lt;/span&gt;
    &lt;span class="na"&gt;claimRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-pv-claim&lt;/span&gt;
      &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;devops-tools&lt;/span&gt;
    &lt;span class="na"&gt;capacity&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;10Gi&lt;/span&gt;
    &lt;span class="na"&gt;accessModes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ReadWriteOnce&lt;/span&gt;
    &lt;span class="na"&gt;local&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;## Replace by your desired path&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/mnt/jenkins&lt;/span&gt;
    &lt;span class="na"&gt;nodeAffinity&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;nodeSelectorTerms&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;matchExpressions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kubernetes.io/hostname&lt;/span&gt;
                &lt;span class="na"&gt;operator&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;In&lt;/span&gt;
                &lt;span class="c1"&gt;## Replace by your node name&lt;/span&gt;
                &lt;span class="na"&gt;values&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;demo-jenkins-cluster-control-plane&lt;/span&gt;
  &lt;span class="s"&gt;---&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PersistentVolumeClaim&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-pv-claim&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;devops-tools&lt;/span&gt;
  &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;storageClassName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local-storage&lt;/span&gt;
    &lt;span class="na"&gt;accessModes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ReadWriteOnce&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;3Gi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/K8sHub/blob/main/hands-on/jenkins-on-k8s/yamls/sevice_account.yaml" rel="noopener noreferrer"&gt;service_account.yaml&lt;/a&gt;: To create &lt;code&gt;jenkins-admin&lt;/code&gt; service account for the &lt;code&gt;Deployment&lt;/code&gt; usage
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="c1"&gt;## service_account.yaml&lt;/span&gt;
  &lt;span class="s"&gt;---&lt;/span&gt;
  &lt;span class="s"&gt;apiVersion&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
  &lt;span class="s"&gt;kind&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterRole&lt;/span&gt;
  &lt;span class="s"&gt;metadata&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-admin&lt;/span&gt;
  &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*'&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*'&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="s"&gt;---&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ServiceAccount&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-admin&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;devops-tools&lt;/span&gt;
  &lt;span class="s"&gt;---&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterRoleBinding&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-admin&lt;/span&gt;
  &lt;span class="na"&gt;roleRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;apiGroup&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterRole&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-admin&lt;/span&gt;
  &lt;span class="na"&gt;subjects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ServiceAccount&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-admin&lt;/span&gt;
      &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;devops-tools&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/K8sHub/blob/main/hands-on/jenkins-on-k8s/yamls/deployment.yaml" rel="noopener noreferrer"&gt;deployment.yaml&lt;/a&gt;: To deploy latest &lt;code&gt;jenkins/jenkins:lts&lt;/code&gt; Jenkins version with &lt;code&gt;jenkins-admin&lt;/code&gt; service account and us &lt;code&gt;jenkins-pv-claim&lt;/code&gt; persistent volume
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="c1"&gt;## deployment.yaml&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps/v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;devops-tools&lt;/span&gt;
  &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
    &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-server&lt;/span&gt;
    &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-server&lt;/span&gt;
      &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;securityContext&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;fsGroup&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt;
          &lt;span class="na"&gt;runAsUser&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt;
        &lt;span class="na"&gt;serviceAccountName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-admin&lt;/span&gt;
        &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins&lt;/span&gt;
            &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins/jenkins:lts&lt;/span&gt;
            &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;limits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2Gi'&lt;/span&gt;
                &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;1000m'&lt;/span&gt;
              &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;500Mi'&lt;/span&gt;
                &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;500m'&lt;/span&gt;
            &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;httpport&lt;/span&gt;
                &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8080&lt;/span&gt;
              &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jnlpport&lt;/span&gt;
                &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50000&lt;/span&gt;
            &lt;span class="na"&gt;livenessProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/login'&lt;/span&gt;
                &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8080&lt;/span&gt;
              &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;90&lt;/span&gt;
              &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
              &lt;span class="na"&gt;timeoutSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
              &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
            &lt;span class="na"&gt;readinessProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/login'&lt;/span&gt;
                &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8080&lt;/span&gt;
              &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60&lt;/span&gt;
              &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
              &lt;span class="na"&gt;timeoutSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
              &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;
            &lt;span class="na"&gt;volumeMounts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-data&lt;/span&gt;
                &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/var/jenkins_home&lt;/span&gt;
        &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-data&lt;/span&gt;
            &lt;span class="na"&gt;persistentVolumeClaim&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;claimName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-pv-claim&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/tungbq/K8sHub/blob/main/hands-on/jenkins-on-k8s/yamls/services.yaml" rel="noopener noreferrer"&gt;services.yaml&lt;/a&gt;: To expose the &lt;code&gt;jenkins-server&lt;/code&gt; as a k8s service
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="c1"&gt;## services.yaml&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Service&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-service&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;devops-tools&lt;/span&gt;
    &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;prometheus.io/scrape&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;true'&lt;/span&gt;
      &lt;span class="na"&gt;prometheus.io/path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt;
      &lt;span class="na"&gt;prometheus.io/port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;8080'&lt;/span&gt;
  &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jenkins-server&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;httpport&lt;/span&gt;
        &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8080&lt;/span&gt;
        &lt;span class="na"&gt;targetPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8080&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jnlpport&lt;/span&gt;
        &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50000&lt;/span&gt;
        &lt;span class="na"&gt;targetPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Deploy Jenkins Controller
&lt;/h3&gt;

&lt;p&gt;You can deploy it manually or using my all-in-one deploy script, choose one of the following options:&lt;/p&gt;

&lt;h4&gt;
  
  
  Option 1. Deploy Jenkins with prepare scipt
&lt;/h4&gt;

&lt;p&gt;Clone the repo contains the hands-on example. Then, run the deployment script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Checkout the source code for this hands-on&lt;/span&gt;
git clone https://github.com/tungbq/K8sHub.git
&lt;span class="nb"&gt;cd &lt;/span&gt;K8sHub/hands-on/jenkins-on-k8s

&lt;span class="c"&gt;## NOTE: In `hands-on/jenkins-on-k8s/yamls/deployment.yaml` replace the `demo-jenkins-cluster-control-plane` value by your node name&lt;/span&gt;

&lt;span class="c"&gt;## Create new `devops-tools` namespace&lt;/span&gt;
kubectl create namespace devops-tools

&lt;span class="c"&gt;## Now run the deploy script&lt;/span&gt;
./deploy.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Option 2. Deploy Jenkins manually
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Ensure you created 4 k8s manifest YAML files as describle in previous section&lt;/span&gt;
kubectl create namespace devops-tools
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; sevice_account.yaml
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; volume.yaml
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; deployment.yaml
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; services.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Access Jenkins Controller
&lt;/h3&gt;

&lt;h4&gt;
  
  
  3.1. Port-Forwarding
&lt;/h4&gt;

&lt;p&gt;Open a new terminal and set up port forwarding to access Jenkins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Replace 8087 with an available port on your PC&lt;/span&gt;
kubectl port-forward service/jenkins-service &lt;span class="nt"&gt;-n&lt;/span&gt; devops-tools 8087:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3.2. Get Initial Password
&lt;/h4&gt;

&lt;p&gt;Jenkins requires an initial admin password for first-time access. Retrieve it with the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Get the Jenkins pod name&lt;/span&gt;
kubectl get pods &lt;span class="nt"&gt;--namespace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;devops-tools

&lt;span class="c"&gt;## Retrieve the initialAdminPassword&lt;/span&gt;
kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; &amp;lt;pod_name&amp;gt; &lt;span class="nb"&gt;cat&lt;/span&gt; /var/jenkins_home/secrets/initialAdminPassword &lt;span class="nt"&gt;-n&lt;/span&gt; devops-tools
&lt;span class="c"&gt;## Sample output: d72493ce44fb48bc8833da94b40cdd68&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3.3. Access Jenkins
&lt;/h4&gt;

&lt;p&gt;Open your browser and navigate to &lt;a href="http://localhost:8087" rel="noopener noreferrer"&gt;http://localhost:8087&lt;/a&gt;. Log in using the initial password obtained earlier, install the suggested plugins, and create an admin user.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fntelv71nrnt3a3vzmm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fntelv71nrnt3a3vzmm.png" alt="login-ok" width="800" height="257"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  4. Configure Jenkins Agents on Kubernetes
&lt;/h3&gt;

&lt;p&gt;With Jenkins up and running, the next step is to configure Kubernetes as Jenkins agents.&lt;/p&gt;
&lt;h4&gt;
  
  
  4.1. Install Kubernetes Plugin
&lt;/h4&gt;

&lt;p&gt;Navigate to Dashboard &amp;gt; Manage Jenkins &amp;gt; Plugins (&lt;a href="http://localhost:8087/manage/pluginManager/available" rel="noopener noreferrer"&gt;http://localhost:8087/manage/pluginManager/available&lt;/a&gt;), search for the "Kubernetes" plugin, and install it. Restart Jenkins after installation.&lt;/p&gt;
&lt;h4&gt;
  
  
  4.2. Configure the Kubernetes Plugin
&lt;/h4&gt;

&lt;p&gt;Navigate to Dashboard &amp;gt; Manage Jenkins &amp;gt; Clouds (&lt;a href="http://localhost:8087/manage/cloud/" rel="noopener noreferrer"&gt;http://localhost:8087/manage/cloud/&lt;/a&gt;). Select "New cloud" and input the cloud name (e.g., k8s-agents), then select "Create."&lt;/p&gt;

&lt;p&gt;Configure the following fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kubernetes URL: Leave empty&lt;/li&gt;
&lt;li&gt;Kubernetes server certificate key: Leave empty&lt;/li&gt;
&lt;li&gt;Kubernetes Namespace: devops-tools&lt;/li&gt;
&lt;li&gt;Credentials: Leave as None&lt;/li&gt;
&lt;li&gt;Jenkins URL: &lt;a href="http://jenkins-service.devops-tools.svc.cluster.local:8080" rel="noopener noreferrer"&gt;http://jenkins-service.devops-tools.svc.cluster.local:8080&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Select "Test connection" to verify the connection. If you see &lt;code&gt;Connected to Kubernetes vX.Y.Z&lt;/code&gt;, the configuration is successful.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F53e49j11j3qrwo2smxv3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F53e49j11j3qrwo2smxv3.png" alt="k8s-agent-ok" width="800" height="214"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  5. Run a Sample Job on a Kubernetes Pod
&lt;/h3&gt;

&lt;p&gt;Now that the Jenkins controller and k8s agents are configured, let's run a sample job on a Pod.&lt;/p&gt;
&lt;h4&gt;
  
  
  5.1. Create a New Pipeline
&lt;/h4&gt;

&lt;p&gt;Go to the Jenkins homepage, select "New item," choose "Pipeline," input a name (e.g., Demo-Run-Shell-Inside-K8s-Pod), and create.&lt;/p&gt;
&lt;h4&gt;
  
  
  5.2. Define the Pipeline Script
&lt;/h4&gt;

&lt;p&gt;In the pipeline configuration section, input the following script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;podTemplate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;containers:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;
    &lt;span class="n"&gt;containerTemplate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;name:&lt;/span&gt; &lt;span class="s1"&gt;'jnlp'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;image:&lt;/span&gt; &lt;span class="s1"&gt;'jenkins/inbound-agent:latest'&lt;/span&gt;
        &lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="o"&gt;])&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;POD_LABEL&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Shell'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;container&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'jnlp'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Shell Execution'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'''
                    echo "Hello! Running from shell"
                    '''&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  5.3. Build the Pipeline
&lt;/h4&gt;

&lt;p&gt;Select "Build Now" to trigger the pipeline.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n4bw9zgucd0a6wd5w9j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n4bw9zgucd0a6wd5w9j.png" alt="start-a-run" width="800" height="227"&gt;&lt;/a&gt;&lt;br&gt;
Jenkins will create a new Pod based on your template and run the pipeline inside the Pod.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbjt6wwgh6gkosy9lbdd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbjt6wwgh6gkosy9lbdd.png" alt="result-demo" width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  5.4. Monitor Pod Lifecycle
&lt;/h4&gt;

&lt;p&gt;To see the Pods created and terminated with each build, use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Check pods in devops-tools namespace&lt;/span&gt;
kubectl get pods &lt;span class="nt"&gt;-n&lt;/span&gt; devops-tools &lt;span class="nt"&gt;-w&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbavv69kykjm7yxlqx32j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbavv69kykjm7yxlqx32j.png" alt="pod-stats" width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Cleanup
&lt;/h2&gt;

&lt;p&gt;To clean up your environment, delete the namespace along with its resources:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;## Terminate the namespace&lt;/span&gt;
kubectl delete namespace devops-tools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, run the cleanup script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;hands-on/jenkins-on-k8s
./cleanup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Troubleshooting 🔨
&lt;/h2&gt;

&lt;p&gt;Common Issues and Solutions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Persistent volume binding issues: Delete the PV with &lt;code&gt;kubectl delete pv jenkins-pv-volume&lt;/code&gt; and redeploy.&lt;/li&gt;
&lt;li&gt;Connection issues to the Jenkins service: Verify the service port and check the agent pod logs using &lt;code&gt;kubectl logs -f &amp;lt;your_pod_name&amp;gt; -n devops-tools&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Losing connection to Jenkins page: Re-run &lt;code&gt;kubectl port-forward service/jenkins-service -n devops-tools 8087:8080&lt;/code&gt; and ensure the Jenkins pod is running.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion ✒️
&lt;/h2&gt;

&lt;p&gt;By following this guide, you should have a functional Jenkins setup on Kubernetes, allowing you to run pipelines within k8s Pods. Experiment with custom pipelines and explore more advanced Jenkins features on Kubernetes. Happy DevOps-ing!&lt;/p&gt;




&lt;p&gt;I'm building the &lt;strong&gt;K8sHub&lt;/strong&gt; to help everyone learn and practice Kubernetes from the basics to pratical hands-on, If you're interested in this project please cónider giving it a star ⭐️. Any star you can give me will help me grow it even more ❤️ Thank you!&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/tungbq/K8sHub" rel="noopener noreferrer"&gt;&lt;strong&gt;Star K8sHub repo ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>devops</category>
      <category>jenkins</category>
      <category>kubernetes</category>
      <category>cicd</category>
    </item>
    <item>
      <title>GitHub: Create your own repository landscape ⭐️</title>
      <dc:creator>Tung Leo</dc:creator>
      <pubDate>Sun, 28 Apr 2024 03:20:25 +0000</pubDate>
      <link>https://forem.com/tungbq/github-create-your-own-repository-landscape-16i5</link>
      <guid>https://forem.com/tungbq/github-create-your-own-repository-landscape-16i5</guid>
      <description>&lt;h2&gt;
  
  
  Overview 👋
&lt;/h2&gt;

&lt;p&gt;Do you want to create a &lt;strong&gt;central repository&lt;/strong&gt; to showcase all your highlighted repositories with descriptions and stars? Something like this:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9kbmjym239nt09fwb3s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9kbmjym239nt09fwb3s.png" alt="example.3.repo" width="800" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've created the repository landscape template &lt;a href="https://github.com/tungbq/repos" rel="noopener noreferrer"&gt;&lt;strong&gt;tungbq/repos&lt;/strong&gt;&lt;/a&gt; that can help you build your own repository landscape.&lt;br&gt;
This blog post will describe the features and guide you on how to use this repository template to create your own repository landscape.&lt;/p&gt;
&lt;h2&gt;
  
  
  Key Features 🚀
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/tungbq/repos" rel="noopener noreferrer"&gt;&lt;strong&gt;tungbq/repos&lt;/strong&gt;&lt;/a&gt; repository template provides some features that help you create your repo landscape content automatically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supports defining the list of repositories to be shown in the landscape, file &lt;code&gt;repository_list.txt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Automated script to generate content from the &lt;code&gt;repository_list.txt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A GitHub Action CI pipeline to generate new repository landscape content:

&lt;ul&gt;
&lt;li&gt;Triggers the automated generation script.&lt;/li&gt;
&lt;li&gt;Creates a pull request to propose the new content.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The repository landscape format provides:

&lt;ul&gt;
&lt;li&gt;Indexing with repo name title&lt;/li&gt;
&lt;li&gt;Repo URL&lt;/li&gt;
&lt;li&gt;Repo description (archived via GitHub API call)&lt;/li&gt;
&lt;li&gt;A GitHub stars badge (leverage this tool &lt;a href="https://shields.io/" rel="noopener noreferrer"&gt;https://shields.io/&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Quick start 📖
&lt;/h2&gt;

&lt;p&gt;This is optional; you can skip this section and jump into &lt;code&gt;Configure and use the template 📘&lt;/code&gt; to create your own repo.&lt;br&gt;
If you want to generate the content locally, update the &lt;code&gt;repository_list.txt&lt;/code&gt; and run this script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/tungbq/repos.git
&lt;span class="nb"&gt;cd &lt;/span&gt;repos
./generate_content.sh repository_list.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result will be similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;➜  repos git:&lt;span class="o"&gt;(&lt;/span&gt;main&lt;span class="o"&gt;)&lt;/span&gt; ✗ ./generate_content.sh repository_list.txt
Working on repo: tungbq/devops-basics, with index: 1
Working on repo: tungbq/AWSHub, with index: 2
Working on repo: tungbq/devops-toolkit, with index: 3
Working on repo: tungbq/devops-project, with index: 4
Working on repo: tungbq/aws-lab-with-terraform, with index: 5
Working on repo: tungbq/awesome-workflow, with index: 6
Working on repo: tungbq/k8sHub, with index: 7
Working on repo: tungbq/Azure-DevOps-Pipeline, with index: 8
Working on repo: tungbq/find-github-issue, with index: 9
Working on repo: tungbq/challenges, with index: 10
Working on repo: tungbq/devops-dockerfiles, with index: 11
Working on repo: tungbq/terraform-sample-project, with index: 12
Working on repo: tungbq/repos, with index: 13
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now check the README.md and you would find your repository landscape content&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure and use the template 📘
&lt;/h2&gt;

&lt;p&gt;Below are the steps to help you create and configure your own landscape repository.&lt;br&gt;
In short we only need to do 4 major steps: &lt;code&gt;Create new repo from template&lt;/code&gt; &amp;gt; &lt;code&gt;Set up GITHUB_TOKEN&lt;/code&gt; &amp;gt; &lt;code&gt;Update repository list&lt;/code&gt; &amp;gt; &lt;code&gt;Merge the automated PR&lt;/code&gt;.&lt;br&gt;
Let's dive into the detailed as below:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create a new repo from the template
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Visit the template repository: &lt;a href="https://github.com/tungbq/repos" rel="noopener noreferrer"&gt;https://github.com/tungbq/repos&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;In the top right corner, select &lt;code&gt;Use this template&lt;/code&gt; &amp;gt; &lt;code&gt;Create a new repository&lt;/code&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxvltdloahxlvw6fx2p0s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxvltdloahxlvw6fx2p0s.png" alt="create-repo-from-template" width="202" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input your repository name to create and add a description if needed, then select &lt;code&gt;Create repository&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fushehprf508wiat9n502.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fushehprf508wiat9n502.png" alt="create-repo" width="800" height="690"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wait for a few seconds, and your repository will be created.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Configure &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; for the new repo
&lt;/h3&gt;

&lt;p&gt;There is a CI workflow to automatically generate content and open a new Pull Request for your repository landscape, so setting up &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; permission is required.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Goto: &lt;a href="https://github.com/YOUR_USERNAME/YOUR_REPO/settings/actions" rel="noopener noreferrer"&gt;https://github.com/YOUR_USERNAME/YOUR_REPO/settings/actions&lt;/a&gt; (Repo &amp;gt; Setting &amp;gt; Action &amp;gt; General), in the &lt;code&gt;Workflow permission&lt;/code&gt; section, enable following options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read and write permissions&lt;/li&gt;
&lt;li&gt;Allow GitHub Actions to create and approve pull requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2l5eevzxc8890eolnwz5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2l5eevzxc8890eolnwz5.png" alt="gh-token-in-repo" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we are ready to trigger the CI workflow to update the repo landscape.&lt;br&gt;
Now we are ready to trigger the CI workflow to update the repo landscape.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Update your repository list
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add your repository list to the file &lt;code&gt;repository_list.txt&lt;/code&gt; in your repository and merge it into the &lt;code&gt;main&lt;/code&gt; branch, for example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tungbq/devops-basics
tungbq/AWSHub
tungbq/devops-toolkit
tungbq/devops-project
tungbq/aws-lab-with-terraform
tungbq/awesome-workflow
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Trigger the CI pipeline
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Automatically trigger on merge event to main
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Once the &lt;code&gt;repository_list.txt&lt;/code&gt; is merged into the &lt;code&gt;main&lt;/code&gt; branch, the CI pipeline Update content will be triggered automatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq5jvymv4965b7c1mslw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq5jvymv4965b7c1mslw.png" alt="ci-main-trigger" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The CI pipeline will read the repository list and generate your new &lt;code&gt;README.md&lt;/code&gt; content.&lt;/li&gt;
&lt;li&gt;Then, it will check and create a Pull Request to propose the new repository landscape content.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvarhjxe4yc5exor5qcgn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvarhjxe4yc5exor5qcgn.png" alt="pr-automated" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Manual trigger (Optional)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;You can also trigger that CI at any moment you want.&lt;/li&gt;
&lt;li&gt;Go to Actions and select Update content.&lt;/li&gt;
&lt;li&gt;Select "Run workflow" to trigger the CI:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbxpxbkdcchoamdof2au.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbxpxbkdcchoamdof2au.png" alt="action-run" width="800" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Review and merge the PR
&lt;/h3&gt;

&lt;p&gt;Once the PR is raised automatically, you just need to review and merge, and that's it! You will have your own landscape content in README.md.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8bf1k65aiw5ee6o5cxcq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8bf1k65aiw5ee6o5cxcq.png" alt="pr-merge" width="800" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations 🎉, you've successfully created your own repo landscape! Now check the &lt;code&gt;README.md&lt;/code&gt; for the final result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advance CI configuration (Optional)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In the previous section, we triggered the CI pipeline to run on a merge event to &lt;code&gt;main&lt;/code&gt; branch or manual event. You could improve that by changing the trigger event to run on a timer basis. For example, once a week or once a month. This would help us regularly check and update the landscape, keeping it up to date.&lt;/li&gt;
&lt;li&gt;To do so, add your desired cron trigger to &lt;code&gt;repos/.github/workflows/generate_content.yaml&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;6'&lt;/span&gt; &lt;span class="c1"&gt;# Run every Saturday at midnight&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# other events as needed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check &lt;a href="https://crontab.guru/" rel="noopener noreferrer"&gt;https://crontab.guru/&lt;/a&gt; for the CRON syntax&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you find this repository template helpful, feel free to use it, kindly consider showing your appreciation by giving it a star ⭐️. Any star you can give me will help me grow it even more ❤️&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="https://github.com/tungbq/repos" rel="noopener noreferrer"&gt;&lt;strong&gt;Star repos ⭐️ on GitHub&lt;/strong&gt;&lt;/a&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Thank you and happy coding! 🔥&lt;/p&gt;

</description>
      <category>github</category>
      <category>opensource</category>
      <category>githubactions</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
