<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kartik Pawar on Medium]]></title>
        <description><![CDATA[Stories by Kartik Pawar on Medium]]></description>
        <link>https://medium.com/@kartikpawar1290?source=rss-8cb7655bf625------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WOi9vHUNNgXkRiKgiTPqdg.jpeg</url>
            <title>Stories by Kartik Pawar on Medium</title>
            <link>https://medium.com/@kartikpawar1290?source=rss-8cb7655bf625------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:59:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kartikpawar1290/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[WordPress Deployment on AWS EC2 with Amazon RDS (MySQL)]]></title>
            <link>https://medium.com/@kartikpawar1290/wordpress-deployment-on-aws-ec2-with-amazon-rds-mysql-020f99a955bb?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/020f99a955bb</guid>
            <category><![CDATA[aws-rds]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 05:26:19 GMT</pubDate>
            <atom:updated>2026-09-14T05:35:14.262Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A complete step-by-step guide to deploying WordPress on Amazon EC2 with a managed Amazon RDS MySQL database</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8SHk4mNu6veca4nkR7dpw.png" /></figure><p>Deploying WordPress on AWS is a great hands-on project for understanding how cloud compute, managed databases, networking, security groups, Linux, Apache, PHP, and application deployment work together.</p><p>In this project, WordPress is hosted on an <strong>Amazon EC2 instance</strong>, while the WordPress database is hosted separately on <strong>Amazon RDS for MySQL</strong>.</p><p>The final architecture is:</p><p><strong>Users → Internet → EC2 (Apache + PHP + WordPress) → Amazon RDS MySQL</strong></p><h3>🏗️ Architecture</h3><pre>                    Internet<br>                       │<br>                       ▼<br>                ┌─────────────┐<br>                │   Amazon    │<br>                │     EC2     │<br>                │             │<br>                │ Apache      │<br>                │ PHP         │<br>                │ WordPress   │<br>                └──────┬──────┘<br>                       │<br>                  MySQL : 3306<br>                       │<br>                       ▼<br>                ┌─────────────┐<br>                │   Amazon    │<br>                │     RDS     │<br>                │    MySQL    │<br>                │             │<br>                │  wordpress  │<br>                └─────────────┘</pre><p>The application and database are separated into two AWS services. EC2 handles the web application, while RDS manages the MySQL database.</p><h3>📋 Prerequisites</h3><p>Before starting, make sure you have:</p><ul><li>An AWS account</li><li>An Amazon EC2 instance</li><li>Amazon Linux 2023</li><li>An Amazon RDS MySQL instance</li><li>Properly configured security groups</li><li>SSH access to EC2</li><li>Internet connectivity</li><li>PuTTY/PuTTYgen if connecting from Windows</li></ul><h3>🚀 Step 1: Create Amazon RDS MySQL Database</h3><p>Start by creating the managed MySQL database that will be used by WordPress.</p><h3>1. Open AWS Console</h3><p>Log in to the AWS Management Console and navigate to:</p><p><strong>RDS → Databases</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JYf4E8BKeXK4oNgO" /></figure><h3>2. Click Create Database</h3><p>Click <strong>Create Database</strong> to start configuring the RDS instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I99u4tNLIMPQrSbl" /></figure><h3>3. Configure MySQL</h3><p>Use the following configuration:</p><p>SettingValueEngineMySQLTemplateFree TierDB Instance Identifierwordpress-dbMaster UsernameadminMaster Password&lt;Your Password&gt;</p><p>For networking:</p><ul><li>Select the <strong>same VPC</strong> used by the EC2 instance.</li><li>Set <strong>Public Access</strong> to <strong>No</strong>.</li><li>Configure the appropriate RDS security group.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Dbb2uq-9hEa01WBz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/0*9-DO8cgMNTjI33Kf" /></figure><p>Finally, click <strong>Create Database</strong>.</p><blockquote><em>🔐 </em><strong><em>Security tip:</em></strong><em> Keep the RDS database private whenever possible. WordPress should communicate with RDS through the VPC rather than exposing MySQL directly to the internet.</em></blockquote><h3>🔐 Step 2: Launch EC2 and Configure Security Groups</h3><p>The EC2 instance will host Apache, PHP, and WordPress.</p><p>During EC2 creation, create a new security group or select an existing one.</p><p>The EC2 security group should allow:</p><p>TypePortSSH22HTTP80HTTPS443</p><p>Record the <strong>EC2 Security Group ID</strong>, because it will be required when configuring the RDS security group.</p><h3>Configure RDS Security Group</h3><p>After the EC2 instance has been created, edit the RDS security group.</p><p>Add an inbound rule:</p><p>TypeProtocolPortSourceMySQL/AuroraTCP3306EC2 Security Group</p><p>For example:</p><pre>Source: sg-xxxxxxxx</pre><p>This allows MySQL traffic from the EC2 instance instead of allowing port 3306 from the entire internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NLhDYg6759p4DA2b" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sTml8ArrK35-y0Lp" /></figure><h3>💻 Step 3: Connect to EC2 Using PuTTY</h3><p>If you’re using Windows, PuTTY can be used to connect to the EC2 instance through SSH.</p><h3>Install PuTTY</h3><p>Download PuTTY and PuTTYgen from the official PuTTY website.</p><p><a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html?utm_source=chatgpt.com">PuTTY Official Website</a></p><h3>Convert .pem to .ppk</h3><p>If you have an AWS .pem key:</p><ol><li>Open <strong>PuTTYgen</strong>.</li><li>Click <strong>Load</strong>.</li><li>Select your .pem file.</li><li>Click <strong>Save private key</strong>.</li><li>Save the resulting .ppk file.</li></ol><h3>Configure PuTTY</h3><p>Open PuTTY and enter the EC2 public IP address.</p><p>Navigate to:</p><p><strong>Connection → SSH → Auth</strong></p><p>Under <strong>Private key file for authentication</strong>, select your .ppk file.</p><p>Click <strong>Open</strong>.</p><p>Accept the host key if prompted and log in as:</p><pre>ec2-user</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/0*B_zP_KmRGv7kiVIg" /></figure><p>You should now have access to your Amazon Linux EC2 terminal.</p><h3>🔗 Step 4: Verify EC2-to-RDS Connectivity</h3><p>Before installing WordPress, verify that EC2 can communicate with RDS over MySQL port 3306.</p><p>Run:</p><pre>timeout 5 bash -c &quot;&lt;/dev/tcp/&lt;RDS-ENDPOINT&gt;/3306&quot; &amp;&amp; echo OK || echo FAIL</pre><p>If connectivity is configured correctly, you should see:</p><pre>OK</pre><p>If you receive:</p><pre>FAIL</pre><p>check:</p><ul><li>RDS security group</li><li>EC2 security group</li><li>RDS endpoint</li><li>VPC configuration</li><li>Port 3306</li></ul><h3>🐬 Step 5: Install the MySQL Client</h3><p>Install the MariaDB/MySQL client on Amazon Linux:</p><pre>sudo dnf install mariadb105 -y</pre><p>After installation, connect to the RDS database:</p><pre>mysql -h &lt;RDS-ENDPOINT&gt; -u admin -p</pre><p>Enter the RDS master password when prompted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6AF8yRc-RpEzp5Zr" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gEhO6TCeXbKDZYhY" /></figure><h3>🗄️ Step 6: Create the WordPress Database</h3><p>Once connected to MySQL, create a dedicated WordPress database and user.</p><pre>CREATE DATABASE wordpress;</pre><pre>CREATE USER &#39;wpuser&#39;@&#39;%&#39; IDENTIFIED BY &#39;Password@123&#39;;</pre><pre>GRANT ALL PRIVILEGES ON wordpress.* TO &#39;wpuser&#39;@&#39;%&#39;;</pre><pre>FLUSH PRIVILEGES;</pre><p>Verify that the database exists:</p><pre>SHOW DATABASES;</pre><p>You should see:</p><pre>wordpress</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AwtulG7XoGcA5NHb" /></figure><blockquote><em>🔐 </em><strong><em>Security note:</em></strong><em> The password shown above is an example. Use a strong, unique password in an actual deployment and never publish real credentials in your documentation.</em></blockquote><h3>⚙️ Step 7: Install WordPress on EC2</h3><p>Now we can install Apache, PHP, and WordPress.</p><p>Create an installation script:</p><pre>nano wordpress.sh</pre><p>Add:</p><pre>#!/bin/bash<br>dnf update -y<br>dnf install -y httpd wget tar php php-cli php-fpm php-mysqlnd php-json php-gd php-mbstring php-xml php-curl php-zip<br>systemctl enable httpd<br>systemctl start httpd<br>cd /tmp<br>wget https://wordpress.org/latest.tar.gz<br>tar -xzf latest.tar.gz<br>cp -r wordpress/* /var/www/html/<br>chown -R apache:apache /var/www/html<br>find /var/www/html -type d -exec chmod 755 {} \;<br>find /var/www/html -type f -exec chmod 644 {} \;<br>mkdir -p /var/www/html/wp-content/uploads<br>chown -R apache:apache /var/www/html/wp-content<br>rm -rf /tmp/wordpress<br>rm -f /tmp/latest.tar.gz<br>systemctl restart httpd</pre><p>Make the script executable:</p><pre>chmod +x wordpress.sh</pre><p>Run it:</p><pre>sudo ./wordpress.sh</pre><p>The script installs:</p><ul><li>Apache HTTP Server</li><li>PHP</li><li>PHP-FPM</li><li>MySQL PHP extension</li><li>Required PHP extensions</li><li>WordPress</li><li>Required permissions</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3LEZD4c-yHpwcPuB" /></figure><h3>🌐 Step 8: Open the WordPress Setup Page</h3><p>Once Apache and WordPress are installed, open your browser and enter:</p><pre>http://&lt;EC2-PUBLIC-IP&gt;</pre><p>The WordPress installation wizard should appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m1uDtRhQ7s6gvKtH" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/0*wPGMpr5hps2RfMDX" /></figure><h3>🔧 Step 9: Configure the Database Connection</h3><p>WordPress now needs the connection details for the RDS MySQL database.</p><p>Enter:</p><pre>Database Name: wordpress<br>Username: wpuser<br>Password: &lt;Your Password&gt;<br>Database Host: &lt;RDS-ENDPOINT&gt;<br>Table Prefix: wp_</pre><p>Click <strong>Submit</strong>.</p><p>WordPress will attempt to connect to the RDS database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WQPP48d246AQef93" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rN_cEQT1doBuATq4" /></figure><h3>📝 Step 10: Configure the WordPress Website</h3><p>Enter the website information.</p><p>Example:</p><pre>Site Title: Kartik WordPress Site<br>Username: kartikadmin<br>Password: ********<br>Email: your-email@example.com</pre><p>Click:</p><p><strong>Install WordPress</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/0*xtRqAYFqrxElKy72" /></figure><p>After the installation finishes, WordPress will create the required application tables in the RDS MySQL database.</p><h3>🔑 Step 11: Login to WordPress</h3><p>Open:</p><pre>http://&lt;EC2-PUBLIC-IP&gt;/wp-admin</pre><p>Enter the administrator username and password created during installation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/0*DDufrICUDQuOmAIk" /></figure><h3>🎛️ Step 12: Access the WordPress Dashboard</h3><p>After successful authentication, you will be redirected to the WordPress dashboard.</p><p>From here, you can:</p><ul><li>Create posts</li><li>Create pages</li><li>Install themes</li><li>Install plugins</li><li>Configure website settings</li><li>Manage users</li><li>Customize the website</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BXOQxhwFukso6m6Y" /></figure><p>At this point, the WordPress application is running successfully on EC2 and using Amazon RDS MySQL as its database.</p><h3>🔍 Step 13: Verify WordPress Database Tables</h3><p>You can verify that WordPress is successfully storing its data in RDS.</p><p>Connect directly to the WordPress database:</p><pre>mysql -h &lt;RDS-ENDPOINT&gt; -u wpuser -p wordpress</pre><p>Then run:</p><pre>SHOW TABLES;</pre><p>You should see tables such as:</p><pre>wp_users<br>wp_posts<br>wp_options<br>wp_comments<br>...</pre><p>This confirms that WordPress is communicating with the Amazon RDS MySQL database.</p><h3>🛠️ Troubleshooting</h3><h3>Error: Cannot Select Database</h3><h3>Possible Cause</h3><p>The database name entered in WordPress is incorrect.</p><h3>Solution</h3><p>Make sure the database name is:</p><pre>wordpress</pre><h3>Error: Error Establishing Database Connection</h3><p>Check the following:</p><ul><li>RDS endpoint</li><li>Database username</li><li>Database password</li><li>Database name</li><li>RDS security group</li><li>EC2 security group</li><li>Port 3306</li><li>EC2-to-RDS connectivity</li></ul><p>Test the connection again:</p><pre>timeout 5 bash -c &quot;&lt;/dev/tcp/&lt;RDS-ENDPOINT&gt;/3306&quot; &amp;&amp; echo OK || echo FAIL</pre><p>If the result is:</p><pre>OK</pre><p>network connectivity to port 3306 is working.</p><h3>🎯 Final Result</h3><p>The WordPress application has now been successfully deployed using:</p><pre>Internet<br>                       │<br>                       ▼<br>              ┌────────────────┐<br>              │   Amazon EC2    │<br>              │                 │<br>              │ Apache + PHP    │<br>              │   WordPress     │<br>              └───────┬────────┘<br>                      │<br>                 MySQL : 3306<br>                      │<br>                      ▼<br>              ┌────────────────┐<br>              │   Amazon RDS    │<br>              │      MySQL      │<br>              │   wordpress DB  │<br>              └────────────────┘</pre><h3>Services Used</h3><ul><li>☁️ Amazon EC2</li><li>🗄️ Amazon RDS MySQL</li><li>🌐 Apache HTTP Server</li><li>🐘 PHP</li><li>📝 WordPress</li><li>🔐 AWS Security Groups</li><li>💻 Linux / Amazon Linux 2023</li></ul><h3>Key Benefits</h3><p><strong>1. Separation of Application and Database</strong></p><p>The WordPress application and database are hosted separately.</p><p><strong>2. Managed Database</strong></p><p>Amazon RDS handles the database infrastructure instead of requiring you to manually manage a MySQL server.</p><p><strong>3. Improved Network Security</strong></p><p>The RDS security group can restrict MySQL access to the EC2 security group.</p><p><strong>4. Practical AWS Experience</strong></p><p>This project provides hands-on experience with EC2, RDS, VPC networking, security groups, Linux, Apache, PHP, MySQL, and WordPress.</p><h3>💡 What I Learned</h3><p>This project helped me understand how a real cloud-hosted application can be structured using AWS services.</p><p>The most important part was understanding the communication flow:</p><pre>User<br> ↓<br>EC2 Public IP<br> ↓<br>Apache<br> ↓<br>PHP<br> ↓<br>WordPress<br> ↓<br>RDS MySQL : 3306</pre><p>It also demonstrated why database security groups should allow access from the application server rather than exposing MySQL directly to the internet.</p><h3>🚀 Conclusion</h3><p>Deploying WordPress on AWS EC2 with Amazon RDS is a simple but powerful project for anyone learning <strong>AWS, Linux, Cloud, and DevOps</strong>.</p><p>Starting with an RDS MySQL database, we configured networking and security groups, launched an EC2 instance, connected through SSH, installed Apache and PHP, deployed WordPress, connected it to RDS, and finally accessed the WordPress dashboard.</p><p>The final result is a working WordPress application with the <strong>application layer on EC2</strong> and the <strong>database layer on Amazon RDS</strong>.</p><p>If you’re learning AWS or preparing for a Cloud/DevOps role, this is a great project to build and document because it brings multiple AWS and Linux concepts together in one implementation.</p><h3>👨‍💻 Author</h3><p><strong>Kartik Pawar</strong></p><p>Cloud &amp; DevOps | AWS | Linux | Docker | Kubernetes</p><h3>Tags</h3><p>AWS Amazon EC2 Amazon RDS MySQL WordPress Linux Apache PHP Cloud Computing DevOps AWS Projects</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=020f99a955bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing and Configuring Cockpit on RHEL 9.8]]></title>
            <link>https://medium.com/@kartikpawar1290/installing-and-configuring-cockpit-on-rhel-9-8-d6fe83c0440e?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6fe83c0440e</guid>
            <category><![CDATA[linux-administration]]></category>
            <category><![CDATA[server-management]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[red-hat-enterprise-linux]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 05:24:21 GMT</pubDate>
            <atom:updated>2026-08-14T05:24:21.606Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZZYSjbM2YAqTB1N-Hr5hw.png" /></figure><h3>A Simple Guide to Web-Based Linux Server Administration</h3><p>Managing Linux servers usually means working directly from the terminal. While the command line is powerful, having a web-based administration interface can make common system management tasks much easier.</p><p><strong>Cockpit</strong> provides a browser-based interface for managing and monitoring Linux servers. In this guide, I will walk through the installation and basic configuration of Cockpit on <strong>Red Hat Enterprise Linux (RHEL) 9.8</strong>.</p><p>By the end of this guide, Cockpit will be installed, enabled, accessible through port <strong>9090</strong>, and ready to use from a web browser.</p><h3>What is Cockpit?</h3><p>Cockpit is a web-based administration interface for Linux systems. It provides a graphical way to view and manage system information and administration tasks.</p><p>For Linux administrators, it can be useful for quickly checking system health and accessing server-management features without relying entirely on terminal commands.</p><h3>Step 1: Check Whether Cockpit Is Already Installed</h3><p>Before installing Cockpit, verify whether it is already available on the server.</p><p>Run:</p><pre>rpm -q cockpit</pre><p>If Cockpit is installed, the command returns the installed package version.</p><p>Example:</p><pre>cockpit-311.1-1.el9.x86_64</pre><h3>Screenshot</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*YrCwCnea1xzo-L2equHdlA.png" /></figure><h3>Step 2: Install Cockpit</h3><p>If Cockpit is not already installed, install it using DNF:</p><pre>sudo dnf install cockpit -y</pre><p>The -y option automatically confirms the installation prompts.</p><h3>Step 3: Start and Enable Cockpit</h3><p>After installation, start the Cockpit socket:</p><pre>sudo systemctl start cockpit.socket</pre><p>To make sure Cockpit starts automatically after a reboot, enable the socket:</p><pre>sudo systemctl enable cockpit.socket</pre><p>This ensures the Cockpit service is available automatically when the system starts.</p><h3>Step 4: Verify the Cockpit Service</h3><p>Check the current status of the Cockpit socket:</p><pre>sudo systemctl status cockpit.socket</pre><p>The service should show that it is active and listening for connections.</p><p>This is an important verification step because it confirms that Cockpit has been started successfully.</p><h3>Screenshot</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2jOfg8i44NJ6mHeedulWkQ.png" /></figure><h3>Step 5: Verify Port 9090</h3><p>Cockpit normally listens on <strong>TCP port 9090</strong>.</p><p>Check whether the port is listening:</p><pre>sudo ss -tulpn | grep 9090</pre><p>Expected output:</p><pre>LISTEN 0 4096 *:9090</pre><p>If port 9090 is listening, the Cockpit web service is ready to accept browser connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KvzhG0AazI1Gae3_XePVaA.png" /></figure><h3>Step 6: Configure the Firewall</h3><p>If firewalld is running, Cockpit traffic needs to be allowed through the firewall.</p><p>Add the Cockpit service permanently:</p><pre>sudo firewall-cmd --permanent --add-service=cockpit</pre><p>Reload the firewall configuration:</p><pre>sudo firewall-cmd --reload</pre><p>Then verify the configured services:</p><pre>sudo firewall-cmd --list-services</pre><p>The output should include:</p><pre>cockpit</pre><p>This confirms that the Cockpit service has been allowed through the firewall.</p><h3>Step 7: Check SELinux Status</h3><p>RHEL uses SELinux as an additional security layer.</p><p>Check the current SELinux mode:</p><pre>getenforce</pre><p>The documentation shows the expected result as:</p><pre>Enforcing</pre><p>Keeping SELinux enabled and enforcing is an important part of maintaining the security posture of a RHEL server.</p><h3>Step 8: Access Cockpit From a Browser</h3><p>Once the service and firewall are configured, open a web browser and navigate to:</p><pre>https://&lt;server-ip&gt;:9090</pre><p>For example:</p><pre>https://192.168.x.x:9090</pre><p>Replace &lt;server-ip&gt; with the IP address of your RHEL server.</p><h3>Step 9: Log In to Cockpit</h3><p>Cockpit uses your Linux system account for authentication.</p><p>Enter your Linux username and password:</p><pre>Username: &lt;linux-user&gt;<br>Password: &lt;user-password&gt;</pre><p>After successful authentication, the Cockpit dashboard will be displayed.</p><h3>Screenshot</h3><p><strong>[Insert Screenshot 3 here — Cockpit web dashboard]</strong></p><p>The dashboard provides a graphical view of the server and its available management options.</p><h3>Step 10: Handle the HTTPS Certificate Warning</h3><p>When accessing Cockpit for the first time, your browser may display a certificate warning.</p><p>This happens because Cockpit uses a <strong>self-signed SSL certificate by default</strong>.</p><p>In the browser:</p><ol><li>Click <strong>Advanced</strong></li><li>Click <strong>Proceed to the site</strong></li></ol><p>After proceeding, the Cockpit login interface becomes available.</p><h3>Cockpit Dashboard</h3><p>After logging in, you can access the Cockpit web interface and view the server’s management dashboard.</p><p>The screenshot below shows the Cockpit interface running on the RHEL server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zqH2d78rzFnwOuwwZwK5EQ.png" /></figure><p>The dashboard provides an overview of the system and navigation to administration sections such as system information, logs, storage, networking, services, terminal access, and other server-management features.</p><h3>Complete Command Summary</h3><p>For quick reference, here are the main commands used in this setup:</p><pre># Check Cockpit installation<br>rpm -q cockpit</pre><pre># Install Cockpit<br>sudo dnf install cockpit -y</pre><pre># Start Cockpit<br>sudo systemctl start cockpit.socket</pre><pre># Enable Cockpit at boot<br>sudo systemctl enable cockpit.socket</pre><pre># Check Cockpit service<br>sudo systemctl status cockpit.socket</pre><pre># Check port 9090<br>sudo ss -tulpn | grep 9090</pre><pre># Allow Cockpit through the firewall<br>sudo firewall-cmd --permanent --add-service=cockpit</pre><pre># Reload firewall<br>sudo firewall-cmd --reload</pre><pre># Verify firewall services<br>sudo firewall-cmd --list-services</pre><pre># Check SELinux<br>getenforce</pre><h3>Final Result</h3><p>After completing these steps, Cockpit is installed and configured on the RHEL 9.8 server.</p><p>The basic setup includes:</p><ul><li>Cockpit installed using DNF</li><li>Cockpit socket started</li><li>Cockpit enabled at boot</li><li>Port 9090 verified</li><li>Firewall configured for Cockpit</li><li>SELinux status verified</li><li>Cockpit accessed through HTTPS</li><li>Linux credentials used for authentication</li></ul><h3>Conclusion</h3><p>Cockpit provides a convenient web-based approach to Linux server administration.</p><p>For administrators working with RHEL environments, it can be a useful addition alongside traditional command-line tools. The installation itself is straightforward, and once port 9090 and the firewall are configured, the server can be accessed through a browser.</p><p>This setup also provides a good starting point for exploring Cockpit’s system-management interface and understanding how web-based administration can complement traditional Linux administration.</p><h3>Useful Commands at a Glance</h3><pre>rpm -q cockpit<br>sudo dnf install cockpit -y<br>sudo systemctl start cockpit.socket<br>sudo systemctl enable cockpit.socket<br>sudo systemctl status cockpit.socket<br>sudo ss -tulpn | grep 9090<br>sudo firewall-cmd --permanent --add-service=cockpit<br>sudo firewall-cmd --reload<br>sudo firewall-cmd --list-services<br>getenforce</pre><h3>Tags</h3><p>Linux, RHEL, Red Hat, Cockpit, Linux Administration, System Administration, DevOps, Cloud, Server Management, Linux Server</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6fe83c0440e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install and Configure Nagios Core 4.5.13 on RHEL 9]]></title>
            <link>https://medium.com/@kartikpawar1290/install-and-configure-nagios-core-4-5-13-on-rhel-9-d2d6cbfc93a1?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2d6cbfc93a1</guid>
            <category><![CDATA[nagios-core]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[rhel-9]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[apache-spark]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Tue, 11 Aug 2026 13:21:03 GMT</pubDate>
            <atom:updated>2026-08-11T13:21:03.769Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XCOpebh8WXw9tVDHqAa1-w.png" /></figure><h3>🚀 How to Install and Configure Nagios Core 4.5.13 on RHEL 9</h3><h3>A Complete Hands-On Guide to Linux Server, Service, Network Monitoring and Alerting</h3><p>Monitoring is one of the most important parts of managing IT infrastructure.</p><p>As the number of servers, applications, databases, network devices, virtual machines, and services increases, manually checking whether everything is working becomes almost impossible.</p><p>This is where infrastructure monitoring tools such as <strong>Nagios</strong> become useful.</p><p>In this hands-on guide, I’ll walk through the installation and configuration of <strong>Nagios Core 4.5.13 on Red Hat Enterprise Linux 9.8</strong>, including Nagios Plugins 2.5, Apache, PHP, firewall configuration, SELinux considerations, service management, configuration validation, and the Nagios web interface.</p><p>The goal is to build a practical monitoring server that can continuously check infrastructure health and provide alerts when something goes wrong.</p><h3>📌 What is Nagios?</h3><p>Nagios is an open-source infrastructure monitoring solution used by system administrators, DevOps engineers, and IT operations teams.</p><p>It continuously monitors:</p><ul><li>Linux servers</li><li>Windows servers</li><li>Applications</li><li>Services</li><li>Databases</li><li>Network devices</li><li>Routers</li><li>Switches</li><li>Firewalls</li><li>Storage systems</li><li>Virtual machines</li><li>Cloud infrastructure</li></ul><p>When a monitored resource changes state, Nagios can generate notifications according to the configured contact and notification policies.</p><p>Nagios Core is the free and open-source monitoring engine behind the Nagios platform.</p><h3>🤔 Why Use Nagios?</h3><p>Modern IT environments contain many interconnected systems. Checking each system manually is inefficient and can result in issues being discovered too late.</p><p>Nagios automates this process by periodically executing health checks.</p><p>Some important benefits include:</p><ul><li>Continuous infrastructure monitoring</li><li>Immediate alert notifications</li><li>Reduced downtime</li><li>Centralized monitoring dashboard</li><li>Historical performance reporting</li><li>Plugin-based architecture</li><li>Highly customizable monitoring</li><li>Open-source and free</li><li>Support for large environments</li></ul><h3>⭐ Nagios Features</h3><p>Nagios provides several monitoring capabilities:</p><ul><li>Host monitoring</li><li>Service monitoring</li><li>Network monitoring</li><li>Application monitoring</li><li>Email notifications</li><li>SMS notifications</li><li>Event handlers</li><li>Performance data collection</li><li>Web-based dashboard</li><li>Plugin architecture</li><li>Scalability</li><li>Distributed monitoring</li></ul><h3>🌎 Common Nagios Use Cases</h3><p>Nagios can be used to monitor:</p><ul><li>Linux Servers</li><li>Windows Servers</li><li>VMware</li><li>Hyper-V</li><li>Docker</li><li>Kubernetes</li><li>AWS Instances</li><li>Azure Virtual Machines</li><li>Routers</li><li>Switches</li><li>Firewalls</li><li>Printers</li><li>Databases</li><li>Web Servers</li><li>DNS Servers</li><li>Mail Servers</li><li>Storage Devices</li><li>Ceph Clusters</li></ul><h3>⚙️ How Nagios Core Works</h3><p>Nagios Core is responsible for scheduling and processing host and service checks.</p><p>It executes plugins at configured intervals and processes their results.</p><p>For example:</p><pre>Nagios Core<br>     |<br>     | Executes<br>     ▼<br>Nagios Plugin<br>     |<br>     | Checks<br>     ▼<br>Host / Service<br>     |<br>     ▼<br>Plugin Result<br>     |<br>     ▼<br>Nagios Core<br>     |<br>     ▼<br>Dashboard / Notification</pre><p>When a service changes from OK to CRITICAL, Nagios can generate a notification.</p><h3>🏗️ Nagios Architecture</h3><p>Nagios follows a modular architecture.</p><pre>                     +---------------------+<br>                     |   Administrator     |<br>                     +----------+----------+<br>                                |<br>                                |<br>                       Web Browser (HTTP)<br>                                |<br>                                |<br>                    +-----------+-----------+<br>                    |        Apache         |<br>                    +-----------+-----------+<br>                                |<br>                                |<br>                      Nagios CGI Interface<br>                                |<br>                                |<br>                   +------------+------------+<br>                   |      Nagios Core        |<br>                   +------------+------------+<br>                                |<br>        ----------------------------------------------------<br>        |            |            |             |           |<br>     Plugins       NRPE         SNMP        SSH Checks   Event Handler<br>        |            |            |             |<br>        |            |            |             |<br>   Linux Host   Remote Linux   Routers      Applications<br>                              Switches<br>                              Firewalls</pre><p>The monitoring workflow is:</p><pre>Scheduler<br>    ↓<br>Plugin Execution<br>    ↓<br>Plugin Result<br>    ↓<br>Status Processing<br>    ↓<br>Notifications<br>    ↓<br>Dashboard Update</pre><p>The complete workflow is essentially:</p><ol><li>Nagios schedules a check.</li><li>The appropriate plugin executes.</li><li>The plugin checks the resource.</li><li>The plugin returns a status.</li><li>Nagios stores the result.</li><li>The dashboard is updated.</li><li>A notification is generated when required.</li></ol><h3>🧩 Main Nagios Components</h3><h3>1. Nagios Core</h3><p>The monitoring engine responsible for:</p><ul><li>Scheduling checks</li><li>Executing plugins</li><li>Processing results</li><li>Generating alerts</li><li>Handling events</li><li>Maintaining monitoring state</li></ul><h3>2. Nagios Plugins</h3><p>Plugins perform the actual monitoring.</p><p>Examples:</p><pre>check_ping<br>check_http<br>check_disk<br>check_load<br>check_users<br>check_tcp<br>check_dns<br>check_ssh<br>check_swap<br>check_procs<br>check_snmp</pre><h3>3. Web Interface</h3><p>The web interface provides:</p><ul><li>Dashboard</li><li>Host status</li><li>Service status</li><li>Reports</li><li>Logs</li><li>Configuration information</li></ul><h3>4. NRPE</h3><p>NRPE allows Nagios to execute plugins on remote Linux systems.</p><pre>Nagios Server<br>      |<br>      | NRPE<br>      |<br>Remote Linux Server</pre><h3>5. SNMP</h3><p>SNMP can be used for monitoring devices such as:</p><ul><li>Routers</li><li>Switches</li><li>Firewalls</li><li>Storage devices</li><li>UPS</li><li>Printers</li></ul><h3>6. Apache</h3><p>Apache provides the Nagios web interface.</p><p>The interface can be accessed using:</p><pre>http://server-ip/nagios</pre><h3>🧪 Lab Architecture</h3><p>The lab environment used in this documentation is:</p><pre>                Administrator PC<br>                    Windows 11<br>                         |<br>                         |<br>                  192.168.199.x<br>                         |<br>               -------------------<br>               |                 |<br>         Nagios Server      Future Linux Hosts<br>          RHEL 9.8<br>       192.168.199.128</pre><h3>🌐 Network Requirements</h3><h3>🐧 Step 1 — Prepare RHEL 9.8</h3><p>First, verify the operating system:</p><pre>cat /etc/redhat-release</pre><p>Expected:</p><pre>Red Hat Enterprise Linux release 9.8 (Plow)</pre><p>Check the kernel:</p><pre>uname -r</pre><p>Check architecture:</p><pre>uname -m</pre><p>Expected:</p><pre>x86_64</pre><p>Update the system:</p><pre>sudo dnf update -y</pre><p>If required, reboot:</p><pre>sudo reboot</pre><h3>🔐 Step 2 — Register the RHEL System</h3><p>If the RHEL system is not registered, register it with Red Hat Subscription Management.</p><p>Check status:</p><pre>subscription-manager status</pre><p>Register:</p><pre>subscription-manager register</pre><p>Attach the subscription automatically:</p><pre>subscription-manager attach --auto</pre><p>Enable BaseOS:</p><pre>subscription-manager repos \<br>--enable=rhel-9-for-x86_64-baseos-rpms</pre><p>Enable AppStream:</p><pre>subscription-manager repos \<br>--enable=rhel-9-for-x86_64-appstream-rpms</pre><p>Enable CodeReady Builder:</p><pre>subscription-manager repos \<br>--enable=codeready-builder-for-rhel-9-x86_64-rpms</pre><p>Verify:</p><pre>dnf repolist</pre><h3>📦 Step 3 — Install Dependencies</h3><p>Nagios Core is distributed as source code, so we need development tools and libraries before compiling it.</p><p>Install the required packages:</p><pre>sudo dnf install -y \<br>gcc \<br>gcc-c++ \<br>glibc \<br>glibc-common \<br>glibc-devel \<br>make \<br>gettext \<br>automake \<br>autoconf \<br>wget \<br>curl \<br>unzip \<br>tar \<br>git \<br>which \<br>passwd \<br>httpd \<br>httpd-tools \<br>php \<br>php-cli \<br>php-gd \<br>gd \<br>gd-devel \<br>libpng \<br>libpng-devel \<br>libjpeg-turbo \<br>libjpeg-turbo-devel \<br>openssl \<br>openssl-devel \<br>perl \<br>net-snmp \<br>net-snmp-utils \<br>net-snmp-perl \<br>policycoreutils-python-utils</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*Y1TLXyAQ4zow_nciwqhV-Q.png" /></figure><p>Verify the important components:</p><pre>gcc --version<br>make --version<br>httpd -v<br>php -v<br>openssl version<br>snmpwalk --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*4A177s_vfjxusTiABlOGyw.png" /></figure><p>Verify important development libraries:</p><pre>rpm -q \<br>gd-devel \<br>libpng-devel \<br>libjpeg-turbo-devel \<br>openssl-devel</pre><h3>📚 What These Packages Do</h3><p>The following packages are required for installing, compiling, configuring, and running Nagios on RHEL.</p><p><strong>gcc</strong><br> GNU C compiler used to compile Nagios source code.</p><p><strong>gcc-c++</strong><br> GNU C++ compiler required for compiling C++ components.</p><p><strong>glibc</strong><br> GNU C Library that provides essential system libraries required by applications.</p><p><strong>make</strong><br> Build automation tool used to compile and build Nagios from source code.</p><p><strong>autoconf</strong><br> Generates configuration scripts required for building software from source.</p><p><strong>automake</strong><br> Generates Makefiles and other build-related configuration files.</p><p><strong>wget</strong><br> Command-line utility used to download files and source packages from the internet.</p><p><strong>curl</strong><br> Command-line tool used to transfer data over HTTP/HTTPS and test web services.</p><p><strong>git</strong><br> Distributed version-control system used to download and manage source code.</p><p><strong>tar</strong><br> Utility used to create and extract archive files such as .tar.gz packages.</p><p><strong>httpd</strong><br> Apache HTTP Server used to host the Nagios web interface.</p><p><strong>httpd-tools</strong><br> Provides Apache utilities such as htpasswd, which is used to create authentication credentials for the Nagios web interface.</p><p><strong>php</strong><br> Provides PHP support required by the Nagios web interface.</p><p><strong>php-gd</strong><br> Provides PHP support for graphics and image processing.</p><p><strong>gd-devel</strong><br> Development libraries required for compiling graphics-related components.</p><p><strong>OpenSSL</strong><br> Provides SSL/TLS functionality for secure and encrypted communication.</p><p><strong>Perl</strong><br> Scripting language required by some Nagios plugins and monitoring utilities.</p><p><strong>net-snmp</strong><br> Provides SNMP support for monitoring network devices and systems.</p><p><strong>net-snmp-utils</strong><br> Provides SNMP command-line utilities such as snmpwalk, snmpget, and snmpstatus.</p><p><strong>net-snmp-perl</strong><br> Provides Perl support for SNMP-based monitoring and plugins.</p><p><strong>policycoreutils-python-utils</strong><br> Provides SELinux administration utilities such as semanage.</p><h3>🔧 Package Categories</h3><p><strong>Build &amp; Compilation:</strong><br> gcc, gcc-c++, glibc, make, autoconf, automake</p><p><strong>Download &amp; Source Management:</strong><br> wget, curl, git, tar</p><p><strong>Web Interface:</strong><br> httpd, httpd-tools, php, php-gd</p><p><strong>Security:</strong><br> OpenSSL, policycoreutils-python-utils</p><p><strong>Scripting &amp; Plugins:</strong><br> Perl</p><p><strong>Network Monitoring:</strong><br> net-snmp, net-snmp-utils, net-snmp-perl</p><p><strong>Graphics Libraries:</strong><br> gd-devel</p><h3>👤 Step 4 — Create Nagios User and Groups</h3><p>Nagios should not run as root.</p><p>Create a dedicated user:</p><pre>sudo useradd nagios</pre><p>Verify:</p><pre>id nagios</pre><p>Create the command group:</p><pre>sudo groupadd nagcmd</pre><p>Add Nagios to the group:</p><pre>sudo usermod -aG nagcmd nagios</pre><p>Add Apache to the same group:</p><pre>sudo usermod -aG nagcmd apache</pre><p>Verify:</p><pre>groups nagios</pre><p>And:</p><pre>groups apache</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*BwJYNQE9xHijfLAHOguavA.png" /></figure><p>This follows the principle of least privilege and allows Apache to interact with the Nagios command interface without running Nagios itself as root.</p><h3>📥 Step 5 — Download Nagios Core 4.5.13</h3><p>Move to the source directory:</p><pre>cd /usr/src</pre><p>Download Nagios Core:</p><pre>wget -O nagios.tar.gz \<br>https://github.com/NagiosEnterprises/nagioscore/archive/refs/tags/nagios-4.5.13.tar.gz</pre><p>Verify:</p><pre>ls -lh nagios.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*ac83RIbeR5778Cjv-6HJrA.png" /></figure><p>Check the file type:</p><pre>file nagios.tar.gz</pre><p>Expected:</p><pre>gzip compressed data</pre><p>Optionally calculate the SHA256 checksum:</p><pre>sha256sum nagios.tar.gz</pre><h3>📂 Step 6 — Extract Nagios Core</h3><p>Extract the archive:</p><pre>tar -xzf nagios.tar.gz</pre><p>List the directory:</p><pre>ls</pre><p>You should see:</p><pre>nagioscore-nagios-4.5.13</pre><p>Enter it:</p><pre>cd nagioscore-nagios-4.5.13</pre><p>Verify:</p><pre>pwd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NR1rJhrZ_gEpIO420vna7Q.png" /></figure><p>Expected:</p><pre>/usr/src/nagioscore-nagios-4.5.13</pre><h3>🔎 Understanding the Nagios Source Tree</h3><p>The source directory contains components such as:</p><pre>base/<br>cgi/<br>common/<br>contrib/<br>docs/<br>html/<br>include/<br>lib/<br>module/<br>sample-config/<br>startup/<br>worker/<br>configure<br>Makefile.in<br>README</pre><p>Important directories include:</p><h3>base/</h3><p>Contains the Nagios monitoring engine responsible for scheduling and processing checks.</p><h3>cgi/</h3><p>Contains programs used by the web interface.</p><h3>html/</h3><p>Contains web interface resources such as HTML, CSS, JavaScript, and images.</p><h3>include/</h3><p>Contains header files.</p><h3>lib/</h3><p>Contains libraries used by Nagios.</p><h3>module/</h3><p>Contains event broker modules.</p><h3>startup/</h3><p>Contains startup and systemd-related files.</p><h3>sample-config/</h3><p>Contains sample configuration files.</p><h3>worker/</h3><p>Contains worker-related components used for check execution.</p><h3>⚙️ Step 7 — Configure Nagios</h3><p>Run the configure script:</p><pre>./configure \<br>--with-command-group=nagcmd</pre><p>The configure process checks:</p><ul><li>Compiler</li><li>Libraries</li><li>Header files</li><li>Operating system</li><li>SSL</li><li>Apache</li><li>GD</li><li>Systemd</li><li>Socket support</li><li>Shared libraries</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*X459n6IVKy8SV_3Q_jP4tw.png" /></figure><p>If successful, you should see a configuration summary similar to:</p><pre>*** Configuration summary for Nagios ***</pre><p>Verify generated files:</p><pre>ls</pre><p>You should have:</p><pre>Makefile<br>config.status<br>config.log</pre><h3>🛠️ Troubleshooting Configure</h3><h3>C compiler error</h3><p>If you see:</p><pre>C compiler cannot create executables</pre><p>Install GCC:</p><pre>sudo dnf install gcc</pre><h3>GD library missing</h3><pre>sudo dnf install gd-devel</pre><h3>OpenSSL headers missing</h3><pre>sudo dnf install openssl-devel</pre><p>Before continuing, make sure configure completes without fatal errors.</p><h3>🔨 Step 8 — Compile Nagios Core</h3><p>Verify the current directory:</p><pre>pwd</pre><p>Verify the Makefile:</p><pre>ls Makefile</pre><p>Start compilation:</p><pre>make all</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dl7AG25PnPbB78Nr18d3sw.png" /></figure><p>The basic compilation process is:</p><pre>Source Code<br>     ↓<br>configure<br>     ↓<br>Makefile<br>     ↓<br>make all<br>     ↓<br>GCC<br>     ↓<br>Object Files<br>     ↓<br>Executable Files</pre><p>You can test the build with:</p><pre>make test</pre><p>If the compilation completes successfully, the Nagios executable should exist.</p><p>Verify:</p><pre>ls base/nagios</pre><p>Check its type:</p><pre>file base/nagios</pre><p>Expected:</p><pre>ELF 64-bit executable</pre><h3>📦 Step 9 — Install Nagios Core</h3><p>Install the main program:</p><pre>make install</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*HlXO8YhAgtRVIvCaV19hWw.png" /></figure><p>Nagios will be installed under:</p><pre>/usr/local/nagios</pre><p>Install the systemd service:</p><pre>make install-init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*hohYazxJfmXOaa-f23a-og.png" /></figure><p>Verify:</p><pre>ls /lib/systemd/system/nagios.service</pre><p>Install the configuration files:</p><pre>make install-config</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ratp-c18oFTCdYxxatpdJA.png" /></figure><p>Install command mode:</p><pre>make install-commandmode</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*iU4hsrw6nknVitDcGk4p_Q.png" /></figure><p>Install Apache configuration:</p><pre>make install-webconf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*WoAz4ZOVtUytASxDqwnlAw.png" /></figure><p>The complete installation sequence is:</p><pre>make install<br>        ↓<br>make install-init<br>        ↓<br>make install-config<br>        ↓<br>make install-commandmode<br>        ↓<br>make install-webconf</pre><h3>📁 Nagios Installation Directory</h3><p>After installation:</p><pre>/usr/local/nagios<br>│<br>├── bin/<br>├── etc/<br>├── include/<br>├── libexec/<br>├── sbin/<br>├── share/<br>└── var/</pre><h3>📁 Nagios Directory Structure</h3><p>After installation, Nagios uses the following directories:</p><p><strong>bin/</strong><br> Contains the main Nagios executable and related binaries.</p><p><strong>etc/</strong><br> Contains Nagios configuration files, including host, service, and command configurations.</p><p><strong>include/</strong><br> Contains header files required by Nagios components and plugins.</p><p><strong>libexec/</strong><br> Contains Nagios monitoring plugins used to check hosts, services, and system resources.</p><p><strong>sbin/</strong><br> Contains CGI programs responsible for providing dynamic functionality in the Nagios web interface.</p><p><strong>share/</strong><br> Contains web interface files such as HTML, CSS, JavaScript, and images.</p><p><strong>var/</strong><br> Contains Nagios runtime information, log files, status data, and other temporary files.</p><p>Verify the Nagios version:</p><pre>/usr/local/nagios/bin/nagios -V</pre><p>Expected:</p><pre>Nagios Core 4.5.13</pre><h3>🧩 Step 10 — Install Nagios Plugins 2.5</h3><p>Nagios Core is only the monitoring engine.</p><p>The actual checks are performed by <strong>Nagios Plugins</strong>.</p><p>Download the plugin source:</p><pre>cd /usr/src</pre><pre>wget -O plugins.tar.gz \<br>https://github.com/nagios-plugins/nagios-plugins/releases/download/release-2.5/nagios-plugins-2.5.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YyC7ogezN74ywOvOw43LLw.png" /></figure><p>Verify:</p><pre>ls -lh plugins.tar.gz</pre><p>Check:</p><pre>file plugins.tar.gz</pre><p>Extract:</p><pre>tar -xzf plugins.tar.gz</pre><p>Enter the directory:</p><pre>cd nagios-plugins-2.5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*2Lo9s-nUEaGHXq2qZ1BnqQ.png" /></figure><h3>⚙️ Step 11 — Configure Nagios Plugins</h3><p>Run:</p><pre>./configure \<br>--with-nagios-user=nagios \<br>--with-nagios-group=nagios</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*a7TxBpqzFYOPOoE3gJk83Q.png" /></figure><p>For Nagios Plugins 2.5, older instructions may mention:</p><pre>./tools/setup</pre><p>That step is obsolete for this version.</p><p>Compile:</p><pre>make</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*ovueeUvymR6_grzQEuVvnw.png" /></figure><p>Install:</p><pre>make install</pre><p>Plugins are installed under:</p><pre>/usr/local/nagios/libexec</pre><p>Verify:</p><pre>ls /usr/local/nagios/libexec</pre><p>Examples include:</p><pre>check_ping<br>check_http<br>check_disk<br>check_load<br>check_swap<br>check_users<br>check_snmp<br>check_tcp<br>check_ssh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*HGaolQBE0jpz3XyP9hs3sw.png" /></figure><h3>🔍 How Nagios Plugins Work</h3><p>A plugin returns one of four standard status codes:</p><h3>🚦 Nagios Plugin Exit Codes</h3><p>Nagios plugins return an exit code to indicate the current status of a monitored host or service.</p><p><strong>0 — OK</strong><br> The resource is healthy and operating normally.</p><p><strong>1 — WARNING</strong><br> The resource has reached a warning threshold and may require attention.</p><p><strong>2 — CRITICAL</strong><br> A serious problem has been detected and immediate attention may be required.</p><p><strong>3 — UNKNOWN</strong><br> The plugin was unable to determine the current status of the resource.</p><p>For example:</p><pre>check_ping<br>    ↓<br>PING OK<br>    ↓<br>Exit Code = 0<br>    ↓<br>OK</pre><p>Another example:</p><pre>check_disk<br>    ↓<br>Disk Usage = 95%<br>    ↓<br>Exit Code = 2<br>    ↓<br>CRITICAL</pre><p>This simple plugin model is one of the key concepts behind Nagios.</p><h3>🔌 Common Nagios Plugins</h3><p>Some commonly used plugins are:</p><pre>check_ping<br>check_http<br>check_disk<br>check_load<br>check_users<br>check_tcp<br>check_dns<br>check_procs<br>check_swap<br>check_ssh<br>check_snmp<br>check_ntp<br>check_icmp<br>check_ftp<br>check_smtp<br>check_pop<br>check_imap<br>check_udp</pre><p>Plugins can also be custom-written using languages such as:</p><pre>Bash<br>Python<br>Perl<br>C<br>Go<br>Ruby</pre><h3>🌐 Step 12 — Configure Apache</h3><p>Apache provides the Nagios web interface.</p><p>The architecture is:</p><pre>Browser<br>   ↓<br>Apache HTTP Server<br>   ↓<br>Nagios CGI<br>   ↓<br>Nagios Core<br>   ↓<br>Status Information</pre><p>The Nagios Apache configuration is:</p><pre>/etc/httpd/conf.d/nagios.conf</pre><p>Verify:</p><pre>ls /etc/httpd/conf.d/nagios.conf</pre><p>View it:</p><pre>less /etc/httpd/conf.d/nagios.conf</pre><p>Important directives include:</p><pre>ScriptAlias /nagios/cgi-bin<br>Alias /nagios<br>AuthUserFile<br>AuthType Basic<br>Require valid-user</pre><p>Test the Apache configuration:</p><pre>apachectl configtest</pre><p>Expected:</p><pre>Syntax OK</pre><p>Restart Apache:</p><pre>systemctl restart httpd</pre><p>Enable it at boot:</p><pre>systemctl enable httpd</pre><p>Check:</p><pre>systemctl status httpd</pre><p>Expected:</p><pre>Active: active (running)</pre><h3>🔐 Step 13 — Configure Nagios Web Authentication</h3><p>Nagios uses Apache Basic Authentication for the web interface.</p><p>The authentication flow is:</p><pre>Browser<br>   ↓<br>Apache Authentication<br>   ↓<br>htpasswd.users<br>   ↓<br>cgi.cfg Permissions<br>   ↓<br>Nagios Dashboard</pre><p>The nagiosadmin user can be used for administrative access.</p><p>The web interface can be accessed at:</p><pre>http://SERVER-IP/nagios</pre><h3>🔒 Step 14 — SELinux Configuration</h3><p>RHEL uses SELinux as a mandatory access-control system.</p><p>Check the current state:</p><pre>getenforce</pre><p>The lab environment uses:</p><pre>Enforcing</pre><p>SELinux can affect Apache, CGI execution, file permissions, and service behavior.</p><p>When troubleshooting permission-related problems, check:</p><ul><li>SELinux mode</li><li>File permissions</li><li>Apache configuration</li><li>Nagios configuration</li><li>Relevant audit messages</li></ul><p>Do not simply disable SELinux as the first troubleshooting step.</p><h3>🔥 Step 15 — Configure Firewalld</h3><p>Nagios requires network access to its web interface and potentially to monitored systems.</p><p>Allow HTTP:</p><pre>firewall-cmd --permanent --add-service=http</pre><p>Allow HTTPS:</p><pre>firewall-cmd --permanent --add-service=https</pre><p>Reload:</p><pre>firewall-cmd --reload</pre><p>Verify:</p><pre>firewall-cmd --list-services</pre><p>For NRPE-based remote monitoring, port 5666/tcp may be required:</p><pre>firewall-cmd --permanent --add-port=5666/tcp<br>firewall-cmd --reload</pre><p>For SNMP:</p><pre>firewall-cmd --permanent --add-service=snmp<br>firewall-cmd --reload</pre><p>Check active zones:</p><pre>firewall-cmd --get-active-zones</pre><p>Check the default zone:</p><pre>firewall-cmd --get-default-zone</pre><p>List all firewall configuration:</p><pre>firewall-cmd --list-all</pre><p>Verify listening ports:</p><pre>ss -tlnp</pre><h3>🚀 Step 16 — Start Nagios and Apache</h3><p>Whenever a new systemd service is installed, reload systemd:</p><pre>systemctl daemon-reload</pre><p>Enable Nagios:</p><pre>systemctl enable nagios</pre><p>Enable Apache:</p><pre>systemctl enable httpd</pre><p>Start Apache:</p><pre>systemctl start httpd</pre><p>Start Nagios:</p><pre>systemctl start nagios</pre><p>Check Apache:</p><pre>systemctl status httpd</pre><p>Check Nagios:</p><pre>systemctl status nagios</pre><p>Both should show:</p><pre>Active: active (running)</pre><p>Verify startup configuration:</p><pre>systemctl is-enabled httpd</pre><pre>systemctl is-enabled nagios</pre><p>Expected:</p><pre>enabled</pre><h3>✅ Step 17 — Validate Nagios Configuration</h3><p>Before starting or restarting Nagios, always validate the configuration.</p><p>Run:</p><pre>/usr/local/nagios/bin/nagios \<br>-v \<br>/usr/local/nagios/etc/nagios.cfg</pre><p>Nagios checks:</p><ul><li>Main configuration</li><li>Object definitions</li><li>Host definitions</li><li>Service definitions</li><li>Contact definitions</li><li>Command definitions</li><li>Time periods</li><li>File permissions</li></ul><p>A successful validation should indicate that there are no serious problems.</p><p>If errors are reported, fix them before restarting Nagios.</p><h3>🔎 Step 18 — Verify Running Processes</h3><p>Check Nagios:</p><pre>ps -ef | grep nagios</pre><p>Check Apache:</p><pre>ps -ef | grep httpd</pre><p>Check Apache port:</p><pre>ss -tlnp | grep :80</pre><p>Expected:</p><pre>LISTEN<br>0.0.0.0:80</pre><p>Check Nagios version:</p><pre>/usr/local/nagios/bin/nagios -V</pre><p>Expected:</p><pre>Nagios Core 4.5.13</pre><h3>🌍 Step 19 — Access the Nagios Web Interface</h3><p>Open a browser and navigate to:</p><pre>http://SERVER-IP/nagios</pre><p>For the lab environment:</p><pre>http://192.168.199.128/nagios</pre><p>The browser should display an authentication window.</p><p>Enter:</p><pre>Username:<br>nagiosadmin</pre><pre>Password:<br>Your Password</pre><p>After successful authentication, the Nagios dashboard should appear.</p><p>You should see:</p><pre>Nagios Core 4.5.13</pre><pre>Process Information</pre><pre>Current Status</pre><pre>Service Status</pre><pre>Host Status</pre><h3>🖥️ Step 20 — Verify Localhost Monitoring</h3><p>Navigate to:</p><pre>Current Status<br>        ↓<br>Hosts</pre><p>The localhost host should show:</p><pre>localhost<br>UP</pre><p>Then navigate to:</p><pre>Current Status<br>        ↓<br>Services</pre><p>Example services include:</p><pre>Current Load<br>Current Users<br>Disk Usage<br>HTTP<br>PING<br>Swap Usage</pre><p>Nagios installs sample localhost monitoring so that the installation can be tested immediately.</p><h3>📊 Default Checks</h3><p>After configuring Nagios, the following default checks can be used to verify that Nagios Core and its plugins are working correctly:</p><p><strong>Current Load</strong><br> Monitors the system’s CPU load.</p><p><strong>Current Users</strong><br> Monitors the number of users currently logged into the system.</p><p><strong>Disk Usage</strong><br> Monitors disk space utilization, particularly the root filesystem.</p><p><strong>HTTP</strong><br> Checks whether the Apache web server is available and responding.</p><p><strong>PING</strong><br> Checks network connectivity and ICMP reachability.</p><p><strong>Total Processes</strong><br> Monitors the number of running processes on the system.</p><p><strong>Swap Usage</strong><br> Monitors swap memory utilization.</p><p>These checks provide a useful <strong>initial verification that Nagios Core, its plugins, and the monitoring configuration are working together correctly.</strong></p><h3>📁 Understanding Nagios Configuration Files</h3><p>Nagios stores monitoring configuration in .cfg files.</p><p>The main configuration directory is:</p><pre>/usr/local/nagios/etc</pre><p>Important files include:</p><pre>nagios.cfg<br>cgi.cfg<br>resource.cfg<br>objects/</pre><h3>⚙️ nagios.cfg</h3><p>nagios.cfg is the master configuration file.</p><p>Location:</p><pre>/usr/local/nagios/etc/nagios.cfg</pre><p>View it:</p><pre>less /usr/local/nagios/etc/nagios.cfg</pre><p>Important parameters include:</p><pre>log_file=/usr/local/nagios/var/nagios.log</pre><p>This defines the Nagios log file.</p><p>The object directory:</p><pre>cfg_dir=/usr/local/nagios/etc/objects</pre><p>The command file:</p><pre>command_file=/usr/local/nagios/var/rw/nagios.cmd</pre><p>The status file:</p><pre>status_file=/usr/local/nagios/var/status.dat</pre><p>State retention:</p><pre>retain_state_information=1</pre><p>Think of nagios.cfg as the master configuration that tells Nagios where its other configuration files are located.</p><h3>🔐 cgi.cfg</h3><p>cgi.cfg controls permissions for the Nagios web interface.</p><p>It determines which authenticated users can view monitoring information and perform administrative actions.</p><p>For example:</p><pre>authorized_for_configuration_information=nagiosadmin</pre><p>This allows the user to view configuration information.</p><p>Service commands can be authorized with:</p><pre>authorized_for_all_service_commands=nagiosadmin</pre><p>This can allow actions such as:</p><ul><li>Restart checks</li><li>Disable notifications</li><li>Schedule downtime</li></ul><p>Host commands can be authorized using:</p><pre>authorized_for_all_host_commands=nagiosadmin</pre><h3>🔑 resource.cfg</h3><p>resource.cfg stores reusable variables and sensitive information.</p><p>Location:</p><pre>/usr/local/nagios/etc/resource.cfg</pre><p>View it:</p><pre>less /usr/local/nagios/etc/resource.cfg</pre><p>A common variable is:</p><pre>$USER1$=/usr/local/nagios/libexec</pre><p>This points to the Nagios plugins directory.</p><p>Instead of:</p><pre>command_line /usr/local/nagios/libexec/check_ping</pre><p>you can use:</p><pre>command_line $USER1$/check_ping</pre><p>Other variables can store values such as SNMP community strings or database credentials.</p><p>For example:</p><pre>$USER2$=public</pre><p>or:</p><pre>$USER3$=database_password</pre><p>Using variables helps avoid hardcoding sensitive values directly into command definitions.</p><h3>🧱 Nagios Configuration Relationship</h3><p>The configuration structure can be viewed as:</p><pre>                  nagios.cfg<br>                      │<br>         ┌────────────┼────────────┐<br>         │            │            │<br>         ▼            ▼            ▼<br>    cgi.cfg     resource.cfg    objects/<br>                                     │<br>                     ┌───────────────┼────────────────┐<br>                     ▼               ▼                ▼<br>               commands.cfg    contacts.cfg    localhost.cfg</pre><p>The major configuration responsibilities are:</p><h3>📂 Important Nagios Configuration Files</h3><p>Nagios Core uses several configuration files and directories to define monitoring behavior and web interface settings.</p><p><strong>nagios.cfg</strong><br> Main Nagios configuration file. It defines global settings, log locations, object configuration files, and other Nagios parameters.</p><p><strong>cgi.cfg</strong><br> Controls permissions and access settings for the Nagios web interface and CGI programs.</p><p><strong>resource.cfg</strong><br> Stores macros, variables, and sensitive information such as credentials used by Nagios plugins.</p><p><strong>objects/</strong><br> Contains Nagios object configuration files, including hosts, services, contacts, contact groups, commands, and time periods.</p><h3>🛡️ Configuration Best Practices</h3><p>A few important practices when working with Nagios configuration:</p><ul><li>Keep configuration files backed up.</li><li>Do not store plain-text passwords directly in command definitions.</li><li>Use resource.cfg for sensitive variables.</li><li>Use predefined services whenever possible.</li><li>Validate configuration before restarting Nagios.</li></ul><p>Always run:</p><pre>/usr/local/nagios/bin/nagios \<br>-v \<br>/usr/local/nagios/etc/nagios.cfg</pre><p>A successful validation should end with an indication that no serious problems were detected.</p><h3>🐛 Troubleshooting</h3><p>Even when the installation steps are followed correctly, monitoring software can encounter configuration, permission, firewall, or service problems.</p><p>Here are the most useful troubleshooting commands from this setup.</p><h3>Nagios Service Fails</h3><p>Check the service logs:</p><pre>journalctl -u nagios</pre><p>You can also check:</p><pre>systemctl status nagios</pre><h3>Apache Fails</h3><p>Check:</p><pre>journalctl -u httpd</pre><p>Test configuration:</p><pre>apachectl configtest</pre><p>Expected:</p><pre>Syntax OK</pre><h3>Browser Shows 403 Forbidden</h3><p>Check:</p><pre>SELinux<br>Apache Configuration<br>File Permissions</pre><h3>Authentication Keeps Appearing</h3><p>Check:</p><pre>htpasswd.users<br>AuthUserFile<br>Apache Configuration<br>Permissions</pre><p>Restart Apache after fixing the configuration:</p><pre>systemctl restart httpd</pre><h3>Browser Cannot Connect</h3><p>Check:</p><pre>Apache running<br>Firewall<br>Correct server IP<br>Port 80</pre><p>Verify:</p><pre>ss -tlnp | grep :80</pre><h3>Nagios Configuration Error</h3><p>Never immediately restart Nagios after editing configuration files.</p><p>Validate first:</p><pre>/usr/local/nagios/bin/nagios \<br>-v \<br>/usr/local/nagios/etc/nagios.cfg</pre><p>Fix any errors reported by the validation.</p><h3>Nagios Service Missing</h3><p>If you receive:</p><pre>Unit nagios.service not found</pre><p>Run:</p><pre>make install-init</pre><p>Then:</p><pre>systemctl daemon-reload</pre><h3>Apache Configuration Missing</h3><p>If this file does not exist:</p><pre>/etc/httpd/conf.d/nagios.conf</pre><p>Run:</p><pre>make install-webconf</pre><h3>🔍 Useful Verification Commands</h3><h3>Check Nagios</h3><pre>systemctl status nagios</pre><h3>Check Apache</h3><pre>systemctl status httpd</pre><h3>Check Nagios Version</h3><pre>/usr/local/nagios/bin/nagios -V</pre><h3>Check Nagios Configuration</h3><pre>/usr/local/nagios/bin/nagios \<br>-v \<br>/usr/local/nagios/etc/nagios.cfg</pre><h3>Check Apache Configuration</h3><pre>apachectl configtest</pre><h3>Check Port 80</h3><pre>ss -tlnp | grep :80</pre><h3>Check Processes</h3><pre>ps -ef | grep nagios<br>ps -ef | grep httpd</pre><h3>Check Firewall</h3><pre>firewall-cmd --list-all</pre><h3>Check SELinux</h3><pre>getenforce</pre><h3>✅ Complete Installation Checklist</h3><p>Before considering the Nagios installation complete, verify:</p><pre>☑ RHEL 9.8 installed<br>☑ System updated<br>☑ Required repositories enabled<br>☑ Dependencies installed<br>☑ GCC installed<br>☑ Apache installed<br>☑ PHP installed<br>☑ Nagios user created<br>☑ nagcmd group created<br>☑ Nagios Core 4.5.13 downloaded<br>☑ Nagios Core compiled<br>☑ Nagios Core installed<br>☑ Nagios Plugins 2.5 installed<br>☑ Apache configured<br>☑ SELinux checked<br>☑ Firewalld configured<br>☑ Nagios service enabled<br>☑ Apache service enabled<br>☑ Nagios configuration validated<br>☑ Apache configuration validated<br>☑ Web interface accessible<br>☑ nagiosadmin authentication working<br>☑ localhost monitored<br>☑ Host status visible<br>☑ Service status visible</pre><h3>🔄 Complete Installation Flow</h3><p>The entire process can be summarized as:</p><pre>RHEL 9.8 Preparation<br>        ↓<br>Register System<br>        ↓<br>Enable Repositories<br>        ↓<br>Install Dependencies<br>        ↓<br>Create Nagios User/Group<br>        ↓<br>Download Nagios Core<br>        ↓<br>Extract Source<br>        ↓<br>Configure<br>        ↓<br>Compile<br>        ↓<br>Install Nagios<br>        ↓<br>Install Systemd Service<br>        ↓<br>Install Configuration<br>        ↓<br>Install Command Mode<br>        ↓<br>Install Apache Configuration<br>        ↓<br>Install Nagios Plugins<br>        ↓<br>Configure Apache<br>        ↓<br>Configure SELinux<br>        ↓<br>Configure Firewalld<br>        ↓<br>Validate Nagios Configuration<br>        ↓<br>Start Nagios + Apache<br>        ↓<br>Access Web Interface<br>        ↓<br>Verify Localhost<br>        ↓<br>Ready for Infrastructure Monitoring</pre><h3>🧠 What I Learned From This Project</h3><p>Building Nagios on RHEL 9 gave me hands-on experience with much more than simply installing a monitoring application.</p><p>I worked with:</p><ul><li>RHEL system preparation</li><li>DNF package management</li><li>Source-code compilation</li><li>GCC and Make</li><li>Linux users and groups</li><li>Systemd services</li><li>Apache configuration</li><li>PHP</li><li>Firewalld</li><li>SELinux</li><li>Nagios Core</li><li>Nagios Plugins</li><li>Monitoring architecture</li><li>Configuration files</li><li>Web authentication</li><li>Host monitoring</li><li>Service monitoring</li><li>NRPE concepts</li><li>SNMP monitoring concepts</li><li>Troubleshooting</li><li>Configuration validation</li></ul><p>One of the most important concepts I learned is the relationship between <strong>Nagios Core and Nagios Plugins</strong>.</p><p>Nagios Core is responsible for scheduling and processing checks, while the plugins actually perform the checks and return standard status codes such as OK, WARNING, CRITICAL, and UNKNOWN.</p><p>This modular architecture makes Nagios flexible and allows administrators to extend monitoring using additional plugins and custom checks.</p><h3>🚀 Final Thoughts</h3><p>Nagios remains a useful tool for infrastructure monitoring because of its modular architecture, flexibility, plugin ecosystem, and ability to monitor many different types of infrastructure.</p><p>In this project, I built a complete Nagios Core monitoring environment on <strong>RHEL 9.8</strong> using:</p><pre>RHEL 9.8<br>    ↓<br>Nagios Core 4.5.13<br>    ↓<br>Nagios Plugins 2.5<br>    ↓<br>Apache<br>    ↓<br>Nagios Web Interface<br>    ↓<br>Host &amp; Service Monitoring<br>    ↓<br>Alerts &amp; Notifications</pre><p>The installation also provided practical experience with important Linux administration concepts such as <strong>systemd, users and groups, SELinux, firewalld, Apache, source compilation, configuration management, and troubleshooting</strong>.</p><p>From here, the environment can be extended to monitor remote Linux servers using <strong>NRPE</strong>, network infrastructure using <strong>SNMP</strong>, applications using service-specific plugins, and larger environments through distributed monitoring.</p><p>The key lesson is simple:</p><blockquote><strong><em>Monitoring is not just about knowing whether a server is running. It is about continuously understanding the health of the infrastructure and detecting problems before they become major incidents.</em></strong></blockquote><h3>📌 Key Commands Cheat Sheet</h3><pre># Check RHEL version<br>cat /etc/redhat-release</pre><pre># Check architecture<br>uname -m</pre><pre># Update RHEL<br>sudo dnf update -y</pre><pre># Install dependencies<br>sudo dnf install -y gcc gcc-c++ make autoconf automake wget curl git tar unzip httpd php php-cli php-gd gd gd-devel openssl openssl-devel net-snmp net-snmp-utils net-snmp-perl policycoreutils-python-utils</pre><pre># Configure Nagios Core<br>./configure --with-command-group=nagcmd</pre><pre># Compile<br>make all</pre><pre># Test<br>make test</pre><pre># Install<br>make install</pre><pre># Install systemd service<br>make install-init</pre><pre># Install configuration<br>make install-config</pre><pre># Install command mode<br>make install-commandmode</pre><pre># Install Apache configuration<br>make install-webconf</pre><pre># Configure plugins<br>./configure --with-nagios-user=nagios --with-nagios-group=nagios</pre><pre># Compile plugins<br>make</pre><pre># Install plugins<br>make install</pre><pre># Reload systemd<br>systemctl daemon-reload</pre><pre># Enable services<br>systemctl enable nagios<br>systemctl enable httpd</pre><pre># Start services<br>systemctl start nagios<br>systemctl start httpd</pre><pre># Check services<br>systemctl status nagios<br>systemctl status httpd</pre><pre># Validate Nagios<br>/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg</pre><pre># Validate Apache<br>apachectl configtest</pre><pre># Check Nagios version<br>/usr/local/nagios/bin/nagios -V</pre><pre># Check Apache port<br>ss -tlnp | grep :80</pre><pre># Check SELinux<br>getenforce</pre><pre># Check firewall<br>firewall-cmd --list-all</pre><pre># Access Nagios<br>http://SERVER-IP/nagios</pre><h3>🏷️ Medium Topics</h3><p><strong>DevOps · Linux · Monitoring · Nagios · System Administration</strong></p><p>Additional relevant tags:</p><p><strong>RHEL · Infrastructure · Networking · SRE · Open Source · Server Monitoring · IT Operations · Apache · SELinux · Firewalld</strong></p><h3>🔗 Project Documentation</h3><p>The complete technical documentation contains the detailed installation steps, configurations, commands, verification procedures, screenshots, architecture diagrams, and troubleshooting information used to build this Nagios environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2d6cbfc93a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Building a Centralized Logging System on RHEL 9 with Loki, Promtail & Grafana]]></title>
            <link>https://medium.com/@kartikpawar1290/building-a-centralized-logging-system-on-rhel-9-with-loki-promtail-grafana-727371bba24c?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/727371bba24c</guid>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[logging-and-monitoring]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Tue, 11 Aug 2026 08:02:19 GMT</pubDate>
            <atom:updated>2026-08-11T08:02:19.332Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lt7Jg2-TbQ-sIfI_7GgD6A.png" /></figure><p>In modern Linux environments, applications and system services generate a large amount of log data. When these logs are spread across different files and servers, troubleshooting and monitoring can become difficult.</p><p>In this project, I built a <strong>centralized log monitoring solution on RHEL 9 using Grafana Loki, Promtail, and Grafana</strong>.</p><p>The setup collects logs from a RHEL 9 server using Promtail, sends them to Loki, and uses Grafana to search, visualize, and analyze the logs using LogQL.</p><h3>🎯 Objective</h3><p>The objective of this project is to install and configure <strong>Loki and Promtail on RHEL 9</strong>, collect system logs, and connect Loki with Grafana for centralized log monitoring.</p><p>The final architecture looks like this:</p><h3>🏗️ Architecture</h3><pre>+-----------------------------------------------------+<br>|                     RHEL 9 Server                   |<br>|                                                     |<br>|  /var/log/messages                                 |<br>|  /var/log/secure                                   |<br>|  /var/log/httpd/*                                  |<br>|              │                                      |<br>|              ▼                                      |<br>|          Promtail                                   |<br>|              │                                      |<br>|              ▼                                      |<br>|             Loki (Port 3100)                        |<br>|              │                                      |<br>+--------------│--------------------------------------+<br>               │ HTTP <br>               ▼<br>+-----------------------------------------------------+<br>|                    Grafana                          |<br>|                   Port 3000                         |<br>+-----------------------------------------------------+</pre><h3>How the architecture works</h3><ul><li><strong>RHEL 9</strong> generates system and application logs.</li><li><strong>Promtail</strong> reads the log files.</li><li>Promtail forwards the collected logs to <strong>Loki</strong>.</li><li><strong>Loki</strong> stores and indexes the log data.</li><li><strong>Grafana</strong> connects to Loki as a data source.</li><li>Logs can then be searched and analyzed using <strong>LogQL</strong>.</li></ul><h3>🔧 Prerequisites</h3><p>Before starting, make sure the following requirements are available:</p><ul><li>RHEL 9.x</li><li>Root or sudo privileges</li><li>Internet connectivity</li><li>x86_64 (amd64) architecture</li></ul><p>Verify the operating system and architecture:</p><pre>cat /etc/redhat-release<br>uname -m</pre><p>Expected output:</p><pre>Red Hat Enterprise Linux release 9.x<br>x86_64</pre><h3>📥 Step 1 — Download Loki and Promtail</h3><p>First, move to the /tmp directory:</p><pre>cd /tmp</pre><p>Download Loki and Promtail:</p><pre>wget https://github.com/grafana/loki/releases/download/v3.2.0/loki-linux-amd64.zip</pre><pre>wget <a href="https://github.com/grafana/loki/releases/download/v3.2.0/promtail-linux-amd64.zip">https://github.com/grafana/loki/releases/download/v3.2.0/promtail-linux-amd64.zip</a></pre><p>In this setup, I used <strong>Loki v3.2.0</strong> and the corresponding Promtail release.</p><h3>📦 Step 2 — Install unzip</h3><p>Install the unzip package using DNF:</p><pre>sudo dnf install unzip -y</pre><h3>📂 Step 3 — Extract the Packages</h3><p>Extract both downloaded archives:</p><pre>unzip loki-linux-amd64.zip<br>unzip promtail-linux-amd64.zip</pre><p>After extraction, the Loki and Promtail binaries will be available in the current directory.</p><h3>⚙️ Step 4 — Install the Binaries</h3><p>Move the binaries to /usr/local/bin:</p><pre>sudo mv loki-linux-amd64 /usr/local/bin/loki<br>sudo mv promtail-linux-amd64 /usr/local/bin/promtail</pre><p>Grant execute permissions:</p><pre>sudo chmod +x /usr/local/bin/loki<br>sudo chmod +x /usr/local/bin/promtail</pre><p>Because RHEL uses SELinux, restore the appropriate security context:</p><pre>sudo restorecon -Rv /usr/local/bin</pre><p>Verify the installed versions:</p><pre>loki --version<br>promtail --version</pre><p>This confirms that both binaries are installed correctly.</p><h3>👤 Step 5 — Create Service Users</h3><p>For Loki and Promtail, create dedicated system users:</p><pre>sudo useradd --system --no-create-home --shell /sbin/nologin loki</pre><pre>sudo useradd --system --no-create-home --shell /sbin/nologin promtail</pre><p>Using dedicated service accounts helps separate the services from normal user accounts.</p><h3>📁 Step 6 — Create Required Directories</h3><p>Create configuration directories:</p><pre>sudo mkdir -p /etc/loki<br>sudo mkdir -p /etc/promtail</pre><p>Create data directories:</p><pre>sudo mkdir -p /var/lib/loki<br>sudo mkdir -p /var/lib/promtail</pre><p>These directories will be used for configuration and application data.</p><h3>📄 Step 7 — Download Configuration Files</h3><h3>Loki</h3><p>Download the Loki configuration file:</p><pre>sudo wget -O /etc/loki/loki-local-config.yaml \<br>https://raw.githubusercontent.com/grafana/loki/v3.2.0/cmd/loki/loki-local-config.yaml</pre><h3>Promtail</h3><p>Download the Promtail configuration file:</p><pre>sudo wget -O /etc/promtail/promtail-local-config.yaml \<br>https://raw.githubusercontent.com/grafana/loki/v3.2.0/clients/cmd/promtail/promtail-local-config.yaml</pre><h3>📝 Step 8 — Configure Promtail</h3><p>Open the Promtail configuration file:</p><pre>sudo vi /etc/promtail/promtail-local-config.yaml</pre><p>Modify the client section:</p><pre>clients:<br>  - url: http://localhost:3100/loki/api/v1/push</pre><p>This configuration tells Promtail where to send the collected logs.</p><p>In this setup, Loki is running locally on port 3100.</p><h3>🔐 Step 9 — Set Ownership</h3><p>Set the correct ownership for Loki:</p><pre>sudo chown -R loki:loki /etc/loki<br>sudo chown -R loki:loki /var/lib/loki</pre><p>Set the correct ownership for Promtail:</p><pre>sudo chown -R promtail:promtail /etc/promtail<br>sudo chown -R promtail:promtail /var/lib/promtail</pre><h3>⚙️ Step 10 — Create Loki Service</h3><p>Create a systemd service file:</p><pre>vi /etc/systemd/system/loki.service</pre><p>Add:</p><pre>[Unit]<br>Description=Loki<br>After=network.target<br>[Service]<br>User=loki<br>Group=loki<br>Type=simple<br>ExecStart=/usr/local/bin/loki -config.file=/etc/loki/loki-local-config.yaml<br>Restart=on-failure<br>RestartSec=5<br>[Install]<br>WantedBy=multi-user.target</pre><p>This allows Loki to be managed as a system service.</p><h3>⚙️ Step 11 — Create Promtail Service</h3><p>Create the Promtail systemd service:</p><pre>vi /etc/systemd/system/promtail.service</pre><p>Add:</p><pre>[Unit]<br>Description=Promtail<br>After=network.target<br>[Service]<br>User=root<br>Group=root<br>Type=simple<br>ExecStart=/usr/local/bin/promtail -config.file=/etc/promtail/promtail-local-config.yaml<br>Restart=on-failure<br>RestartSec=5<br>[Install]<br>WantedBy=multi-user.target</pre><h3>🔄 Step 12 — Reload systemd</h3><p>After creating the service files, reload systemd:</p><pre>sudo systemctl daemon-reload</pre><h3>🚀 Step 13 — Enable Services</h3><p>Enable both Loki and Promtail so they start automatically during system boot:</p><pre>sudo systemctl enable loki<br>sudo systemctl enable promtail</pre><h3>▶️ Step 14 — Start Services</h3><p>Start Loki:</p><pre>sudo systemctl start loki</pre><p>Start Promtail:</p><pre>sudo systemctl start promtail</pre><h3>✅ Step 15 — Verify Status</h3><p>Check Loki:</p><pre>systemctl status loki</pre><p>Check Promtail:</p><pre>systemctl status promtail</pre><p>Expected status:</p><pre>Active: active (running)</pre><p>If both services are running successfully, the Loki and Promtail services are operational.</p><h3>🔍 Step 16 — Verify Loki</h3><p>Check whether Loki is ready:</p><pre>curl http://localhost:3100/ready</pre><p>Expected output:</p><pre>ready</pre><p>If Loki initially reports that it is not ready, this can occur while the service is starting up. Give it some time and check again.</p><h3>🧪 Step 17 — Generate Test Logs</h3><p>To verify that Promtail is collecting logs, generate a test log:</p><pre>logger &quot;Promtail test log&quot;</pre><p>Monitor Promtail logs:</p><pre>journalctl -u promtail -f</pre><p>This helps verify that Promtail is running and processing logs.</p><h3>📊 Step 18 — Install Grafana</h3><p>Install Grafana using the RPM package:</p><pre>sudo dnf install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-11.6.1-1.x86_64.rpm</pre><p>Enable Grafana:</p><pre>sudo systemctl enable grafana-server</pre><p>Start Grafana:</p><pre>sudo systemctl start grafana-server</pre><h3>🔥 Step 19 — Configure Firewall</h3><p>Grafana uses port 3000 by default.</p><p>Allow port 3000 through the RHEL firewall:</p><pre>sudo firewall-cmd --permanent --add-port=3000/tcp<br>sudo firewall-cmd --reload</pre><h3>🌐 Step 20 — Access Grafana</h3><p>Open the following address in your browser:</p><pre>http://&lt;SERVER-IP&gt;:3000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OVyzUQHa29tr5a7s" /></figure><h3>Default Credentials</h3><pre>Username : admin</pre><pre>Password : admin</pre><p>After logging in, Grafana will provide access to the monitoring interface.</p><h3>🔗 Step 21 — Add Loki Data Source</h3><p>Inside Grafana, navigate to:</p><pre>Connections<br>      ↓<br>Data Sources<br>      ↓<br>Add Data Source<br>      ↓<br>Loki</pre><p>Set the Loki URL to:</p><pre>http://localhost:3100</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zp_a9DAoj97AdVbU" /></figure><p>Click:</p><pre>Save &amp; Test</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4gdMXgJMeddWSzkJ" /></figure><p>Expected result:</p><pre>Data source is working</pre><p>At this point, Grafana is successfully connected to Loki.</p><h3>🔎 Step 22 — Explore Logs</h3><p>Now we can verify the complete logging pipeline.</p><p>Go to:</p><pre>Explore</pre><p>Select:</p><pre>Loki</pre><p>Grafana provides <strong>LogQL</strong>, the query language used to search and filter logs stored in Loki.</p><h3>View All Logs</h3><pre>{}</pre><h3>Search for Errors</h3><pre>{} |= &quot;error&quot;</pre><h3>Search for the Test Log</h3><pre>{} |= &quot;Promtail test log&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4E9j3x3KRrg9YPqy" /></figure><p>If the test message appears in Grafana, it confirms that the complete pipeline is working:</p><pre>RHEL 9<br>   ↓<br>Promtail<br>   ↓<br>Loki<br>   ↓<br>Grafana<br>   ↓<br>LogQL</pre><h3>🛠️ Useful Commands</h3><p>During administration and troubleshooting, these commands are useful.</p><h3>Check Loki</h3><pre>systemctl status loki</pre><h3>Check Promtail</h3><pre>systemctl status promtail</pre><h3>Restart Services</h3><pre>systemctl restart loki<br>systemctl restart promtail</pre><h3>View Logs</h3><pre>journalctl -u loki -f<br>journalctl -u promtail -f</pre><h3>Check Readiness</h3><pre>curl http://localhost:3100/ready</pre><h3>🐛 Troubleshooting</h3><p>Working with RHEL also means dealing with security controls such as SELinux. Here are some of the troubleshooting commands used in this setup.</p><h3>Permission Denied</h3><p>If you encounter permission-related problems with the binaries, restore the SELinux context:</p><pre>sudo restorecon -Rv /usr/local/bin</pre><h3>Check SELinux</h3><p>Check the current SELinux mode:</p><pre>getenforce</pre><h3>Verify Versions</h3><p>Check Loki:</p><pre>loki --version</pre><p>Check Promtail:</p><pre>promtail --version</pre><h3>Check Service Logs</h3><p>For Loki:</p><pre>journalctl -xeu loki</pre><p>For Promtail:</p><pre>journalctl -xeu promtail</pre><p>These commands are particularly useful when a systemd service fails to start or enters a restart loop.</p><h3>🧠 What I Learned</h3><p>This project helped me understand how a centralized logging pipeline works on a Linux server.</p><p>I gained practical experience with:</p><ul><li>Installing Loki and Promtail on RHEL 9</li><li>Working with Linux binaries</li><li>Creating systemd services</li><li>Managing service users and permissions</li><li>Working with SELinux</li><li>Configuring Promtail</li><li>Collecting Linux logs</li><li>Sending logs to Loki</li><li>Connecting Loki with Grafana</li><li>Using Grafana Explore</li><li>Writing basic LogQL queries</li><li>Troubleshooting systemd services</li><li>Configuring the RHEL firewall</li></ul><p>One of the most important concepts I learned was that <strong>centralized logging makes troubleshooting much easier</strong>. Instead of manually checking different log files, logs can be collected, searched, and analyzed from a single Grafana interface.</p><h3>🏁 Conclusion</h3><p>In this project, I successfully built a centralized logging solution using <strong>Loki, Promtail, and Grafana on RHEL 9</strong>.</p><p>The final workflow is:</p><pre>Linux Logs<br>    ↓<br>Promtail<br>    ↓<br>Loki<br>    ↓<br>Grafana<br>    ↓<br>LogQL</pre><p>The responsibilities of each component are straightforward:</p><ul><li><strong>Loki</strong> stores logs efficiently.</li><li><strong>Promtail</strong> collects and forwards logs to Loki.</li><li><strong>Grafana</strong> connects to Loki and provides log visualization and searching.</li><li><strong>LogQL</strong> allows us to query and filter the collected logs.</li></ul><p>This setup provides a centralized logging solution for Linux servers and is a useful foundation for building more advanced <strong>DevOps, monitoring, observability, and SRE environments</strong>.</p><h3>🚀 Final Takeaway</h3><p>Building this setup gave me hands-on experience with the complete log-monitoring workflow rather than simply installing individual tools.</p><p>From configuring a RHEL 9 server and systemd services to collecting logs with Promtail, storing them in Loki, and querying them through Grafana, this project demonstrates how open-source observability tools can be combined to create a practical centralized logging platform.</p><p>The same concepts can later be extended to multiple servers, application logs, containers, Kubernetes workloads, dashboards, and alerting.</p><h3>💻 Useful Commands at a Glance</h3><pre># Check Loki<br>systemctl status loki</pre><pre># Check Promtail<br>systemctl status promtail</pre><pre># Restart Loki<br>systemctl restart loki</pre><pre># Restart Promtail<br>systemctl restart promtail</pre><pre># Check Loki readiness<br>curl <a href="http://localhost:3100/ready">http://localhost:3100/ready</a></pre><pre># View Loki logs<br>journalctl -u loki -f</pre><pre># View Promtail logs<br>journalctl -u promtail -f</pre><pre># Check SELinux<br>getenforce</pre><pre># Check Loki version<br>loki --version</pre><pre># Check Promtail version<br>promtail --version</pre><pre># Generate a test log<br>logger &quot;Promtail test log&quot;</pre><h3>🏷️ Tags</h3><p>#DevOps #Linux #RHEL #Grafana #Loki #Promtail #Monitoring #Observability #SRE #CloudComputing #LogManagement</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=727371bba24c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Infrastructure Monitoring & Alerting Setup Using Prometheus, Grafana and Alertmanager.]]></title>
            <link>https://medium.com/@kartikpawar1290/infrastructure-monitoring-alerting-setup-using-prometheus-grafana-and-alertmanager-0d2281dc9348?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d2281dc9348</guid>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Tue, 30 Jun 2026 16:13:39 GMT</pubDate>
            <atom:updated>2026-08-11T13:03:17.567Z</atom:updated>
            <content:encoded><![CDATA[<p>ARCHITECTURE DIAGRAM :-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3i67OjEtNHJIi9NkAhs1uA.png" /><figcaption>Monitoring and alerting system diagram</figcaption></figure><h3><strong>Lab 1 — Verify Connectivity</strong></h3><p>On Rehat<br>Find its IP address</p><pre>ip add</pre><p>On Ubuntu<br>Ping the Red Hat VM.<br>ping &lt;redhat ip&gt;</p><h3><strong>Lab 2 — Install Node Exporter on Red Hat</strong></h3><p>Update packages<br>sudo dnf update -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZpNJGi352S7UOHw_QXW8Q.png" /></figure><p>Create a Node Exporter user</p><pre>sudo useradd --no-create-home --shell /sbin/nologin node_exporter</pre><p>Download the latest Node Exporter</p><pre>wget https://github.com/prometheus/node_exporter/releases/download/v1.11.1/node_exporter-1.11.1.linux-amd64.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gi9DeNynYZMOFOVd_ozPpQ.png" /></figure><pre>tar -xzf node_exporter-*.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*yRqrXjU0j0t7a5uZt4OyAA.png" /></figure><h4>Copy binary</h4><pre>sudo cp node_exporter-*/node_exporter /usr/local/bin/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*lWI4ASYpWaT2YXrmbJgQ-w.png" /></figure><h4>Set permissions</h4><pre>sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*wm_sO55TOdlGuIuNReMLvQ.png" /></figure><h3>Create the service</h3><pre>sudo vi /etc/systemd/system/node_exporter.service</pre><pre>[Unit]<br>Description=Node Exporter<br>Wants=network-online.target<br>After=network-online.target<br>[Service]<br>User=node_exporter<br>Group=node_exporter<br>Type=simple<br>ExecStart=/usr/local/bin/node_exporter<br>[Install]<br>WantedBy=multi-user.target</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*5ZDhOqjTtOcVVcn-pCQOww.png" /></figure><h3>Reload</h3><pre>sudo systemctl daemon-reload</pre><h3>Start</h3><pre>sudo systemctl enable --now node_exporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xGAIankToGyOZeJ_ylwF8g.png" /></figure><h3>Verify</h3><pre>systemctl status node_exporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pympm-0iAEto8xSvexJ6yg.png" /></figure><h3>Open firewall</h3><pre>sudo firewall-cmd --permanent --add-port=9100/tcp<br>sudo firewall-cmd --reload</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*iGYz_b2pYFBJs1UrIkLNCA.png" /></figure><h3>Test</h3><p>Open in browser</p><pre>http://&lt;RedHat-IP&gt;:9100</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*Nj9r9wfsXps05DPtE5oBBQ.png" /></figure><pre>http://&lt;RedHat-IP&gt;:9100/metrics</pre><p>You should see thousands of metrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NeJs3sC-57T8XzMpxO9Gkg.png" /></figure><h3><strong>Lab 3 — Install Prometheus on Ubuntu (WSL)</strong></h3><p>Create a user:</p><pre>sudo useradd --no-create-home --shell /bin/false prometheus<br><br>id prometheus</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*H30vNr0j1V5l8FGOPsg67w.png" /></figure><p>Create the Prometheus configuration and data directories:</p><pre>sudo mkdir /etc/prometheus<br>sudo mkdir /var/lib/prometheus</pre><p>Download Prometheus from:</p><pre>wget https://github.com/prometheus/prometheus/releases/download/v3.12.0/prometheus-3.12.0.linux-amd64.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_x8BB_Qe9WNCbfJ3lQVkw.png" /></figure><p>Extract it.</p><pre>tar -xvf prometheus-3.12.0.linux-amd64.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*bzVa5Q9wnI3uxunK3qQxzA.png" /></figure><p>Copy:</p><pre>sudo cp prometheus prometheus.yml promtool /usr/local/bin/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*pxpOpJBAyOXKOH7FRP_yNw.png" /></figure><pre>sudo cp prometheus.yml /etc/prometheus/<br><br>ls -l /etc/prometheus/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*pAvWd-QC1edjnQ8EIZPowg.png" /></figure><pre>sudo chown -R prometheus:prometheus /etc/prometheus<br>sudo chown -R prometheus:prometheus /var/lib/prometheus<br>sudo chown prometheus:prometheus /usr/local/bin/prometheus<br>sudo chown prometheus:prometheus /usr/local/bin/promtool<br><br>ls -ld /etc/prometheus<br>ls -ld /var/lib/prometheus</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*cpVN6kCxsqbX52d7jw1IAg.png" /></figure><p>Create the Prometheus service:</p><pre>sudo vi /etc/systemd/system/prometheus.service</pre><pre>[Unit]<br>Description=Prometheus Monitoring System<br>Wants=network-online.target<br>After=network-online.target<br><br>[Service]<br>User=prometheus<br>Group=prometheus<br>Type=simple<br>ExecStart=/usr/local/bin/prometheus \<br>  --config.file=/etc/prometheus/prometheus.yml \<br>  --storage.tsdb.path=/var/lib/prometheus<br><br>Restart=on-failure<br><br>[Install]<br>WantedBy=multi-user.target</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*FuBJpgZGPa1VMDTyfZTPQQ.png" /></figure><p>Start:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable --now prometheus</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*cWYX3mFilxLymEKeHrOOog.png" /></figure><p>Start:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable --now prometheus<br>sudo systemctl start prometheus<br>sudo systemctl status prometheus</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rSS-JD6cSVcgu3WOEMKH4A.png" /></figure><pre>ss -tulnp | grep 9090</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*R49nmeMh_70mw_6Jcj0hZQ.png" /></figure><p>Open</p><pre>http://localhost:9090</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BxMg2Ypes5Qz3aVJhwK0og.png" /></figure><p>Status → Targets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCrjkpX1GURDt6MwEwU4XQ.png" /></figure><h3><strong>Lab 4 — Install Node Exporter on Ubuntu (WSL)</strong></h3><p>Create a Node Exporter User</p><pre>sudo useradd --no-create-home --shell /usr/sbin/nologin node_exporter</pre><pre>id node_exporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*81oTazhEKPCl0ImzqsPIbQ.png" /></figure><p>Download Node Exporter</p><p>wget <a href="https://github.com/prometheus/node_exporter/releases/download/v1.10.2/node_exporter-1.10.2.linux-amd64.tar.gz">https://github.com/prometheus/node_exporter/releases/download/v1.10.2/node_exporter-1.10.2.linux-amd64.tar.gz</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A1x_o2p2NDSFy2bmBfYthQ.png" /></figure><p>Extract the archive:</p><pre>tar -xvf node_exporter-1.10.2.linux-amd64.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*F4xtOXTxjrfbPZKih77Iug.png" /></figure><p>Enter the extracted directory</p><pre>cd node_exporter-1.10.2.linux-amd64</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*yK6zeqoVa7_NPwKZT-cJvQ.png" /></figure><p>Copy the binary</p><pre>sudo cp node_exporter /usr/local/bin/<br><br>ls -l /usr/local/bin/node_exporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*79LLaoiGC-y0AyT0wea7zA.png" /></figure><p>Change ownership</p><pre>sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter<br><br>ls -l /usr/local/bin/node_exporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*0s8OLiUcS8AE37f7zVAsfQ.png" /></figure><p>Create the systemd service</p><pre>sudo vi /etc/systemd/system/node_exporter.service</pre><pre>[Unit]<br>Description=Prometheus Node Exporter<br>Documentation=https://prometheus.io/docs/guides/node-exporter/<br>Wants=network-online.target<br>After=network-online.target<br>[Service]<br>User=node_exporter<br>Group=node_exporter<br>Type=simple<br>ExecStart=/usr/local/bin/node_exporter<br>Restart=on-failure<br>[Install]<br>WantedBy=multi-user.target</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*IqRcWREaAPjA_2LD4V4jCQ.png" /></figure><p>Reload systemd — Reload, Enable, Start, then Check Service Satus</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable node_exporter<br>sudo systemctl start node_exporter<br>sudo systemctl status node_exporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*qCz5lZpkyuLhNad_10bLnA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7c3WxZE-RqUybQP_SRi3Ww.png" /></figure><p>Verify the Port</p><pre>ss -tulnp | grep 9100</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*xaElfD3wwvg4AdUP9Nnqzg.png" /></figure><pre>Verify in the browser: <br><br>http://localhost:9100</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqk0aCXtUWIEvSQOLFL3sw.png" /></figure><pre>http://localhost:9100/metrics</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EeuL7Jl2zQ9D12gAsIeBjA.png" /></figure><p>Configure Prometheus</p><pre>sudo vi /etc/prometheus/prometheus.yml</pre><pre>global:<br> scrape_interval: 15s<br> evaluation_interval: 15s<br>alerting:<br> alertmanagers:<br> - static_configs:<br> - targets:<br> - localhost:9093<br>rule_files:<br> - &quot;/etc/prometheus/alert_rules.yml&quot;<br>scrape_configs:<br> - job_name: &quot;prometheus&quot;<br> static_configs:<br> - targets: [&quot;localhost:9090&quot;]<br> labels:<br> server: &quot;Prometheus Server&quot;<br> environment: &quot;Lab&quot;<br> - job_name: &quot;ubuntu-wsl&quot;<br> static_configs:<br> - targets: [&quot;localhost:9100&quot;]<br> labels:<br> server: &quot;Ubuntu WSL&quot;<br> environment: &quot;Lab&quot;<br> - job_name: &quot;redhat&quot;<br> static_configs:<br> - targets: [&quot;192.168.199.128:9100&quot;] # Change if your Red Hat IP changes<br> labels:<br> server: &quot;Red Hat Server&quot;<br> environment: &quot;Lab&quot;</pre><pre>promtool check config /etc/prometheus/prometheus.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*xOTWK1LBqCyhoJWflape7Q.png" /></figure><p>Restart Prometheus:</p><pre>sudo systemctl restart prometheus</pre><p>Open:<br><a href="http://localhost:9090/targets">http://localhost:9090/targets</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oSxCmtXDRYuEvOiigbAvlA.png" /></figure><h3><strong>Lab 5— Install Grafana on Ubuntu (WSL)</strong></h3><p>Once Prometheus and Node Exporter are working, the next step is to install Grafana.</p><p>Update the package index</p><pre>sudo apt update</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ce22G6oG1jBdzvB8ASsdtA.png" /></figure><p>Install required packages<br>installs three packages that are commonly needed before adding third-party software repositories or downloading software.</p><pre>sudo apt install -y software-properties-common apt-transport-https wget</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*rflaODaI7ZX3e3sxT4IWGw.png" /></figure><p>Create the keyrings directory<br>This command is commonly used before installing software like <strong>Grafana</strong>, <strong>Docker</strong>, or <strong>Kubernetes</strong> from their official APT repositories.<br>First, what is a keyring?<br>A <strong>keyring</strong> is a place where Linux stores <strong>public GPG (GNU Privacy Guard) keys</strong>.<br>These keys are used to <strong>verify that software packages really come from the official source and haven’t been modified</strong>.<br>Think of it like a company’s official seal.</p><h3>Example</h3><p>Suppose you download Grafana.</p><pre>Grafana Server<br>      │<br>      │ signs package using its private key<br>      ▼<br>grafana_12.x.deb</pre><p>Ubuntu downloads the package.<br>Before installing it, Ubuntu checks:</p><blockquote><em>“Is this package signed by Grafana’s official public key?”</em></blockquote><p>If the answer is <strong>Yes</strong> ✅<br>→ Install the package.</p><p>If <strong>No</strong> ❌<br>→ Reject it because it may have been tampered with.</p><pre>sudo mkdir -p /etc/apt/keyrings</pre><h4>Why do we need /etc/apt/keyrings?</h4><p>APT (Ubuntu’s package manager) needs a place to store the <strong>trusted public keys</strong> for third-party repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*WyKqNtKa9DoRfpxzNv9TIw.png" /></figure><p>Download Grafana’s GPG key</p><pre>wget -q -O - https://apt.grafana.com/gpg.key | \<br>gpg --dearmor | \<br>sudo tee /etc/apt/keyrings/grafana.gpg &gt; /dev/null<br><br>ls -l /etc/apt/keyrings/</pre><p>This is one of the most common Linux commands you’ll see while installing software from third-party repositories like <strong>Grafana</strong>, <strong>Docker</strong>, <strong>Kubernetes</strong>, and <strong>HashiCorp</strong>.<br>What is this command doing?</p><p>In simple words:</p><blockquote><strong><em>Download Grafana’s public GPG key → Convert it into a binary format → Save it in the APT keyring.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*KiJpO-n9ky9yNkKtGgteJQ.png" /></figure><p>Add the Grafana repository</p><pre>echo &quot;deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main&quot; | \<br>sudo tee /etc/apt/sources.list.d/grafana.list<br><br>cat /etc/apt/sources.list.d/grafana.list</pre><p>This command <strong>adds the Grafana APT repository</strong> to your Ubuntu system so that apt knows where to download Grafana from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*v2zBWwG9ITDU7rSDsFY54A.png" /></figure><p>Update the package list</p><p>sudo apt update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2nUCLPjNpVxZK-2YujKk8w.png" /></figure><p>Install Grafana</p><pre>sudo apt install grafana -y<br>grafana-server -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lvJbBuKTiaypp7Yy76aKzA.png" /></figure><p>Systemd Grafana Service: Enable, Start, check Status</p><pre>sudo systemctl enable grafana-server<br>sudo systemctl start grafana-server<br>sudo systemctl status grafana-server</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LO3Yx1Ng1DT1wpLy7c9EIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lj_EttxV-Kqs9j9P69vlrA.png" /></figure><p>Verify that Grafana is listening on port 3000</p><pre>ss -tulnp | grep 3000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*ioMCSsy0UPxaKTBj2PNIPg.png" /></figure><p>Open Grafana</p><pre>http://localhost:3000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A7tpIw8XaKvhx7RsVcLrbg.png" /></figure><p>Login</p><pre>Username: admin<br>Password: admin</pre><p>Grafana will ask you to change the password on the first login.</p><p>Add Prometheus as a data source</p><pre>1) Click Connections → Data sources.<br>2) Click Add data source.<br>3) Select Prometheus.<br>4) Set the URL to:<br>http://localhost:9090<br>5) Click Save &amp; Test.<br>Expected message:<br>Successfully queried the Prometheus API.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BkqGBMiSQzF_NRndLF7KkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rS0vDZH2s4GeD_AnlOy32w.png" /></figure><p>Import The Node Exporter Dashboard</p><pre>1) Click Dashboards → New → Import.<br>2) Enter dashboard ID: 1860<br>3) Click Load.<br>4) Select your Prometheus data source.<br>5) Click Import.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8q8l43Fulp1SxQOi8Tg2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zG0XI2HpD0J9ttAuA4I2Xw.png" /></figure><h3><strong>Lab 6: Alertmanager Installation Plan</strong></h3><p>We’ll do the following:</p><ol><li>Download Alertmanager</li><li>Create the alertmanager user</li><li>Create the required directories</li><li>Copy the binaries</li><li>Configure alertmanager.yml</li><li>Create the systemd service</li><li>Start Alertmanager</li><li>Connect Prometheus to Alertmanager</li><li>Create alert rules</li><li>Test email alerts</li></ol><p>Create an Alertmanager user</p><pre>sudo useradd --no-create-home --shell /usr/sbin/nologin alertmanager</pre><p>Download Alertmanager</p><pre>wget https://github.com/prometheus/alertmanager/releases/download/v0.28.1/alertmanager-0.28.1.linux-amd64.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ED0YIWt-xXuRK3vmgY_i9A.png" /></figure><p>Extract the package</p><pre>tar -xvf alertmanager-0.28.1.linux-amd64.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k-iWT7Zk6XOzfDVehsmCIQ.png" /></figure><p>Enter the directory</p><pre>cd alertmanager-0.28.1.linux-amd64<br>ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*MOUKuj9k2UKsssfnFhB95Q.png" /></figure><p>Create the required directories</p><pre>sudo mkdir -p /etc/alertmanager<br>sudo mkdir -p /var/lib/alertmanager</pre><p>Copy the binaries</p><pre>sudo cp alertmanager /usr/local/bin/<br>sudo cp amtool /usr/local/bin/</pre><p>Copy the configuration</p><pre>sudo cp alertmanager.yml /etc/alertmanager/</pre><p>Set ownership</p><pre>sudo chown -R alertmanager:alertmanager /etc/alertmanager<br>sudo chown -R alertmanager:alertmanager /var/lib/alertmanager<br>sudo chown alertmanager:alertmanager /usr/local/bin/alertmanager<br>sudo chown alertmanager:alertmanager /usr/local/bin/amtool</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*9U2qNtYP7x6rN3dOegKTJg.png" /></figure><p>Create the systemd service</p><pre>sudo vi /etc/systemd/system/alertmanager.service</pre><pre>[Unit]<br>Description=Prometheus Alertmanager<br>Documentation=https://prometheus.io/docs/alerting/latest/alertmanager/<br>Wants=network-online.target<br>After=network-online.target<br>[Service]<br>User=alertmanager<br>Group=alertmanager<br>Type=simple<br>ExecStart=/usr/local/bin/alertmanager \<br> - config.file=/etc/alertmanager/alertmanager.yml \<br> - storage.path=/var/lib/alertmanager<br>Restart=on-failure<br>[Install]<br>WantedBy=multi-user.target</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*JE-9h3Hog3buwZZknjH82Q.png" /></figure><p>Systemd Service: Reload, Enable, Start, then Check Statusd</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable alertmanager<br>sudo systemctl start alertmanager<br>sudo systemctl status alertmanager</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*6Q1C6HFxaIJ_nAT8j95BJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLecrbPwO1t7mhEIFfOuYA.png" /></figure><p>Verify the port</p><pre>ss -tulnp | grep 9093</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*gyo981IzWgaRY8WiK6G-yQ.png" /></figure><p>Open Alertmanager</p><pre>http://localhost:9093</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVaDnjDtqgY4Be_Eex3Aug.png" /></figure><p>Configure Gmail</p><pre>sudo vi /etc/alertmanager/alertmanager.yml</pre><p>Replace its contents with:</p><pre>global:<br>  smtp_smarthost: &#39;smtp.gmail.com:587&#39;<br>  smtp_from: &#39;pawarkartik876@gmail.com&#39;<br>  smtp_auth_username: &#39;pawarkartik876@gmail.com&#39;<br>  smtp_auth_password: &#39;YOUR_16_CHARACTER_APP_PASSWORD&#39;<br>  smtp_require_tls: true<br><br>route:<br>  receiver: &#39;gmail&#39;<br>  group_by:<br>    - alertname<br>    - server<br>  group_wait: 10s<br>  group_interval: 30s<br>  repeat_interval: 30m<br><br>receivers:<br>  - name: &#39;gmail&#39;<br>    email_configs:<br>      - to: &#39;kartikpawar1290@gmail.com&#39;<br>        from: &#39;pawarkartik876@gmail.com&#39;<br>        smarthost: &#39;smtp.gmail.com:587&#39;<br>        auth_username: &#39;pawarkartik876@gmail.com&#39;<br>        auth_password: &#39;YOUR_16_CHARACTER_APP_PASSWORD&#39;<br>        require_tls: true<br>        send_resolved: true<br>        headers:<br>          Subject: &#39;[{{ .Status | toUpper }}] {{ .CommonLabels.alertname }} | {{ .CommonLabels.server }}&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*fBgdaEY4SH-uSQwfPnSOqw.png" /></figure><p>Validate the configuration</p><pre>amtool check-config /etc/alertmanager/alertmanager.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*QDHJ0z-S8pLCSVMmB5WWZw.png" /></figure><p>Restart ans check status of Alertmanager</p><pre>sudo systemctl restart alertmanager<br>sudo systemctl status alertmanager</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jk8oZLwJzNK0ik7OCUn4NQ.png" /></figure><p>Configure Prometheus to use Alertmanager</p><pre>sudo vi /etc/prometheus/prometheus.yml</pre><pre>global:<br>  scrape_interval: 15s<br>  evaluation_interval: 15s<br><br>alerting:<br>  alertmanagers:<br>    - static_configs:<br>        - targets:<br>            - localhost:9093<br><br>rule_files:<br>  - &quot;/etc/prometheus/alert_rules.yml&quot;<br><br>scrape_configs:<br><br>  - job_name: &quot;prometheus&quot;<br>    static_configs:<br>      - targets: [&quot;localhost:9090&quot;]<br>        labels:<br>          server: &quot;Prometheus Server&quot;<br>          environment: &quot;Lab&quot;<br><br>  - job_name: &quot;ubuntu-wsl&quot;<br>    static_configs:<br>      - targets: [&quot;localhost:9100&quot;]<br>        labels:<br>          server: &quot;Ubuntu WSL&quot;<br>          environment: &quot;Lab&quot;<br><br>  - job_name: &quot;redhat&quot;<br>    static_configs:<br>      - targets: [&quot;192.168.199.128:9100&quot;]   # Change if your Red Hat IP changes<br>        labels:<br>          server: &quot;Red Hat Server&quot;<br>          environment: &quot;Lab&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*nlE1tGMf3yjVM3I2x-EA_w.png" /></figure><p>Create the alert rules file</p><pre>sudo vi /etc/prometheus/alert_rules.yml</pre><pre>groups:<br>  - name: ServerAlerts<br>    rules:<br><br>      #####################################################<br>      # INSTANCE DOWN<br>      #####################################################<br><br>      - alert: InstanceDown<br>        expr: up == 0<br>        for: 1m<br>        labels:<br>          severity: critical<br>        annotations:<br>          summary: &quot;{{ $labels.server }} is DOWN&quot;<br>          description: |<br>            Server       : {{ $labels.server }}<br>            Instance     : {{ $labels.instance }}<br>            Environment  : {{ $labels.environment }}<br><br>            Prometheus cannot reach this server.<br><br>      #####################################################<br>      # HIGH CPU USAGE<br>      #####################################################<br><br>      - alert: HighCPUUsage<br>        expr: (100 - (avg by(instance,server)(rate(node_cpu_seconds_total{mode=&quot;idle&quot;}[2m])) * 100)) &gt; 90<br>        for: 2m<br>        labels:<br>          severity: critical<br>        annotations:<br>          summary: &quot;High CPU Usage on {{ $labels.server }}&quot;<br>          description: |<br>            Server       : {{ $labels.server }}<br>            Instance     : {{ $labels.instance }}<br><br>            CPU Usage has exceeded 90%.<br><br>            Current Value : {{ printf &quot;%.2f&quot; $value }} %<br><br>      #####################################################<br>      # HIGH MEMORY USAGE<br>      #####################################################<br><br>      - alert: HighMemoryUsage<br>        expr: ((1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100) &gt; 85<br>        for: 2m<br>        labels:<br>          severity: warning<br>        annotations:<br>          summary: &quot;High Memory Usage on {{ $labels.server }}&quot;<br>          description: |<br>            Server       : {{ $labels.server }}<br>            Instance     : {{ $labels.instance }}<br><br>            Memory Usage has exceeded 85%.<br><br>            Current Value : {{ printf &quot;%.2f&quot; $value }} %<br><br>      #####################################################<br>      # HIGH DISK USAGE<br>      #####################################################<br><br>      - alert: HighDiskUsage<br>        expr: ((node_filesystem_size_bytes{mountpoint=&quot;/&quot;,fstype!~&quot;tmpfs|overlay|squashfs|fuse.snapfuse&quot;} - node_filesystem_free_bytes{mountpoint=&quot;/&quot;,fstype!~&quot;tmpfs|overlay|squashfs|fuse.snapfuse&quot;}) / node_filesystem_size_bytes{mountpoint=&quot;/&quot;,fstype!~&quot;tmpfs|overlay|squashfs|fuse.snapfuse&quot;}) * 100 &gt; 90<br>        for: 2m<br>        labels:<br>          severity: warning<br>        annotations:<br>          summary: &quot;High Disk Usage on {{ $labels.server }}&quot;<br>          description: |<br>            Server       : {{ $labels.server }}<br>            Instance     : {{ $labels.instance }}<br><br>            Disk Usage has exceeded 90%.<br><br>            Current Value : {{ printf &quot;%.2f&quot; $value }} %</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gaXvcgnX5tAB_UpCqjB2UA.png" /></figure><p>Check the Prometheus configuration</p><pre>promtool check config /etc/prometheus/prometheus.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jNIWUOXzdJ9OPO8PjKXgZQ.png" /></figure><p>Check the alert rules</p><pre>promtool check rules /etc/prometheus/alert_rules.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*6WIg5S9nwT0_FfXA9K1ZWA.png" /></figure><p>Restart Prometheus</p><pre>sudo systemctl restart prometheus</pre><p>Verify Prometheus</p><pre>sudo systemctl status prometheus</pre><p>Check the Targets</p><pre>http://localhost:9090/targets</pre><p>Check Alertmanager</p><pre>http://localhost:9093</pre><p>Check Alerts</p><pre>http://localhost:9090/alerts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Sw2pMbbtivdnZtyl7qaBA.png" /></figure><p>Test Email<br>A quick way to test the <strong>InstanceDown</strong> alert is:</p><pre>sudo systemctl stop node_exporter</pre><p>After about <strong>1 minute</strong>, Prometheus should mark the target as <strong>DOWN</strong>, send the alert to Alertmanager, and Alertmanager should email:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*GphN5RV3FD_lyTERWJcZzg.png" /></figure><p>Now start the node_exporter</p><pre>sudo systemctl start node_exporter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*9sP6EikiMvBJje8SHjTL0w.png" /></figure><h3>Conclusion</h3><p>This project successfully implemented a centralized infrastructure monitoring and alerting solution using <strong>Prometheus</strong>, <strong>Grafana</strong>, <strong>Alertmanager</strong>, and <strong>Node Exporter</strong>. The monitoring server was deployed on <strong>Ubuntu WSL</strong>, while a <strong>Red Hat Virtual Machine</strong> was configured as the monitored server.</p><p>Prometheus continuously collects system metrics from both the Ubuntu WSL and Red Hat servers using Node Exporter. Grafana provides real-time dashboards for visualizing these metrics, enabling effective monitoring of system performance. Alertmanager processes alerts generated by Prometheus and sends email notifications through Gmail SMTP, ensuring that critical issues are reported immediately.</p><p>The solution was tested by generating alerts for scenarios such as server unavailability, high CPU usage, high memory usage, and high disk usage. Email notifications were successfully delivered with detailed information, including the server name, alert type, severity, and current metric value.</p><p>This implementation demonstrates a reliable, scalable, and production-oriented monitoring solution that can be extended to monitor additional servers and services.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d2281dc9348" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure DevOps Ci/cd + GitOps Documentation]]></title>
            <link>https://medium.com/@kartikpawar1290/azure-devops-ci-cd-gitops-documentation-f1a85e3e33ce?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1a85e3e33ce</guid>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[gitops-with-argocd]]></category>
            <category><![CDATA[cicd-pipeline]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[azure-devops]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Sun, 26 Apr 2026 19:22:44 GMT</pubDate>
            <atom:updated>2026-09-14T05:44:16.176Z</atom:updated>
            <content:encoded><![CDATA[<h3>🚀 Cloud-Native DevOps Pipeline: Azure DevOps → AKS → Argo CD (GitOps)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-TjhPB6IccMSciagAR2jw.png" /></figure><h3>📌 1. Solution Overview</h3><p>A production-style, end-to-end DevOps setup that builds, packages, and deploys a <strong>microservices application</strong> using:</p><ul><li><strong>Azure DevOps</strong> (CI with reusable YAML templates)</li><li><strong>Docker + Azure Container Registry (ACR)</strong> (image management)</li><li><strong>Azure Kubernetes Service (AKS)</strong> (runtime platform)</li><li><strong>Argo CD</strong> (GitOps-based continuous delivery)</li></ul><h3>🧩 Services</h3><ul><li>🐍 <strong>vote-service</strong> (Python UI)</li><li>⚙️ <strong>worker-service</strong> (.NET background processor)</li><li>🌐 <strong>result-service</strong> (Node.js UI)</li><li>⚡ <strong>redis</strong> (queue/cache)</li><li>🐘 <strong>postgres</strong> (database)</li></ul><h3>🏗️ 2. Delivery Flow</h3><pre>Commit → Azure Repos → CI (Build+Push) → ACR → Git Update → Argo CD → AKS</pre><h3>⚙️ 3. DevOps Project Bootstrap</h3><h3>🆕 3.1 Create DevOps Project</h3><ul><li><strong>Name:</strong> cloud-voting-platform</li><li><strong>Visibility:</strong> Private</li></ul><h3>🔁 3.2 Import Source (Direct Import)</h3><ul><li>Repos → <strong>Import Repository</strong> → Git → Paste URL → <strong>Import</strong></li></ul><h3>🌐 Source Repository (GitHub)</h3><p>👉 <strong>Project Repository:</strong></p><pre>https://github.com/Kartikpawar143/Voting-App-Azure-DevOps-Project.git</pre><blockquote><em>This is the source repository containing:</em></blockquote><ul><li>Microservices code (vote, result, worker)</li><li>Dockerfiles</li><li>Kubernetes manifests (k8s-specifications)</li><li>Pipeline scripts</li></ul><h3>🔐 3.3 Add Private GitHub Repository using PAT (Recommended)</h3><p>Use a <strong>GitHub Personal Access Token (PAT)</strong> to securely import private repositories into Azure DevOps.</p><h3>🔧 Step 1: Create GitHub PAT</h3><ol><li>Go to <strong>GitHub → Settings → Developer Settings → Personal Access Tokens</strong></li><li>Click <strong>Generate new token</strong></li><li>Configure:</li></ol><ul><li><strong>Name:</strong> azure-devops-access</li><li><strong>Expiration:</strong> As needed</li><li><strong>Scopes:</strong></li><li>✅ repo (required for private repositories)</li></ul><ol><li>Click <strong>Generate Token</strong></li><li>Copy the token (⚠️ shown only once)</li></ol><h3>🔗 Step 2: Import into Azure DevOps using PAT</h3><ol><li>Go to <strong>Azure DevOps → Repos</strong></li><li>Click <strong>Import Repository</strong></li><li>Select:</li></ol><ul><li><strong>Repository Type:</strong> Git</li></ul><p>4. Paste GitHub repo URL:</p><ul><li>https://github.com/&lt;username&gt;/&lt;repo&gt;.git</li></ul><p>5. Authentication will be required:</p><ul><li><strong>Username:</strong> your GitHub username</li><li><strong>Password:</strong> paste the <strong>PAT token</strong></li></ul><p>6. Click <strong>Import</strong></p><h3>🎯 Outcome</h3><ul><li>Private GitHub repo successfully imported into Azure DevOps</li><li>Secure authentication using PAT</li><li>Ready for CI/CD pipelines</li></ul><h3>☁️ 4. Azure Foundation</h3><h3>📦 4.1 Resource Group</h3><ul><li>cloud-voting-platform-rg</li></ul><h3>📦 4.2 Container Registry</h3><ul><li>cloudvotingacr</li></ul><h3>🖥️ 4.3 Build Agent VM (Self-Hosted)</h3><ul><li>VM: devops-agent-vm (SSH key)</li></ul><h3>🤖 5. Build Agent (Self-Hosted) Setup</h3><h3>🧱 5.1 Create Agent Pool (Azure DevOps UI)</h3><blockquote><em>Create the agent pool </em><strong><em>before</em></strong><em> configuring the VM agent.</em></blockquote><p><strong>Steps:</strong></p><ol><li>Go to <strong>Azure DevOps → Project Settings</strong></li><li>Click <strong>Agent Pools</strong></li><li>Click <strong>Add Pool</strong></li><li>Configure:</li></ol><ul><li><strong>Pool Type:</strong> Self-hosted</li><li><strong>Name:</strong> devops-agent-pool</li><li><strong>Description:</strong> Self-hosted pool for CI pipelines</li><li>Enable <strong>Grant access permission to all pipelines</strong> (optional but recommended)</li></ul><p>5. Click <strong>Create</strong></p><h4>✅ Outcome</h4><ul><li>Agent pool devops-agent-pool is created</li><li>Ready to register agents from VM</li></ul><h3>🔐 5.2 Create Personal Access Token (PAT)</h3><blockquote><em>Required to authenticate the VM agent with Azure DevOps</em></blockquote><p><strong>Steps:</strong></p><ol><li>Go to <strong>Azure DevOps → User Settings (Top Right)</strong></li><li>Click <strong>Personal Access Tokens</strong></li><li>Click <strong>New Token</strong></li><li>Configure:</li></ol><ul><li><strong>Name:</strong> devops-agent-token</li><li><strong>Organization:</strong> Select your org</li><li><strong>Expiration:</strong> Choose suitable duration</li><li><strong>Scopes:</strong> Select <strong>Full Access</strong> (for learning/demo)</li></ul><p>5. Click <strong>Create</strong></p><p>6.Copy the token (it will not be shown again)</p><h4>✅ Outcome</h4><ul><li>PAT created successfully</li><li>Used during agent configuration (./config.sh)</li></ul><h3>🧱 5.3 Register Agent on VM</h3><h3>⚙️ Install Agent</h3><pre>mkdir myagent<br>cd myagent<br>wget https://download.agent.dev.azure.com/agent/4.271.0/vsts-agent-linux-x64-4.271.0.tar.gz<br>sudo apt update<br>tar zxvf vsts-agent-linux-x64-4.271.0.tar.gz<br>./config.sh</pre><h3>🔐 Inputs</h3><ul><li>Org URL</li><li>Authentication Type: PAT</li><li>Paste PAT Token</li><li>Agent Pool: devops-agent-pool</li></ul><h3>🧠 Add Swap Memory (Recommended for Low-CPU VMs)</h3><blockquote><em>Helps prevent pipeline failures (e.g., Docker builds) due to </em><strong><em>out-of-memory (OOM)</em></strong><em> on small VM sizes.</em></blockquote><pre># Create a 2GB swap file<br>sudo fallocate -l 2G /swapfile<br># Set correct permissions<br>sudo chmod 600 /swapfile<br># Set up swap area<br>sudo mkswap /swapfile<br># Enable swap<br>sudo swapon /swapfile<br># Make it permanent<br>echo &#39;/swapfile none swap sw 0 0&#39; | sudo tee -a /etc/fstab<br># Verify<br>free -h</pre><h4>✅ Why we use Swap</h4><ul><li>🛑 Prevents <strong>pipeline crashes</strong> due to low memory</li><li>🐳 Docker builds can be <strong>memory intensive</strong></li><li>💻 Small VM sizes (B-series) have limited RAM</li><li>⚡ Swap acts as <strong>backup memory</strong> using disk space</li></ul><blockquote><em>Note: Swap is slower than RAM, but ensures stability during CI jobs.</em></blockquote><h3>🐳 Docker Runtime</h3><pre>sudo apt install docker.io -y<br>sudo usermod -aG docker azureuser<br>sudo systemctl restart docker<br>newgrp docker</pre><h3>▶️ Start Agent (after Docker install)</h3><pre>./run.sh</pre><h3>🔗 5.4 Create Service Connection (ACR) in Azure DevOps</h3><blockquote><em>Required for pipelines to </em><strong><em>authenticate and push images</em></strong><em> to Azure Container Registry.</em></blockquote><p><strong>Steps:</strong></p><ol><li>Go to <strong>Azure DevOps → Project Settings</strong></li><li>Click <strong>Service Connections</strong></li><li>Click <strong>New Service Connection</strong></li><li>Select <strong>Docker Registry</strong> (or <strong>Azure Container Registry</strong>)</li><li>Choose <strong>Azure Container Registry</strong></li><li><strong>Authentication Type:</strong> ✅ <strong>Service Principal (Automatic)</strong></li><li>Select your subscription</li><li>Select registry: cloudvotingacr</li><li>Give name: acr-connection</li><li>Enable <strong>Grant access permission to all pipelines</strong></li><li>Click <strong>Save</strong></li></ol><h4>✅ Outcome</h4><ul><li>Secure connection created between Azure DevOps and ACR</li><li>Used in pipeline via:</li></ul><pre>containerRegistry: $(dockerRegistryServiceConnection)</pre><h3>🔄 6. CI Design (Reusable Template)</h3><h3>📄 pipelines/ci-template.yml (Final: Build + Push + Update + Commit + Restart)</h3><pre>parameters:<br>- name: serviceName<br>  type: string<br><br>- name: servicePath<br>  type: string<br><br>variables:<br>  acrLoginServer: &#39;cloudvotingacr.azurecr.io&#39;<br>  imageRepository: &#39;${{ parameters.serviceName }}&#39;<br>  tag: &#39;$(Build.BuildId)&#39;<br><br>stages:<br>- stage: BuildPushAndUpdate<br>  displayName: Build, Push &amp; Update<br><br>  jobs:<br>  - job: BuildPushUpdate<br>    pool:<br>      name: &#39;devops-agent-pool&#39;<br><br>    steps:<br><br>    - checkout: self<br>      persistCredentials: true<br><br>    # 🔥 Build &amp; Push (force fresh image)<br>    - task: Docker@2<br>      displayName: Build and Push Image<br>      inputs:<br>        command: buildAndPush<br>        repository: $(imageRepository)<br>        dockerfile: $(Build.SourcesDirectory)/${{ parameters.servicePath }}/Dockerfile<br>        containerRegistry: &#39;acr-connection&#39;<br>        tags: |<br>          $(tag)<br>        arguments: --no-cache<br><br>    # 🔥 Update manifest<br>    - script: |<br>        sed -i &#39;s/\r$//&#39; $(Build.SourcesDirectory)/scripts/updatek8smanifest.sh<br>        chmod +x $(Build.SourcesDirectory)/scripts/updatek8smanifest.sh<br><br>        bash $(Build.SourcesDirectory)/scripts/updatek8smanifest.sh \<br>        ${{ parameters.serviceName }} \<br>        $(acrLoginServer)/$(imageRepository) \<br>        $(tag)<br>      displayName: Update Manifest<br><br>    # 🔥 Commit YAML<br>    - script: |<br>        cd $BUILD_SOURCESDIRECTORY<br><br>        git config user.email &quot;devops@azure.com&quot;<br>        git config user.name &quot;azure-pipeline&quot;<br><br>        git stash || echo &quot;Nothing to stash&quot;<br>        git pull origin main --rebase<br>        git stash pop || echo &quot;Nothing to pop&quot;<br><br>        git add k8s-specifications/${{ parameters.serviceName }}-deployment.yaml<br>        git commit -m &quot;[skip ci] Update ${{ parameters.serviceName }} image to $(tag)&quot; || echo &quot;No changes&quot;<br><br>        git push origin HEAD:main<br>      displayName: Commit YAML<br><br>    # 🔥 Restart deployment<br>    - script: |<br>        kubectl rollout restart deployment ${{ parameters.serviceName }} || true<br>      displayName: Restart Deployment</pre><h3>🧩 scripts/updatek8smanifest.sh (GitOps Updater - Updated)</h3><pre>#!/bin/bash<br><br>set -e<br><br>SERVICE_NAME=$1<br>IMAGE_NAME=$2<br>TAG=$3<br><br>echo &quot;========================================&quot;<br>echo &quot;Updating YAML for $SERVICE_NAME&quot;<br>echo &quot;New image: $IMAGE_NAME:$TAG&quot;<br>echo &quot;========================================&quot;<br><br>FILE=&quot;$BUILD_SOURCESDIRECTORY/k8s-specifications/${SERVICE_NAME}-deployment.yaml&quot;<br><br>echo &quot;Target file: $FILE&quot;<br><br># ✅ Check file exists<br><br>if [ ! -f &quot;$FILE&quot; ]; then<br>echo &quot;ERROR: File not found!&quot;<br>exit 1<br>fi<br><br># 🔥 STEP 1: Update YAML image<br><br>echo &quot;Updating image in YAML...&quot;<br>sed -i &quot;s|image: .*${SERVICE_NAME}:.*|image: ${IMAGE_NAME}:${TAG}|g&quot; &quot;$FILE&quot;<br><br>echo &quot;Updated image line:&quot;<br>grep &quot;image:&quot; &quot;$FILE&quot;<br><br># 🔥 STEP 2: Apply to Kubernetes<br><br>echo &quot;Applying to Kubernetes...&quot;<br>kubectl apply -f &quot;$FILE&quot;<br><br>echo &quot;========================================&quot;<br>echo &quot;Kubernetes updated successfully!&quot;<br>echo &quot;========================================&quot;<br><br># 🔥 STEP 3: Git Sync (FIXED FLOW)<br><br>cd $BUILD_SOURCESDIRECTORY<br><br>git config user.email &quot;[devops@azure.com](devops@azure.com)&quot;<br>git config user.name &quot;azure-pipeline&quot;<br><br>echo &quot;Stashing local changes...&quot;<br>git stash || echo &quot;Nothing to stash&quot;<br><br>echo &quot;Pulling latest changes...&quot;<br>git pull origin main --rebase<br><br>echo &quot;Re-applying stashed changes...&quot;<br>git stash pop || echo &quot;Nothing to pop&quot;<br><br>echo &quot;Staging updated file...&quot;<br>git add k8s-specifications/${SERVICE_NAME}-deployment.yaml<br><br>echo &quot;Committing changes...&quot;<br>git commit -m &quot;[skip ci] Update ${SERVICE_NAME} image to ${TAG}&quot; || echo &quot;No changes to commit&quot;<br><br>echo &quot;Pushing to repository...&quot;<br>git push origin HEAD:main<br><br>echo &quot;========================================&quot;<br>echo &quot;YAML updated + pushed successfully!&quot;<br>echo &quot;========================================&quot;</pre><h4>🧠 What this script does</h4><ul><li>🔄 <strong>Pulls latest code</strong> to avoid merge conflicts</li><li>🐳 <strong>Updates the image tag</strong> in the correct Kubernetes deployment YAML</li><li>📝 <strong>Commits the change</strong> back to the repository</li><li>🚀 <strong>Pushes to main branch</strong>, triggering Argo CD sync</li></ul><h4>🔁 End-to-End Flow</h4><pre>Build → Push Image → Update YAML → Git Push → Argo CD Sync → AKS Deploy</pre><h4>⚠️ Important Notes</h4><ul><li>File path must match: k8s-specifications/&lt;service&gt;-deployment.yaml</li><li>Requires persistCredentials: true in pipeline</li><li>Uses SYSTEM_ACCESSTOKEN for authentication</li><li>Ensures <strong>GitOps automation</strong> (no manual deployment)</li></ul><h3>🔐 6.2 Grant Repository Permissions for Pipeline (Very Important)</h3><blockquote><em>Required to allow the pipeline to </em><strong><em>push changes back to the repository</em></strong><em> using </em><em>System.AccessToken.</em></blockquote><h3>🔧 Step-by-Step: How to Give Permission</h3><ol><li>Go to <strong>Azure DevOps → Project Settings</strong></li><li>Click <strong>Repositories</strong></li><li>Select your repository:</li></ol><ul><li>cloud-voting-platform</li></ul><p>4. Open <strong>Security</strong> tab</p><h3>👤 Select Build Service User</h3><p>Search and select:</p><p>👉 <strong>Project Collection Build Service (cloud-voting-platform)</strong></p><h3>✅ Enable Required Permissions</h3><p>Set the following:</p><ul><li><strong>Read</strong> → Allow ✅</li><li><strong>Contribute</strong> → Allow ✅</li></ul><p>Click <strong>Save</strong></p><h3>🔄 What Happens After This</h3><pre>Pipeline runs<br>   ↓<br>Uses System.AccessToken<br>   ↓<br>Acts as Build Service identity<br>   ↓<br>Pushes changes to repo successfully)</pre><h3>🌐 result-service</h3><h4>🧭 Create Result Pipeline (Azure DevOps UI)</h4><ol><li>Go to <strong>Pipelines → New Pipeline</strong></li><li>Select <strong>Azure Repos Git</strong></li><li>Select repo: cloud-voting-platform</li><li>Choose <strong>Starter pipeline</strong></li><li>Replace YAML with below</li><li>Click <strong>Save and Run</strong> (branch: main)</li></ol><pre>trigger:<br>  branches:<br>    include: [ main ]<br>  paths:<br>    include: [ result/** ]<br>extends:<br>  template: pipelines/ci-template.yml<br>  parameters:<br>    serviceName: &#39;result&#39;<br>    servicePath: &#39;result&#39;</pre><h3>🗳️ vote-service</h3><h4>🧭 Create Vote Pipeline (Azure DevOps UI)</h4><ol><li>Go to <strong>Pipelines → New Pipeline</strong></li><li>Select <strong>Azure Repos Git</strong></li><li>Select repo: cloud-voting-platform</li><li>Choose <strong>Starter pipeline</strong></li><li>Replace YAML with below</li><li>Click <strong>Save and Run</strong> (branch: main)</li></ol><pre>trigger:<br>  branches:<br>    include: [ main ]<br>  paths:<br>    include: [ vote/** ]<br>extends:<br>  template: pipelines/ci-template.yml<br>  parameters:<br>    serviceName: &#39;vote&#39;<br>    servicePath: &#39;vote&#39;</pre><h3>⚙️ worker-service</h3><h4>🧭 Create Worker Pipeline (Azure DevOps UI)</h4><ol><li>Go to <strong>Pipelines → New Pipeline</strong></li><li>Select <strong>Azure Repos Git</strong></li><li>Select repo: cloud-voting-platform</li><li>Choose <strong>Starter pipeline</strong></li><li>Replace YAML with below</li><li>Click <strong>Save and Run</strong> (branch: main)</li></ol><pre>trigger:<br>  branches:<br>    include: [ main ]<br>  paths:<br>    include: [ worker/** ]<br>extends:<br>  template: pipelines/ci-template.yml<br>  parameters:<br>    serviceName: &#39;worker&#39;<br>    servicePath: &#39;worker&#39;</pre><h3>☸️ 7. AKS Cluster Provisioning (Step-by-Step)</h3><blockquote><em>Provision a Kubernetes cluster to run the microservices.</em></blockquote><h3>🧭 7.1 Create AKS Cluster (Azure Portal)</h3><ol><li>Go to <strong>Azure Portal → Kubernetes Services</strong></li><li>Click <strong>Create → Kubernetes Cluster</strong></li></ol><h3>⚙️ 7.2 Basics</h3><ul><li><strong>Subscription:</strong> Your active subscription</li><li><strong>Resource Group:</strong> cloud-voting-platform-rg</li><li><strong>Cluster Name:</strong> cloud-voting-aks</li><li><strong>Region:</strong> Same as other resources (e.g., Central India)</li><li><strong>Availability Zones:</strong> ✅ Enable (for high availability)</li></ul><p>Click <strong>Next: Node pools</strong></p><h3>⚠️ 7.3 Node Pool Configuration (Fix Quota Issues)</h3><blockquote><em>Default node pool may fail due to CPU quota limits.</em></blockquote><ul><li><strong>Delete the default node pool</strong></li></ul><h4>➕ Add New Node Pool</h4><ul><li>Click <strong>Add node pool</strong></li><li><strong>Name:</strong> systempool</li><li><strong>Mode:</strong> System</li><li><strong>Node size:</strong> Standard_B2pls_v2 (B-series, cost-efficient)</li><li><strong>Node count:</strong> 1 (for demo)</li><li>Click <strong>Add</strong></li></ul><h3>🔁 Update Node Pool Settings (Important Step)</h3><blockquote><em>After adding the node pool, you must enable public IP from settings.</em></blockquote><ol><li>Go back to <strong>Node Pools section</strong></li><li>Select the newly created node pool (systempool)</li><li>Click on <strong>Settings / Configuration</strong></li><li>Enable:</li></ol><ul><li>✅ <strong>Public IP per node</strong></li></ul><p>5. Click <strong>Update / Save</strong></p><blockquote><em>This is required to access services like </em><strong><em>Argo CD via NodePort</em></strong></blockquote><p>Click <strong>Next: Access</strong></p><h3>✅ 7.4 Review &amp; Create</h3><ul><li>Validate configuration</li><li>Click <strong>Create</strong></li></ul><h3>🛑 7.5 Common Error &amp; Fix (Public IP Permission Issue)</h3><h3>❌ Error</h3><pre>Client does not have permission to perform Microsoft.Network/publicIPAddresses/write</pre><h3>🧠 Cause</h3><ul><li>AKS tries to create <strong>Public IPs</strong> in the auto-created resource group:</li><li>MC_&lt;rg&gt;_&lt;aks&gt;_&lt;region&gt;</li><li>Your account does NOT have <strong>Network Contributor</strong> permission on that resource group</li></ul><h3>✅ Solution (Recommended) — Assign Permission</h3><ol><li>Go to <strong>Azure Portal</strong></li><li>Open Resource Group:</li></ol><ul><li>MC_cloud-voting-platform-rg_cloud-voting-aks_&lt;region&gt;</li></ul><ol><li>Go to <strong>Access Control (IAM)</strong></li><li>Click <strong>Add Role Assignment</strong></li><li>Select Role: <strong>Network Contributor</strong></li><li>Assign to your user account</li><li>Click <strong>Save</strong></li></ol><p>👉 Now retry AKS creation or update node pool</p><h3>🧰 7.6 Install Azure CLI (az) &amp; kubectl</h3><blockquote><em>Required to interact with Azure and AKS from terminal.</em></blockquote><h3>🔧 Install Azure CLI (az)</h3><pre>curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash</pre><h3>✅ Verify Installation</h3><pre>az version</pre><h3>🔧 Install kubectl</h3><pre>curl -LO &quot;https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl&quot;<br>chmod +x kubectl<br>sudo mv kubectl /usr/local/bin/</pre><h3>✅ Verify</h3><pre>kubectl version --client</pre><h3>🔗 7.7 Attach ACR to AKS (Allow Image Pull)</h3><blockquote><em>Grant AKS permission to pull images from Azure Container Registry.</em></blockquote><h3>✅ Method 1 (Simple — Recommended)</h3><p>Run this command from your terminal (Azure CLI):</p><pre>az login<br>az aks update --name cloud-voting-aks --resource-group cloud-voting-platform-rg --attach-acr cloudvotingacr</pre><h3>🔐 Method 2 (Manual Role Assignment — Advanced)</h3><pre>AKS_ID=$(az aks show --name cloud-voting-aks --resource-group cloud-voting-platform-rg --query &quot;identity.principalId&quot; -o tsv) &amp;&amp; \<br>ACR_ID=$(az acr show --name cloudvotingacr --query &quot;id&quot; -o tsv) &amp;&amp; \<br>az role assignment create --assignee $AKS_ID --role AcrPull --scope $ACR_ID</pre><h4>🧠 Why Method 2?</h4><ul><li>Gives explicit <strong>AcrPull role</strong> to AKS</li><li>Useful when --attach-acr fails due to permission issues</li><li>More control in enterprise environments</li></ul><h4>⚠️ Note</h4><ul><li>Both methods achieve the same goal</li><li>Use Method 1 for simplicity, Method 2 for troubleshooting</li></ul><h4>🎯 Outcome</h4><ul><li>AKS can pull images from ACR</li><li>Avoids errors like ImagePullBackOff</li><li>Secure and production-ready setup</li></ul><h3>🎯 7.8 Outcome</h3><ul><li>AKS cluster cloud-voting-aks created</li><li>Custom <strong>system node pool</strong> using Standard_B2pls_v2</li><li>Permissions configured correctly (no network errors)</li><li>Ready to deploy workloads via <strong>kubectl</strong> and <strong>Argo CD</strong></li><li>AKS cluster cloud-voting-aks created</li><li>Custom <strong>system node pool</strong> using Standard_B2pls_v2</li><li>Ready to deploy workloads via <strong>kubectl</strong> and <strong>Argo CD</strong></li></ul><h3>🚀 8. Cluster Access &amp; Argo CD</h3><h3>📍 Where to Run These Commands</h3><blockquote><em>⚠️ These steps are </em><strong><em>NOT performed in Azure Portal UI</em></strong><em>. They must be executed in a </em><strong><em>CLI/Terminal environment</em></strong><em>.</em></blockquote><p>You can use any of the following:</p><ul><li>💻 <strong>Local Machine Terminal</strong> (PowerShell / CMD / Bash)</li><li>🖥️ <strong>Azure VM (devops-agent-vm****************************************************************************************************************************)</strong> ← Recommended for this project</li><li>🌐 <strong>Azure Cloud Shell</strong> (inside Azure Portal)</li></ul><blockquote><em>Using the </em><strong><em>same VM (devops-agent-vm)</em></strong><em> keeps your setup centralized and consistent.</em></blockquote><h3>🔗 Connect</h3><pre><br>az aks get-credentials --name cloud-voting-aks --resource-group cloud-voting-rg --overwrite-existing</pre><h3>✅ Verify</h3><pre>kubectl get nodes</pre><h3>📦 Install Argo CD</h3><pre>kubectl create namespace argocd<br>kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml</pre><h3>⏳ Pods</h3><pre>kubectl get pods -n argocd</pre><h3>🌐 Expose (NodePort)</h3><pre>kubectl patch svc argocd-server -n argocd -p &#39;{&quot;spec&quot;: {&quot;type&quot;: &quot;NodePort&quot;}}&#39;</pre><h3>🔍 Ports &amp; IP</h3><pre>kubectl get svc argocd-server -n argocd<br>kubectl get nodes -o wide</pre><h3>🔥 9. Network Rule (Critical)</h3><ul><li>Open <strong>MC_</strong>* RG → Node VM → Networking</li><li>Add inbound rule for NodePort (e.g., 31788)</li></ul><h3>🌐 10. Argo CD Access</h3><pre>http://&lt;NODE_IP&gt;:&lt;NODE_PORT&gt;</pre><h3>🔐 10.1 Login to Argo CD</h3><h3>🔑 Get Initial Admin Password</h3><pre>kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath=&quot;{.data.password}&quot; | base64 --decode</pre><p>👉 This will return the <strong>admin password</strong></p><h3>👤 Login Credentials</h3><ul><li><strong>Username:</strong> admin</li><li><strong>Password:</strong> (output from above command)</li></ul><h3>🌐 Login Steps</h3><ol><li>Open browser:</li></ol><ul><li>http://&lt;NODE_IP&gt;:&lt;NODE_PORT&gt;</li></ul><p>2. Enter:</p><ul><li>Username: admin</li><li>Password: copied password</li></ul><p>3. Click <strong>Login</strong></p><h3>⚠️ Important Notes</h3><ul><li>First login may show <strong>insecure connection warning</strong> → click <em>Proceed</em></li><li>Password is auto-generated → you can change it later</li></ul><h3>🎯 Outcome</h3><ul><li>Successfully logged into Argo CD UI</li><li>Ready to create applications and deploy using GitOps 🚀</li></ul><h3>🔗 10.2 Add Repository in Argo CD</h3><blockquote><em>Connect your Git repository so Argo CD can pull Kubernetes manifests.</em></blockquote><h3>🌐 Method 1: Add Repo via Argo CD UI (Recommended)</h3><p><strong>Steps:</strong></p><ol><li>Open <strong>Argo CD UI</strong></li><li>Go to <strong>Settings (⚙️) → Repositories</strong></li><li>Click <strong>Connect Repo</strong></li><li>choose ur connection method http/https</li><li>Fill details:</li></ol><ul><li><strong>Repository URL:</strong> <a href="https://dev.azure.com/">https://dev.azure.com/</a>//_git/</li><li><strong>Type:</strong> Git</li><li><strong>Username:</strong> (leave empty for PAT-based auth if not required)</li><li><strong>Password / Token:</strong> Paste <strong>Azure DevOps PAT</strong></li></ul><p>6. Click <strong>Connect</strong></p><h4>✅ Outcome</h4><ul><li>Repository successfully connected</li><li>Visible under <strong>Repositories</strong> list</li></ul><h3>🎯 Outcome</h3><ul><li>Git repository connected to Argo CD</li><li>Ready to create applications and enable GitOps sync</li></ul><h3>🚀 10.3 Create Argo CD Application (Deploy App)</h3><blockquote><em>Create an Argo CD Application to deploy your Kubernetes manifests from the Git repo to AKS.</em></blockquote><h3>🌐 Create via Argo CD UI (Recommended)</h3><p><strong>Steps:</strong></p><ol><li>Open <strong>Argo CD UI</strong></li><li>Click <strong>+ NEW APP</strong></li><li>Fill the details:</li></ol><h4>📌 General</h4><ul><li><strong>Application Name:</strong> cloud-voting-app</li><li><strong>Project:</strong> default</li><li>🔄 Sync Policy</li><li>Select <strong>Automatic</strong> (recommended)</li><li>Enable:</li><li>✅ <strong>Prune Resources</strong></li><li>✅ <strong>Self Heal</strong></li></ul><h4>📦 Source</h4><ul><li><strong>Repository URL:</strong> (your Azure Repo URL)</li><li><strong>Revision:</strong> HEAD (or main)</li><li><strong>Path:</strong> k8s-specifications <em>(folder where manifests are present)</em></li></ul><h4>🎯 Destination</h4><ul><li><strong>Cluster URL:</strong> <a href="https://kubernetes.default.svc/">https://kubernetes.default.svc</a></li><li><strong>Namespace:</strong> default</li></ul><p>4. Click <strong>Create</strong></p><h3>📦 10.4 Kubernetes Deployment Configuration (Image Update)</h3><blockquote><em>Ensure all deployments use the correct ACR image format.</em></blockquote><h3>🔧 Update Image Field in All Deployments</h3><p>Replace existing image values with:</p><h3>🔁 Apply for All Services</h3><h4>🐍 vote deployment</h4><pre>image: cloudvotingacr.azurecr.io/vote:latest</pre><h4>🌐 result deployment</h4><pre>image: cloudvotingacr.azurecr.io/result:latest</pre><h4>⚙️ worker deployment</h4><pre>image: cloudvotingacr.azurecr.io/worker:latest</pre><h3>⚠️ Important Notes</h3><ul><li>Image name must match <strong>ACR + serviceName</strong> used in pipeline</li><li>latest is used initially, but pipeline will update tag dynamically</li><li>Ensure imagePullSecrets are configured if ACR is private</li></ul><h3>🎯 Outcome</h3><ul><li>Kubernetes manifests point to correct ACR images</li><li>Argo CD deploys correct container versions</li><li>Fully integrated CI → CD → GitOps flow 🚀</li></ul><h3>🎯 Outcome</h3><ul><li>Argo CD pulls manifests from Git</li><li>Deploys resources to AKS</li><li>Keeps cluster in sync with Git (GitOps) 🚀</li></ul><h3>🏁 11. Project Completion Summary</h3><p>🎉 <strong>Project Status: Completed Successfully</strong></p><p>This project implements a full <strong>CI/CD + GitOps pipeline</strong> from scratch using Azure and Kubernetes.</p><h3>✅ What was achieved</h3><ul><li>🔄 Built reusable <strong>CI pipelines</strong> using Azure DevOps YAML templates</li><li>🐳 Containerized all services and pushed images to <strong>Azure Container Registry (ACR)</strong></li><li>☸️ Provisioned and configured <strong>AKS cluster</strong> with proper networking and permissions</li><li>🔗 Integrated <strong>ACR with AKS</strong> to allow secure image pulls</li><li>🤖 Set up <strong>self-hosted agent</strong> for pipeline execution</li><li>🔐 Configured <strong>Service Connections &amp; RBAC permissions</strong></li><li>📦 Automated <strong>Kubernetes manifest updates</strong> via pipeline</li><li>🔁 Implemented <strong>GitOps workflow</strong> using Argo CD</li><li>🚀 Enabled <strong>auto-deployment + self-healing</strong> via Argo CD sync</li></ul><h3>🧠 12. Key Learnings</h3><ul><li>Understanding of <strong>end-to-end DevOps lifecycle</strong></li><li>Hands-on with <strong>Azure DevOps pipelines &amp; YAML templates</strong></li><li>Deep understanding of <strong>Docker + ACR + AKS integration</strong></li><li>Practical experience with <strong>GitOps using Argo CD</strong></li><li>Troubleshooting real issues like:</li><li>ImagePullBackOff</li><li>Permission errors (RBAC)</li><li>Low memory (swap usage)</li></ul><h3>🚀 13. Future Improvements (Optional Enhancements)</h3><ul><li>🔐 Add <strong>Ingress Controller + domain + HTTPS (TLS)</strong></li><li>📊 Integrate <strong>monitoring (Prometheus + Grafana)</strong></li><li>🔍 Add <strong>logging (ELK / Azure Monitor)</strong></li><li>🧪 Add <strong>test stages in pipeline (unit/integration tests)</strong></li><li>🏗️ Multi-environment setup (Dev / Stage / Prod)</li></ul><h3>🔥 Final Outcome</h3><p>✔ CI pipeline fully automated<br>✔ CD via GitOps working<br>✔ AKS deployments running<br>✔ Zero manual deployment needed</p><p>👉 <strong>Production-style DevOps project completed 🚀</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1a85e3e33ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS ECS Fargate Staging Architecture and GitHub Actions CI/CD Multi-Region Deployment Guide for App]]></title>
            <link>https://medium.com/@kartikpawar1290/aws-ecs-fargate-staging-architecture-and-github-actions-ci-cd-multi-region-deployment-guide-for-app-6a4525247695?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a4525247695</guid>
            <category><![CDATA[production]]></category>
            <category><![CDATA[staging]]></category>
            <category><![CDATA[aws-ecs-fargate]]></category>
            <category><![CDATA[cicd-pipeline]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Thu, 19 Feb 2026 20:33:02 GMT</pubDate>
            <atom:updated>2026-09-14T05:51:54.186Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EpXXTYxO3ufA0spavFebrw.png" /></figure><p>This document provides a comprehensive overview of the App staging architecture and its GitHub Actions–based CI/CD pipeline for multi-region ECS Fargate deployments. It explains how the backend and worker services are deployed in an isolated staging environment that mirrors production, including dedicated clusters, task definitions, load balancers, certificates, and Global Accelerator configuration. The documentation also details automated Docker image builds (ARM64), multi-region Amazon ECR pushes, and controlled branch-based deployments (beta for staging and master for production). Together, these components ensure secure validation, consistent infrastructure behavior, and reliable, automated rollouts across Mumbai, Singapore, and Virginia regions using AWS services.</p><h3>Staging Deployment — ECS Fargate (Isolated Environment)</h3><h3>Overview</h3><p>This section documents the staging environment deployment of the App application using AWS ECS Fargate. The staging setup mirrors the production architecture while remaining fully isolated, allowing changes to be validated safely before promotion to production.</p><p>The staging environment was created with separate clusters, services, task definitions, a load balancer, an SSL certificate, and AWS Global Accelerator.</p><h3>Staging Resources Created</h3><h3>ECS &amp; Compute</h3><ul><li><strong>ECS Cluster:</strong> app-backend-staging-cluster</li><li><strong>Backend ECS Service:</strong> app-backend-staging-service</li><li><strong>Worker ECS Service:</strong> app-worker-staging-service</li><li><strong>Backend Task Definition:</strong> app-backend-staging</li><li><strong>Worker Task Definition:</strong> app-worker-staging</li></ul><h3>Networking &amp; Security</h3><ul><li>Dedicated Application Load Balancer for staging</li><li>Separate target groups for the backend staging service</li></ul><h3>Certificates &amp; DNS</h3><ul><li>Separate ACM certificate created for the staging domain</li><li>Certificate attached exclusively to the staging ALB</li></ul><h3>Global Traffic Management</h3><ul><li>Separate AWS Global Accelerator created for staging</li><li>Staging ALB registered as an endpoint in the staging Global Accelerator</li><li>Isolation maintained between production and staging traffic paths</li></ul><h3>Staging Architecture Characteristics</h3><ul><li>Complete isolation from production resources</li><li>Same ECS Fargate launch type as production</li><li>Independent deployment lifecycle</li><li>Safe environment for testing infrastructure, scaling behavior, and application changes</li></ul><h3>Deployment Flow (Staging)</h3><ol><li>Build and push Docker images (same images reused or staging-tagged as required).</li><li>Register staging task definitions (app-backend-staging, app-worker-staging).</li><li>Deploy the backend ECS service in app-backend-staging-cluster.</li><li>Deploy the worker ECS service with the background execution command.</li><li>Attach staging services to the staging ALB and target groups.</li><li>Validate health checks and confirm the service reaches a steady state.</li><li>Register the staging ALB with the staging Global Accelerator.</li><li>Validate end-to-end traffic flow: Global Accelerator → ALB → ECS services.</li></ol><h3>Purpose of the Staging Environment</h3><ul><li>Validate ECS task definition changes</li><li>Test scaling behavior and resource limits</li><li>Verify Global Accelerator and ALB routing</li><li>Validate certificates and HTTPS termination</li><li>Perform safe functional and performance testing before production release</li></ul><h3>CI/CD — ECS Fargate Multi-Region Deployment</h3><p>This section documents the CI/CD pipeline used to build, push, and deploy App backend and worker services across staging and production environments using GitHub Actions and Amazon ECS.</p><p>The pipeline supports:</p><ul><li>Branch-based deployments</li><li>Multi-region Docker image builds</li><li>Safe staging deployments</li><li>Controlled production rollouts</li></ul><h3>CI/CD Workflow Definition</h3><pre>name: CICD<br># =====================================================<br># 🚀 TRIGGERS<br># =====================================================<br># - beta             → STAGING deploy<br># - master   → PRODUCTION deploy<br># =====================================================<br>on:<br>  push:<br>    branches:<br>      - beta<br>      - master<br>  workflow_dispatch:<br># =====================================================<br># 🌍 GLOBAL VARIABLES<br># =====================================================<br>env:<br>  IMAGE_TAG: v${{ github.run_number }}<br>  ECR_REPO: app-backend<br># =====================================================<br># 🏗️ BUILD &amp; PUSH DOCKER IMAGES<br># =====================================================<br>jobs:<br>  build:<br>    name: Build &amp; Push Docker Images<br>    runs-on: ubuntu-latest<br>    strategy:<br>      matrix:<br>        region:<br>          - ap-south-1        # Mumbai<br>          - ap-southeast-1    # Singapore<br>          - us-east-1         # Virginia<br>    outputs:<br>      image_ap: ${{ steps.export.outputs.image_ap }}<br>      image_sg: ${{ steps.export.outputs.image_sg }}<br>      image_us: ${{ steps.export.outputs.image_us }}<br>    steps:<br>      - name: Checkout Code<br>        uses: actions/checkout@v4<br>      - name: Setup Docker Buildx<br>        uses: docker/setup-buildx-action@v3<br>      - name: Configure AWS Credentials<br>        uses: aws-actions/configure-aws-credentials@v3<br>        with:<br>          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}<br>          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>          aws-region: ${{ matrix.region }}<br>      - name: Login to Amazon ECR<br>        id: login<br>        uses: aws-actions/amazon-ecr-login@v2<br>      - name: Build &amp; Push Image<br>        run: |<br>          IMAGE_URI=${{ steps.login.outputs.registry }}/${{ env.ECR_REPO }}:${{ env.IMAGE_TAG }}<br>          docker buildx build \<br>            --platform linux/arm64 \<br>            -t $IMAGE_URI \<br>            --push \<br>            -f backend/Dockerfile backend<br>          echo &quot;IMAGE_URI=$IMAGE_URI&quot; &gt;&gt; $GITHUB_ENV<br>      - name: Export Image Output<br>        id: export<br>        run: |<br>          if [ &quot;${{ matrix.region }}&quot; = &quot;ap-south-1&quot; ]; then<br>            echo &quot;image_ap=$IMAGE_URI&quot; &gt;&gt; $GITHUB_OUTPUT<br>          elif [ &quot;${{ matrix.region }}&quot; = &quot;ap-southeast-1&quot; ]; then<br>            echo &quot;image_sg=$IMAGE_URI&quot; &gt;&gt; $GITHUB_OUTPUT<br>          else<br>            echo &quot;image_us=$IMAGE_URI&quot; &gt;&gt; $GITHUB_OUTPUT<br>          fi<br># =====================================================<br># 🔵 DEPLOY STAGING (Mumbai ONLY)<br># =====================================================<br>  deploy-staging:<br>    name: Deploy STAGING (Mumbai)<br>    runs-on: ubuntu-latest<br>    needs: build<br>    if: github.ref_name == &#39;beta&#39;<br>    strategy:<br>      matrix:<br>        include:<br>          - task_type: backend<br>            container: app-backend-staging<br>            td: app-backend-staging<br>            svc: app-backend-staging-service<br>            cluster: app-mumbai-staging-cluster<br>          - task_type: worker<br>            container: app-worker-staging<br>            td: app-worker-staging<br>            svc: app-worker-staging-service<br>            cluster: app-mumbai-staging-cluster<br>    steps:<br>      - name: Configure AWS Credentials<br>        uses: aws-actions/configure-aws-credentials@v3<br>        with:<br>          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}<br>          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>          aws-region: ap-south-1<br>      - name: Download Task Definition<br>        run: |<br>          aws ecs describe-task-definition \<br>            --task-definition ${{ matrix.td }} \<br>            --query taskDefinition \<br>          | jq &#39;del(.taskDefinitionArn,.revision,.status,.requiresAttributes,.compatibilities,.registeredAt,.registeredBy)&#39; &gt; task.json<br>      - name: Render Task Definition<br>        uses: aws-actions/amazon-ecs-render-task-definition@v1<br>        id: render<br>        with:<br>          task-definition: task.json<br>          container-name: ${{ matrix.container }}<br>          image: ${{ needs.build.outputs.image_ap }}<br>      - name: Deploy to ECS<br>        uses: aws-actions/amazon-ecs-deploy-task-definition@v1<br>        with:<br>          task-definition: ${{ steps.render.outputs.task-definition }}<br>          service: ${{ matrix.svc }}<br>          cluster: ${{ matrix.cluster }}<br>          wait-for-service-stability: true<br># =====================================================<br># 🔴 DEPLOY PRODUCTION (MULTI-REGION)<br># =====================================================<br>  deploy-production:<br>    name: Deploy PRODUCTION<br>    runs-on: ubuntu-latest<br>    needs: build<br>    if: github.ref_name == &#39;master&#39;<br>    strategy:<br>      matrix:<br>        include:<br>          - region: ap-south-1<br>            image: ${{ needs.build.outputs.image_ap }}<br>            cluster: app-mumbai-cluster<br>            container: app-backend<br>            td: app-backend<br>            svc: app-backend-service<br>          - region: ap-south-1<br>            image: ${{ needs.build.outputs.image_ap }}<br>            cluster: app-mumbai-cluster<br>            container: app-worker<br>            td: app-worker<br>            svc: app-worker-service<br>          - region: ap-southeast-1<br>            image: ${{ needs.build.outputs.image_sg }}<br>            cluster: app-singapore-cluster<br>            container: app-backend<br>            td: app-backend<br>            svc: app-backend-service<br>          - region: ap-southeast-1<br>            image: ${{ needs.build.outputs.image_sg }}<br>            cluster: app-singapore-cluster<br>            container: app-worker<br>            td: app-worker<br>            svc: app-worker-service<br>          - region: us-east-1<br>            image: ${{ needs.build.outputs.image_us }}<br>            cluster: app-virginia-cluster<br>            container: app-backend<br>            td: app-backend<br>            svc: app-backend-service<br>          - region: us-east-1<br>            image: ${{ needs.build.outputs.image_us }}<br>            cluster: app-virginia-cluster<br>            container: app-worker<br>            td: app-worker<br>            svc: app-worker-service<br>    steps:<br>      - name: Configure AWS Credentials<br>        uses: aws-actions/configure-aws-credentials@v3<br>        with:<br>          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}<br>          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>          aws-region: ${{ matrix.region }}<br>      - name: Download Task Definition<br>        run: |<br>          aws ecs describe-task-definition \<br>            --task-definition ${{ matrix.td }} \<br>            --query taskDefinition \<br>          | jq &#39;del(.taskDefinitionArn,.revision,.status,.requiresAttributes,.compatibilities,.registeredAt,.registeredBy)&#39; &gt; task.json<br>      - name: Render Task Definition<br>        uses: aws-actions/amazon-ecs-render-task-definition@v1<br>        id: render<br>        with:<br>          task-definition: task.json<br>          container-name: ${{ matrix.container }}<br>          image: ${{ matrix.image }}<br>      - name: Deploy to ECS<br>        uses: aws-actions/amazon-ecs-deploy-task-definition@v1<br>        with:<br>          task-definition: ${{ steps.render.outputs.task-definition }}<br>          service: ${{ matrix.svc }}<br>          cluster: ${{ matrix.cluster }}<br>          wait-for-service-stability: true</pre><h3>Scope Covered</h3><ul><li>Isolated staging environment using ECS Fargate</li><li>Separate staging ECS clusters, services, and task definitions</li><li>Dedicated staging Application Load Balancer and ACM certificate</li><li>Independent AWS Global Accelerator for staging traffic</li><li>GitHub Actions–based CI/CD pipeline supporting:</li><li>Branch-based deployments (beta → staging, master → production)</li><li>Multi-region Docker image builds</li><li>Safe, controlled rollouts to ECS services</li></ul><h3>Key Staging Resources</h3><ul><li><strong>ECS Cluster:</strong> app-backend-staging-cluster</li><li><strong>Backend Service:</strong> app-backend-staging-service</li><li><strong>Worker Service:</strong> app-worker-staging-service</li></ul><p><strong>Task Definitions:</strong></p><ul><li>app-backend-staging</li><li>app-worker-staging</li><li>Dedicated ALB, target groups, ACM certificate, and Global Accelerator</li></ul><h3>CI/CD Overview</h3><ul><li>Docker images are built once per commit (ARM64).</li><li>Images are pushed to ECR in Mumbai, Singapore, and Virginia.</li><li>Staging deployments are automatically triggered from the beta branch.</li><li>Production deployments are triggered from master.</li><li>ECS task definitions are rendered dynamically and deployed with service stability checks.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a4525247695" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Multi-Region Backend & Worker Infrastructure Deployment Guide for App (ECS, ALB, Redis, S3)]]></title>
            <link>https://medium.com/@kartikpawar1290/aws-multi-region-backend-worker-infrastructure-deployment-guide-for-app-ecs-alb-redis-s3-ef272f409e25?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef272f409e25</guid>
            <category><![CDATA[ec]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ecs-fargate]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[infrastructure]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Tue, 17 Feb 2026 17:41:25 GMT</pubDate>
            <atom:updated>2026-09-14T06:54:06.878Z</atom:updated>
            <content:encoded><![CDATA[<h3>Complete AWS Multi-Region Infrastructure &amp; Deployment Guide for App (VPC, ECS Fargate, ALB, Redis, S3, Worker Services) — Singapore, Virginia &amp; Mumbai</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qayPPif2D1edLoBaEkj6w.png" /></figure><h3>Phase 1: Infrastructure Foundation (Singapore)</h3><h3>Overview</h3><p>This phase sets up the base network infrastructure in Singapore (ap-southeast-1) using the AWS Management Console.</p><p><strong>Region:</strong> ap-southeast-1 (Singapore)<br><strong>Estimated Time:</strong> 45–60 minutes</p><h3>Prerequisites</h3><ul><li>AWS Account with administrative access</li><li>Logged into AWS Console: <a href="https://console.aws.amazon.com/">https://console.aws.amazon.com</a></li><li>Region switched to Singapore (ap-southeast-1)</li></ul><h3>Step 1: Virtual Private Cloud (VPC) Setup</h3><h3>1.1 Create VPC</h3><ol><li>Navigate to VPC service.</li><li>Click <strong>Create VPC</strong>.</li><li>VPC settings:</li></ol><ul><li>Resources to create: VPC only</li><li>Name tag: app-singapore-vpc</li><li>IPv4 CIDR block: 10.0.0.0/16</li><li>Tenancy: Default</li></ul><p>4. Click <strong>Create VPC</strong>.</p><h3>1.2 Create Subnets</h3><ol><li>Click <strong>Subnets → Create subnet</strong>.</li><li>Select VPC ID: app-singapore-vpc.</li></ol><p><strong>Public Subnets</strong></p><ul><li>app-public-subnet-1 | AZ: ap-southeast-1a | CIDR: 10.0.1.0/24</li><li>app-public-subnet-2 | AZ: ap-southeast-1b | CIDR: 10.0.2.0/24</li></ul><p><strong>Private Subnets</strong></p><ul><li>app-private-subnet-1 | AZ: ap-southeast-1a | CIDR: 10.0.10.0/24</li><li>app-private-subnet-2 | AZ: ap-southeast-1b | CIDR: 10.0.11.0/24</li></ul><p>3. Click <strong>Create subnet</strong>.</p><h3>1.3 Internet Gateway (IGW)</h3><ol><li>Navigate to <strong>Internet gateways → Create internet gateway</strong>.</li><li>Name tag: app-igw.</li><li>Create and attach to VPC app-singapore-vpc.</li></ol><h3>1.4 NAT Gateway</h3><ol><li>Navigate to <strong>NAT gateways → Create NAT gateway</strong>.</li><li>Name: app-nat-gw.</li><li>Subnet: app-public-subnet-1.</li><li>Connectivity type: Public.</li><li>Allocate Elastic IP.</li><li>Click <strong>Create NAT gateway</strong>.</li></ol><h3>1.5 Route Tables</h3><p><strong>Public Route Table</strong></p><ul><li>Name: app-public-rt</li><li>Route: 0.0.0.0/0 → Internet Gateway</li><li>Associate public subnets</li></ul><p><strong>Private Route Table</strong></p><ul><li>Name: app-private-rt</li><li>Route: 0.0.0.0/0 → NAT Gateway</li><li>Associate private subnets</li></ul><h3>Step 2: Security Groups</h3><h3>2.1 Load Balancer Security Group</h3><ul><li>Name: app-alb-sg</li></ul><p><strong>Inbound rules:</strong></p><ul><li>HTTP (80) from 0.0.0.0/0</li><li>HTTPS (443) from 0.0.0.0/0</li></ul><h3>2.2 ECS Task Security Group</h3><ul><li>Name: app-ecs-sg</li></ul><p><strong>Inbound rules:</strong></p><ul><li>TCP 8000 from app-alb-sg</li><li>TCP 3000 from app-alb-sg</li></ul><h3>Step 3: ECR Repositories</h3><p>Navigate to Elastic Container Registry (ECR).</p><p>Create private repositories:</p><ul><li>app-backend</li></ul><h3>Step 4: SSL Certificate (ACM)</h3><ol><li>Navigate to Certificate Manager.</li><li>Request a public certificate.</li><li>Domain: appsite</li><li>Additional name: *.app.site</li><li>Validation method: DNS.</li><li>Create DNS records in Route 53.</li></ol><h3>Step 5: Verification Checklist</h3><ul><li>VPC app-singapore-vpc exists</li><li>Public subnets route to IGW</li><li>Private subnets route to NAT Gateway</li><li>Security group rules validated</li><li>ECR repositories created</li><li>ACM certificate issued</li></ul><h3>Regional Reuse (Virginia &amp; Mumbai)</h3><p>The exact same steps above are repeated for:</p><ul><li>Virginia (us-east-1)</li><li>Mumbai (ap-south-1)</li></ul><p>Only the following change:</p><ul><li>AWS Region</li><li>Availability Zones</li><li>Resource names (VPC, subnets, ALB, ECS cluster)</li></ul><p>No architectural or procedural changes are required.</p><h3>Architecture Diagrams</h3><h3>1. High-Level Regional Architecture (Singapore)</h3><pre>                          Internet<br>                             │<br>                             ▼<br>                    ┌─────────────────┐<br>                    │  Application     │<br>                    │  Load Balancer   │<br>                    │   (app-sg-alb)   │<br>                    └─────────┬───────┘<br>                              │<br>                              ▼<br>                  ┌─────────────────────┐<br>                  │   ECS Fargate       │<br>                  │  (Backend Service)  │<br>                  │ app-backend-service │<br>                  └─────────┬───────────┘<br>                            │<br>                ┌───────────┴───────────┐<br>                ▼                       ▼<br>        ┌──────────────┐        ┌──────────────┐<br>        │  ElastiCache │        │      S3      │<br>        │    Redis     │        │ app-files-sg │<br>        │ app-redis-sg │        │              │<br>        └──────────────┘        └──────────────┘</pre><h3>2. VPC Network Architecture (Singapore)</h3><pre>VPC: app-singapore-vpc (10.0.0.0/16)<br><br> ┌─────────────────────────────────────────────┐<br> │                Public Subnets               │<br> │  app-public-subnet-1 (1a)  10.0.1.0/24     │<br> │  app-public-subnet-2 (1b)  10.0.2.0/24     │<br> │        │                                    │<br> │        ▼                                    │<br> │   Internet Gateway (app-igw)                │<br> └─────────────────────────────────────────────┘<br>                │<br>                ▼<br>        NAT Gateway (app-nat-gw)<br>                │<br> ┌─────────────────────────────────────────────┐<br> │               Private Subnets               │<br> │  app-private-subnet-1 (1a) 10.0.10.0/24    │<br> │  app-private-subnet-2 (1b) 10.0.11.0/24    │<br> │        │                                    │<br> │        ▼                                    │<br> │   ECS Tasks / Redis / Internal Services     │<br> └─────────────────────────────────────────────┘</pre><h3>3. Backend Deployment Architecture</h3><pre>Developer Machine<br>      │<br>      ▼<br> Docker Build (ARM64)<br>      │<br>      ▼<br> Amazon ECR (app-backend)<br>      │<br>      ▼<br> ECS Task Definition (app-backend-sg)<br>      │<br>      ▼<br> ECS Service (2 Tasks)<br>      │<br>      ▼<br> Target Group (IP mode :8000)<br>      │<br>      ▼<br> Application Load Balancer (HTTPS 443)</pre><h3>4. Data &amp; Cache Layer Architecture</h3><pre>ECS Backend Tasks<br>        │<br>        ▼<br>Secrets Manager (app/backend/production)<br>        │<br>        ▼<br>ElastiCache Redis (app-redis-sg)<br>        │<br>        ▼<br>S3 Bucket (app-files-sg)</pre><h3>5. Worker / Agent Execution Architecture</h3><pre>ECS Cluster: app-singapore-cluster<br><br> ┌───────────────────────────────┐<br> │  app-worker-service           │<br> │  (Handles HTTP Requests)      │<br> └───────────────┬───────────────┘<br>                 │<br>                 ▼<br>         Redis (Queue / Cache)<br>                 │<br>                 ▼<br> ┌───────────────────────────────┐<br> │  app-worker-service           │<br> │  Command: python run_worker.py│<br> │  Processes async tasks        │<br> └───────────────────────────────┘</pre><p>These diagrams represent the logical architecture of the app infrastructure in Singapore (ap-southeast-1).</p><h3>Phase 2: Backend Deployment (Singapore) — AWS Console Guide</h3><h3>Overview</h3><p>This phase deploys the backend services to AWS ECS Fargate in Singapore (ap-southeast-1) using the AWS Management Console.</p><p><strong>Region:</strong> ap-southeast-1<br><strong>Estimated Time:</strong> 60–90 minutes</p><h3>Prerequisites</h3><ul><li>Phase 1 completed</li><li>Docker installed locally (required for building images)</li><li>AWS CLI installed locally (required for authentication)</li></ul><h3>Step 1: Push Docker Images (Local Terminal)</h3><p>Docker images must be built locally. This step cannot be performed from the AWS Console.</p><h3>Login to Amazon ECR</h3><pre>aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin &lt;YOUR_AWS_ACCOUNT_ID&gt;.dkr.ecr.ap-southeast-1.amazonaws.com</pre><h3>Build the backend image (ARM64 architecture)</h3><pre>docker build --platform linux/arm64 -t app-backend:latest ./backend</pre><h3>Tag the image</h3><pre>docker tag app-backend:latest &lt;YOUR_AWS_ACCOUNT_ID&gt;.dkr.ecr.ap-southeast-1.amazonaws.com/app-backend:latest</pre><h3>Push the image</h3><pre>docker push &lt;YOUR_AWS_ACCOUNT_ID&gt;.dkr.ecr.ap-southeast-1.amazonaws.com/app-backend:latest</pre><h3>Step 2: Secrets Management</h3><ol><li>Navigate to AWS Secrets Manager.</li><li>Click <strong>Store a new secret</strong>.</li><li>Secret type: Other type of secret.</li><li>Add required key/value pairs.</li><li>Name: app/backend/production.</li><li>Store the secret and copy the Secret ARN.</li></ol><h3>Step 3: IAM Roles</h3><h3>3.1 Create ECS Task Execution Role</h3><ul><li>Trusted entity: Elastic Container Service Task</li></ul><p>Attach policies:</p><ul><li>AmazonECSTaskExecutionRolePolicy</li><li>AmazonEC2ContainerRegistryReadOnly</li></ul><p>Role name: app-ecs-execution-role-sg</p><h3>3.2 Add Secrets Manager Permission</h3><p>Attach inline policy allowing:</p><ul><li>secretsmanager:GetSecretValue for backend secret ARN</li></ul><h3>Step 4: ECS Cluster Creation</h3><ul><li>Cluster name: app-singapore-cluster</li><li>Infrastructure type: Fargate (serverless)</li></ul><h3>Step 5: Task Definition</h3><ul><li>Task definition family: app-backend-sg</li><li>Launch type: Fargate</li><li>OS / Architecture: Linux / ARM64</li><li>CPU: 0.5 vCPU</li><li>Memory: 1 GB</li></ul><p><strong>Container configuration:</strong></p><ul><li>Name: backend</li><li>Image: Backend ECR image</li><li>Port: 8000</li><li>Secrets injected from AWS Secrets Manager</li><li>CloudWatch logging enabled</li></ul><h3>Step 6: Application Load Balancer (ALB)</h3><ul><li>Type: Application Load Balancer</li><li>Scheme: Internet-facing</li><li>Name: app-sg-alb</li><li>Listener: HTTPS (443) with ACM certificate</li></ul><p><strong>Target Group:</strong></p><ul><li>Type: IP</li><li>Port: 8000</li><li>Health check path: /api/health</li></ul><h3>Step 7: Deploy ECS Service</h3><ul><li>Service name: app-backend-service</li><li>Desired tasks: 2</li><li>VPC: app-singapore-vpc</li><li>Subnets: Private subnets only</li><li>Public IP: Disabled</li></ul><p><strong>Load Balancing:</strong></p><ul><li>Load balancer: app-sg-alb</li><li>Listener: HTTPS (443)</li><li>Target group: app-backend-tg-sg</li><li>Container: backend:8000</li></ul><h3>Verification</h3><ul><li>ECS service reaches Steady state</li><li>Target group shows healthy targets</li><li><a href="https://api/health">https:///api/health</a> returns HTTP 200</li><li>Optional Route 53 record: api-sg.he2.site</li></ul><h3>Phase 3: Data &amp; Cache Layer (Singapore) — AWS Console Guide</h3><h3>Overview</h3><p>This phase creates a Redis (ElastiCache) cluster in Singapore for low-latency caching and sets up an S3 bucket for object storage.</p><p><strong>Region:</strong> ap-southeast-1<br><strong>Estimated Time:</strong> 30–45 minutes</p><h3>Step 1: Redis (ElastiCache)</h3><h3>1.1 Create Subnet Group</h3><ul><li>Name: app-redis-subnet-group-sg</li><li>Description: Singapore Redis Subnets</li><li>VPC: app-singapore-vpc</li><li>Add both private subnets</li></ul><h3>1.2 Create Security Group</h3><ul><li>Name: app-redis-sg</li><li>VPC: app-singapore-vpc</li></ul><p>Inbound rule:</p><ul><li>Custom TCP | Port 6379 | Source: app-ecs-sg</li></ul><h3>1.3 Create Redis Cluster</h3><ul><li>Navigate to <strong>ElastiCache → Redis caches</strong> → <strong>Create Redis cache</strong>.</li><li>Deployment option: Design your own cache.</li><li>Creation method: Cluster.</li><li>Name: app-redis-sg</li><li>Cluster mode: Disabled</li><li>Node type: cache.t3.micro</li><li>Replicas: 1</li><li>Subnet group: app-redis-subnet-group-sg</li><li>Security group: app-redis-sg</li><li>Enable encryption at rest and in transit</li></ul><h3>1.4 Update Secrets Manager</h3><ul><li>Wait until Redis status is Available.</li><li>Copy primary endpoint</li><li>Navigate to Secrets Manager → app/backend/production.</li><li>Edit and update REDIS_HOST.</li><li>Force new deployment of backend ECS service.</li></ul><h3>Step 2: S3 Storage (Singapore)</h3><p>Open the bucket → Permissions tab.</p><ul><li>Bucket name: app-files-sg</li><li>Region: ap-southeast-1</li><li>Block all public access enabled</li><li>Enable versioning</li><li>Enable SSE-S3 encryption</li></ul><h3>2.1 CORS Configuration</h3><ol><li>Open the bucket → <strong>Permissions</strong> tab.</li><li>Edit CORS configuration and paste the JSON policy.</li></ol><pre>[<br>  {<br>    &quot;AllowedHeaders&quot;: [&quot;*&quot;],<br>    &quot;AllowedMethods&quot;: [&quot;GET&quot;, &quot;PUT&quot;, &quot;POST&quot;, &quot;DELETE&quot;, &quot;HEAD&quot;],<br>    &quot;AllowedOrigins&quot;: [&quot;https://app.site&quot;, &quot;https://www.app.site&quot;],<br>    &quot;ExposeHeaders&quot;: [&quot;ETag&quot;],<br>    &quot;MaxAgeSeconds&quot;: 3000<br>  }<br>]</pre><h3>Phase 4: Agent Execution (Singapore) — AWS Console Guide</h3><h3>Overview</h3><p>This phase configures the background worker service in Singapore using ECS Fargate.</p><p><strong>Region:</strong> ap-southeast-1<br><strong>Estimated Time:</strong> 20–30 minutes</p><h3>Prerequisites</h3><ul><li>Backend ECS service deployed</li><li>Redis cluster available</li></ul><h3>Step 1: Create Worker ECS Service</h3><p>The worker service reuses the same backend Docker image but runs with a different container command.</p><ul><li>Cluster: app-singapore-cluster</li><li>Open the <strong>Services</strong> tab and click <strong>Create</strong>.</li><li>Compute: FARGATE</li><li>Task definition: app-backend-sg</li><li>Service name: app-worker-service</li><li>Desired tasks: 2</li></ul><p>Networking:</p><ul><li>VPC: app-singapore-vpc</li><li>Subnets: Private subnets</li><li>Security group: app-ecs-sg</li><li>Public IP: Disabled</li></ul><p>Container override:</p><ul><li>Container: backend</li><li>Command: python,run_worker.py</li></ul><h3>Step 2: Service Auto Scaling (Optional)</h3><ul><li>Open app-worker-service.</li><li>Update service and enable auto scaling.</li><li>Minimum tasks: 1</li><li>Maximum tasks: 10</li><li>Policy: Target tracking</li><li>Metric: ECSServiceAverageCPUUtilization</li><li>Target value: 7</li></ul><h3>Regional Reuse (Virginia &amp; Mumbai)</h3><p>Repeat Phase 4 for:</p><ul><li>Virginia (us-east-1)</li><li>Mumbai (ap-south-1)</li></ul><p>Only change:</p><ul><li>AWS Region</li><li>ECS cluster name</li><li>Subnets &amp; security groups (region-specific)</li></ul><p>No architectural or procedural changes are required.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef272f409e25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices Application K8S Deployment Documentation]]></title>
            <link>https://medium.com/@kartikpawar1290/microservices-application-k8s-deployment-documentation-1134db3176a9?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/1134db3176a9</guid>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[hpa]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[scaling]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Tue, 17 Feb 2026 14:43:57 GMT</pubDate>
            <atom:updated>2026-09-14T07:01:04.740Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N3kUpHJbY0Wn08fIQsg7lQ.png" /></figure><h3>Project Title</h3><p>Microservices Application Deployment using Kubernetes (kind) with Nginx Reverse Proxy on EC2</p><h3>1. Introduction</h3><p>This document describes the complete deployment process of the microservices-based application using Docker, Kubernetes (kind), Horizontal Pod Autoscaling, and Nginx Reverse Proxy.</p><p>The deployment includes:</p><ul><li>Kubernetes tooling installation</li><li>Docker image build and push to Docker Hub</li><li>Kubernetes cluster setup using kind</li><li>Namespace and secrets configuration</li><li>Application deployment (Frontend, Backend, Worker)</li><li>Horizontal Pod Autoscaling (HPA)</li><li>Metrics Server installation</li><li>Nginx reverse proxy configuration</li><li>Scaling validation and verification</li></ul><h3>2. Kubernetes Tooling Installation (First Step)</h3><h3>2.1 Install Docker, kind and kubectl</h3><p>Create an installation script (install.sh) with the following content:</p><pre>#!/bin/bash<br>set -e  # Exit immediately if a command exits with a non-zero status<br>echo &quot;Updating package index...&quot;<br>sudo apt-get update<br>echo &quot;Installing prerequisites...&quot;<br>sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common<br>echo &quot;Adding Docker&#39;s official GPG key...&quot;<br>curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg<br>echo &quot;Setting up Docker stable repository...&quot;<br>echo \<br>  &quot;deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \<br>  $(lsb_release -cs) stable&quot; | sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null<br>echo &quot;Installing Docker...&quot;<br>sudo apt-get update<br>sudo apt-get install -y docker-ce docker-ce-cli containerd.io<br>echo &quot;Starting and enabling Docker...&quot;<br>sudo systemctl start docker<br>sudo systemctl enable docker<br>echo &quot;Adding current user to docker group...&quot;<br>sudo usermod -aG docker $USER<br>echo &quot;Please log out and log back in so that group changes take effect.&quot;<br># ------------------------<br>echo &quot;Installing kind...&quot;<br>[ $(uname -m) = x86_64 ] &amp;&amp; curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64<br>chmod +x ./kind<br>sudo mv ./kind /usr/local/bin/kind<br>echo &quot;Installing kubectl...&quot;<br>VERSION=&quot;v1.30.0&quot;<br>URL=&quot;https://dl.k8s.io/release/${VERSION}/bin/linux/amd64/kubectl&quot;<br>INSTALL_DIR=&quot;/usr/local/bin&quot;<br>curl -LO &quot;$URL&quot;<br>chmod +x kubectl<br>sudo mv kubectl $INSTALL_DIR/<br>kubectl version --client<br>echo &quot;Cleaning up...&quot;<br>rm -f kubectl<br>rm -f kind<br>echo &quot;kind &amp; kubectl installation complete!&quot;</pre><p>Make the script executable and run it:</p><pre>chmod +x install.sh<br>./install.sh</pre><h3>Verify Installation</h3><pre>docker --version<br>kind --version<br>kubectl version --client</pre><h3>3. Docker Image Build &amp; Push (Second Step)</h3><h3>3.1 Docker Login</h3><pre>docker login</pre><h3>3.2 Build Docker Images</h3><pre>docker build -t &lt;dockerhub-username&gt;/app-frontend:latest ./frontend<br>docker build -t &lt;dockerhub-username&gt;/app-backend:latest ./backend<br>docker build -t &lt;dockerhub-username&gt;/app-worker:latest ./worker</pre><h3>3.3 Push Images to Docker Hub</h3><pre>docker push &lt;dockerhub-username&gt;/app-frontend:latest<br>docker push &lt;dockerhub-username&gt;/app-backend:latest<br>docker push &lt;dockerhub-username&gt;/app-worker:latest</pre><h3>4. Kubernetes Cluster Creation</h3><h3>4.1 kind-cluster.yaml Configuration</h3><p>Create a file named kind-cluster.yaml with the following configuration:</p><pre>kind: Cluster<br>apiVersion: kind.x-k8s.io/v1alpha4<br>nodes:<br>- role: control-plane<br>  image: kindest/node:v1.31.2<br>  extraPortMappings:<br>    - containerPort: 30000  # Frontend NodePort<br>      hostPort: 30000<br>      protocol: TCP<br>    - containerPort: 30001  # Backend NodePort<br>      hostPort: 30001<br>      protocol: TCP<br>- role: worker<br>  image: kindest/node:v1.31.2<br>- role: worker<br>  image: kindest/node:v1.31.2</pre><p>This configuration creates:</p><ul><li>1 Control Plane node</li><li>2 Worker nodes</li><li>Port mapping for NodePort services (30000 and 30001) to host machine</li></ul><h3>4.2 Create Cluster</h3><pre>kind create cluster --config kind-cluster.yaml<br>kubectl get nodes</pre><h3>5. Namespace &amp; Secrets Setup</h3><pre>kubectl create namespace app<br>kubectl apply -n app -f app-backend-secret.yaml<br>kubectl apply -n app -f app-worker-secret.yaml</pre><h3>6. Application Deployment</h3><h3>6.1 app-app.yaml Configuration</h3><p>Create a file named app-app.yaml with the following configuration:</p><pre>apiVersion: v1<br>kind: Namespace<br>metadata:<br>  name: app<br>---<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: app-frontend<br>  namespace: app<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: app-frontend<br>  template:<br>    metadata:<br>      labels:<br>        app: app-frontend<br>    spec:<br>      containers:<br>        - name: frontend<br>          image: &lt;dockerhub-username&gt;/app-frontend:latest<br>          ports:<br>            - containerPort: 80<br>---<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: app-backend<br>  namespace: app<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: app-backend<br>  template:<br>    metadata:<br>      labels:<br>        app: app-backend<br>    spec:<br>      containers:<br>        - name: backend<br>          image: &lt;dockerhub-username&gt;/app-backend:latest<br>          ports:<br>            - containerPort: 8000<br>          envFrom:<br>            - secretRef:<br>                name: app-backend-secret<br>          resources:<br>            requests:<br>              cpu: &quot;250m&quot;<br>              memory: &quot;512Mi&quot;<br>            limits:<br>              cpu: &quot;500m&quot;<br>              memory: &quot;1Gi&quot;<br>---<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: app-worker<br>  namespace: app<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: app-worker<br>  template:<br>    metadata:<br>      labels:<br>        app: app-worker<br>    spec:<br>      containers:<br>        - name: worker<br>          image: &lt;dockerhub-username&gt;/app-worker:latest<br>          envFrom:<br>            - secretRef:<br>                name: app-worker-secret<br>          resources:<br>            requests:<br>              cpu: &quot;250m&quot;<br>              memory: &quot;512Mi&quot;<br>            limits:<br>              cpu: &quot;500m&quot;<br>              memory: &quot;1Gi&quot;<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: app-frontend<br>  namespace: app<br>spec:<br>  type: NodePort<br>  selector:<br>    app: app-frontend<br>  ports:<br>    - port: 80<br>      targetPort: 80<br>      nodePort: 30000<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: app-backend<br>  namespace: app<br>spec:<br>  type: NodePort<br>  selector:<br>    app: app-backend<br>  ports:<br>    - port: 8000<br>      targetPort: 8000<br>      nodePort: 30001<br>---<br>apiVersion: autoscaling/v2<br>kind: HorizontalPodAutoscaler<br>metadata:<br>  name: app-backend-hpa<br>  namespace: app<br>spec:<br>  scaleTargetRef:<br>    apiVersion: apps/v1<br>    kind: Deployment<br>    name: app-backend<br>  minReplicas: 2<br>  maxReplicas: 6<br>  metrics:<br>    - type: Resource<br>      resource:<br>        name: cpu<br>        target:<br>          type: Utilization<br>          averageUtilization: 70<br>---<br>apiVersion: autoscaling/v2<br>kind: HorizontalPodAutoscaler<br>metadata:<br>  name: app-worker-hpa<br>  namespace: app<br>spec:<br>  scaleTargetRef:<br>    apiVersion: apps/v1<br>    kind: Deployment<br>    name: app-worker<br>  minReplicas: 1<br>  maxReplicas: 5<br>  metrics:<br>    - type: Resource<br>      resource:<br>        name: cpu<br>        target:<br>          type: Utilization<br>          averageUtilization: 70</pre><h3>6.2 Deploy Application</h3><pre>kubectl apply -f app-app.yaml<br>kubectl get pods -n app<br>kubectl get svc -n app<br>kubectl get hpa -n app</pre><h3>7. Horizontal Pod Autoscaling (HPA)</h3><p>HPA is defined inside app-app.yaml.</p><p>Backend:</p><ul><li>Min Replicas: 2</li><li>Max Replicas: 6</li><li>Target CPU: 70%</li></ul><p>Worker:</p><ul><li>Min Replicas: 1</li><li>Max Replicas: 5</li><li>Target CPU: 70%</li></ul><h3>8. Metrics Server Installation</h3><pre>kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml<br>kubectl get pods -n kube-system | grep metrics-server</pre><h3>9. Nginx Reverse Proxy Setup</h3><h3>9.1 app.conf Configuration</h3><p>Create a file named app.conf with the following configuration:</p><pre>server {<br>    listen 80;<br>    server_name _;# FRONTEND<br>    location / {<br>        proxy_pass http://127.0.0.1:30000;<br>        proxy_http_version 1.1;<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br>    # BACKEND API<br>    location /api/ {<br>        proxy_pass http://127.0.0.1:30001;<br>        proxy_http_version 1.1;<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br>}</pre><h3>9.2 Install and Configure Nginx</h3><pre>sudo apt update<br>sudo apt install -y nginx<br>sudo cp app.conf /etc/nginx/sites-available/app<br>sudo ln -s /etc/nginx/sites-available/app /etc/nginx/sites-enabled/app<br>sudo nginx -t<br>sudo systemctl restart nginx</pre><h3>9.3 Traffic Flow</h3><p>Browser → EC2 Public IP (Port 80)</p><ul><li>/ → Frontend (NodePort 30000)</li><li>/api/ → Backend (NodePort 30001)</li></ul><h3>10. Scaling Validation</h3><pre>watch kubectl get pods -n app</pre><p>Traffic was generated from the UI to validate backend and worker autoscaling.</p><h3>11. Complete Execution Flow (Correct Order)</h3><ol><li>Install Docker, kind, and kubectl</li><li>Build and push Docker images</li><li>Create Kubernetes cluster</li><li>Create namespace and apply secrets</li><li>Deploy application</li><li>Install metrics server</li><li>Configure Nginx reverse proxy</li><li>Validate autoscaling</li></ol><h3>12. Conclusion</h3><p>The microservices-based application was successfully deployed using containerization and Kubernetes orchestration. The deployment demonstrates scalable architecture, secure secret management, autoscaling capability, and reverse proxy-based traffic routing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1134db3176a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Global Accelerator (GA) & Route 53 Integration Documentation]]></title>
            <link>https://medium.com/@kartikpawar1290/aws-global-accelerator-ga-route-53-integration-documentation-948385417aa5?source=rss-8cb7655bf625------2</link>
            <guid isPermaLink="false">https://medium.com/p/948385417aa5</guid>
            <category><![CDATA[aws-global-accelerator]]></category>
            <category><![CDATA[route-53]]></category>
            <category><![CDATA[integration]]></category>
            <dc:creator><![CDATA[Kartik Pawar]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 08:00:14 GMT</pubDate>
            <atom:updated>2026-09-14T07:04:53.242Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FzzKTA-TxJIE9_Epg6e1SQ.png" /></figure><h3>1. Purpose of This Document</h3><p>This document describes the end-to-end setup of <strong>AWS Global Accelerator (GA)</strong> integrated with <strong>multi-region Application Load Balancers (ALBs)</strong> and <strong>Amazon Route 53</strong>. It explains the architecture, configuration steps, routing behavior, traffic flow, and best practices from a Cloud Engineer perspective.</p><h3>2. What is AWS Global Accelerator?</h3><p>AWS Global Accelerator is a <strong>global networking service</strong> that improves application availability and performance by directing user traffic to the <strong>nearest healthy AWS Region</strong> using <strong>Anycast static IPs</strong>.</p><h3>Key Characteristics</h3><ul><li>🌍 Global service (not region-specific)</li><li>📌 Provides <strong>two static Anycast IP addresses</strong></li><li>🚀 Routes traffic at AWS Edge locations</li><li>🌐 Supports multi-region endpoints (ALB, NLB, EC2, Elastic IP)</li><li>🔁 Offers near-instant regional failover</li></ul><blockquote><em>ℹ️ </em><strong><em>Important:</em></strong><em> Global Accelerator is </em><strong><em>managed from US West (Oregon)</em></strong><em>. This is only the </em><strong><em>control plane location</em></strong><em> and does </em><strong><em>not</em></strong><em> mean that application traffic flows through Oregon.</em></blockquote><h3>3. Architecture Overview</h3><p>👤 User<br>→ 🌐 Route 53 (DNS)<br>→ ⚡ Global Accelerator (Anycast IP)<br>→ 🧭 Nearest AWS Edge Location<br>→ 📍 Closest Healthy Region<br>→ 🎯 Regional ALB<br>→ 🧩 ECS Services</p><h3>4. Why Use a Single Global Accelerator for Multiple Regions</h3><h3>✅ Recommended Design</h3><ul><li>✅ <strong>One Global Accelerator per application</strong></li><li>🗂 <strong>Multiple endpoint groups (one per AWS Region)</strong></li><li>🎯 Each endpoint group contains the regional ALB</li></ul><h3>⭐ Benefits</h3><ul><li>⚡ Automatic latency-based routing</li><li>🔄 Fast and seamless regional failover</li><li>🧩 Simple and clean DNS configuration</li><li>💰 Lower operational overhead and cost</li></ul><h3>❌ What NOT to Do</h3><ul><li>❌ Do not create multiple Global Accelerators for the same application</li><li>❌ Do not use Route 53 latency routing with Global Accelerator</li></ul><h3>5. Global Accelerator Configuration Steps</h3><h3>Step 1: Create the Global Accelerator</h3><ul><li>➕ Create a new Global Accelerator</li><li>🔌 Listener protocol: <strong>TCP</strong></li><li>🔐 Listener ports: <strong>80 / 443</strong> (based on ALB configuration)</li><li>💾 Save and note the <strong>GA DNS name</strong> and <strong>static IP addresses</strong></li></ul><h3>Step 2: Create Endpoint Groups (One Per Region)</h3><p>Example Regions:</p><ul><li>🇮🇳 ap-south-1 (Mumbai)</li><li>🇸🇬 ap-southeast-1 (Singapore)</li><li>🇺🇸 us-east-1 (Virginia)</li></ul><p>For each endpoint group:</p><ul><li>🎚 Set traffic dial to <strong>100%</strong></li><li>❤️ Use default health check settings</li></ul><h3>Step 3: Add ALBs to Endpoint Groups</h3><p>For each region:</p><ul><li>🎯 Endpoint type: <strong>Application Load Balancer</strong></li><li>📍 Select the ALB from the same region</li><li>⚖ Keep default weight unless traffic tuning is required</li></ul><h3>6. Security Group Considerations</h3><ul><li>🔒 Global Accelerator itself <strong>does not have a Security Group</strong></li><li>🌍 Traffic reaches the ALB from AWS Edge locations</li></ul><h3>ALB Security Group Must Allow:</h3><ul><li>🔓 Inbound HTTP/HTTPS traffic from either:</li><li>🌐 0.0.0.0/0 (simple but less restrictive)</li><li><strong>OR</strong></li><li>📄 AWS-managed <strong>Global Accelerator prefix list</strong> (recommended for tighter security)</li></ul><h3>7. Route 53 Configuration (DNS Setup)</h3><h3>✅ Correct Route 53 Record Setup</h3><ul><li>🏷 <strong>Record name:</strong> api</li><li>🧾 <strong>Record type:</strong> A (IPv4)</li><li>🔗 <strong>Alias:</strong> Yes</li><li>➡ <strong>Route traffic to:</strong> Alias to Global Accelerator</li><li>📛 <strong>Target:</strong> Global Accelerator DNS name</li><li>🧭 <strong>Routing policy:</strong> Simple routing</li><li>✅ <strong>Evaluate target health:</strong> Yes</li><li>🚫 <strong>Health check:</strong> Not required</li></ul><h3>ℹ️ Important Notes</h3><ul><li>Route 53 always shows <strong>US West (Oregon)</strong> for Global Accelerator</li><li>✅ This is expected and correct behavior</li><li>❌ Do <strong>not</strong> select Latency, Geo, or Weighted routing</li></ul><h3>8. Why Simple Routing is Mandatory with Global Accelerator</h3><p>Layer Responsibility🌐 Route 53DNS resolution only⚡ Global Accelerator Latency routing &amp; failover🎯 AApplication load balancing</p><p>Using Route 53 latency routing together with Global Accelerator duplicates routing logic and is <strong>not recommended</strong>.</p><h3>9. Traffic Flow Explanation</h3><ol><li>👤 User resolves api.domain.com</li><li>🌐 Route 53 returns the Global Accelerator IP address</li><li>🧭 User connects to the nearest AWS Edge location</li><li>⚡ Global Accelerator selects the closest healthy region</li><li>🎯 Traffic is forwarded to the regional ALB</li><li>🧩 ALB routes traffic to ECS service tasks</li></ol><h3>10. High Availability &amp; Failover</h3><ul><li>❤️ Endpoint health is continuously monitored</li><li>🚨 If a region becomes unhealthy:</li><li>🔀 Traffic is instantly routed to the next healthy region</li><li>⏱ No DNS TTL or propagation delay</li></ul><h3>11. AWS Global Accelerator — Traffic Capacity</h3><h3>⚡ Global Accelerator Capacity</h3><ul><li>🚀 Designed to handle <strong>millions of requests per second</strong></li><li>🌐 Built on the AWS global edge network using Anycast IPs</li><li>📈 Scales automatically with traffic spikes</li></ul><h3>🎯 Application Load Balancer (Per Region — Approximate Soft Limits)</h3><ul><li>🔁 <strong>~100,000+ requests per second</strong></li><li>🔗 <strong>~3,000 new connections per second</strong></li><li>📡 <strong>~100,000 active connections</strong></li></ul><blockquote><em>ℹ️ Actual capacity depends on instance size, target type, and request patterns.</em></blockquote><h3>12. Conclusion</h3><p>This architecture provides:</p><ul><li>🌍 Global performance optimization</li><li>🛡 High availability and fast failover</li><li>🧩 Simple and reliable DNS management</li><li>📈 Highly scalable multi-region design</li></ul><p><strong>End of Document</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=948385417aa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>