<?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 Shivam Soni on Medium]]></title>
        <description><![CDATA[Stories by Shivam Soni on Medium]]></description>
        <link>https://medium.com/@shivtrent800?source=rss-e0ed6343a521------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vGoIET8kw_OZBPPeZm3zEA.jpeg</url>
            <title>Stories by Shivam Soni on Medium</title>
            <link>https://medium.com/@shivtrent800?source=rss-e0ed6343a521------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 16:09:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shivtrent800/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[How I Built and Deployed a Three-Tier Book Review App on AWS Using Terraform]]></title>
            <link>https://medium.com/@shivtrent800/how-i-built-and-deployed-a-three-tier-book-review-app-on-aws-using-terraform-9bc10a004487?source=rss-e0ed6343a521------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bc10a004487</guid>
            <category><![CDATA[3-tier-architecture]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Shivam Soni]]></dc:creator>
            <pubDate>Mon, 30 Mar 2026 21:32:58 GMT</pubDate>
            <atom:updated>2026-03-30T21:32:58.380Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A practical walkthrough of VPCs, load balancers, auto scaling, RDS, and the debugging that happens between a clean plan and a working app.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tVXBe8uT29Ej3aYm4JmG_Q.png" /></figure><p>There is a difference between understanding cloud architecture in theory and actually building it. I wanted to close that gap.</p><p>This project started with a straightforward goal: deploy a real, multi-tier Book review web application on AWS, with production-style architecture, using Terraform to provision everything. No manual clicks in the console. No shortcuts. I chose a Book Review application — a frontend built in Next.js, a Node.js/Express backend, and a MySQL database managed through Amazon RDS — because it covers enough complexity to be interesting without being overwhelming.</p><p>By the end, I had a working, publicly accessible application deployed across two AWS availability zones, with separate compute tiers, internal load balancing, auto scaling, and a managed database with a read replica. More importantly, I had a much clearer mental model of how infrastructure provisioning, application deployment, and network isolation actually fit together.</p><p>This post walks through the architecture, the Terraform setup, the deployment approach, and — critically — the debugging I had to do before the application actually worked end to end.</p><h3>The Architecture</h3><p>The application follows a classic three-tier architecture: a web tier, an application tier, and a database tier. Each tier lives in its own subnet and communicates only through well-defined paths. Nothing is publicly exposed unless it has to be.</p><p>The foundation is a custom VPC with a CIDR block of 10.0.0.0/16, spanning two availability zones for resilience. Inside it, I provisioned six subnets:</p><p>• 2 public subnets (web tier) — these host the frontend Next.js instances and are the only layer accessible from the internet</p><p>• 2 private subnets (app tier) — these host the Node.js/Express backend, isolated from direct internet access</p><p>• 2 private subnets (database tier) — these host the RDS MySQL instances, accessible only from the app tier</p><p>Traffic flows like this: a user hits the public Application Load Balancer, which routes requests to the frontend Auto Scaling Group. The frontend talks to the backend through an internal Application Load Balancer, which distributes requests across the backend Auto Scaling Group. The backend connects to RDS MySQL in the database tier. No tier ever communicates directly with a tier it shouldn’t know about.</p><p>The app tier uses NAT gateways in the public subnets for outbound internet access — necessary for package installs and system updates during bootstrapping — while remaining completely unreachable from the outside.</p><h3>Terraform Structure and Infrastructure Components</h3><p>I organised the Terraform code into four files — main.tf, variables.tf, outputs.tf, and versions.tf — rather than splitting into modules. For a project this size, keeping everything in one flat structure made it easier to trace dependencies and debug issues without jumping between files.</p><p>Here is a high-level breakdown of what gets provisioned:</p><p>• Networking: VPC, 6 subnets, Internet Gateway, route tables, NAT gateways</p><p>• Compute: Two Auto Scaling Groups — one for the frontend, one for the backend — each with launch templates and user data scripts for bootstrapping</p><p>• Load Balancing: A public-facing ALB for the frontend and an internal ALB for the backend, each with target groups and health checks</p><p>• Security: Separate security groups for each tier, allowing only the traffic each layer needs</p><p>• Database: An RDS MySQL instance in Multi-AZ mode with a read replica, deployed in the private database subnets</p><p>• Access: An SSH key pair generated via Terraform for admin access to instances</p><p>The user data scripts handle everything that needs to happen when an instance starts — installing Node.js, pulling the application code, configuring Nginx on the frontend, and setting up systemd service files so the application processes restart automatically if they crash or if the instance reboots.</p><p>Using systemd for process management rather than just running node in the background is one of those details that doesn’t matter until it does. If the process crashes and there’s no supervisor, the application just silently stops working.</p><h3>Application Deployment</h3><p>The frontend is a Next.js application running on instances in the public subnets, behind Nginx. Nginx acts as a reverse proxy — it listens on port 80 and forwards traffic to the Next.js process running on port 3000. It also handles the proxy pass to the backend, forwarding API requests through the internal ALB.</p><p>The backend is a Node.js/Express API running on instances in the private app subnets, behind the internal load balancer. Because these instances have no public IP and no route to the internet gateway, the only way to reach them is through the internal ALB from the frontend tier — or via a bastion/SSM session for admin access.</p><p>The backend connects to RDS MySQL using the database endpoint output from Terraform, injected as an environment variable at bootstrap time. The RDS instance runs in Multi-AZ mode, meaning AWS maintains a synchronous standby in the second availability zone and handles failover automatically.</p><p>I also provisioned a read replica. It doesn’t add much at this scale, but it’s good practice to understand how replicas work — they offload read traffic and give you an in-region recovery option.</p><h3>Problems Faced and How I Debugged Them</h3><p>This is the section that doesn’t usually make it into architecture blog posts, but it’s where the real learning happens.</p><h3>RDS Read Replica: ARN vs. Identifier</h3><p>When configuring the read replica in Terraform, I initially set the replicate_source_db argument to the instance identifier — just the name of the primary RDS instance. Terraform accepted this without complaint during the plan phase, but the apply failed.</p><p>The fix was to pass the full ARN of the primary instance instead. This is one of those things that isn’t obvious from the Terraform docs unless you dig into the AWS API behaviour. Cross-region replicas always require an ARN; even for same-region replicas, using the ARN is the safer and more explicit choice.</p><h3>RDS Backup Retention and Account Restrictions</h3><p>Another apply failure came from the backup_retention_period setting on RDS. My initial configuration was hitting a restriction tied to account-level settings — the error wasn’t immediately obvious from the Terraform output. Adjusting the retention period resolved it. It was a good reminder that Terraform reflects the AWS API, and the API sometimes has constraints that aren’t visible until you actually attempt the operation.</p><h3>The Nginx Proxy Pass Bug</h3><p>This was the most frustrating one to track down. After a successful Terraform apply, the frontend loaded in the browser without issues. But any action that involved the backend — logging in, submitting a review — failed silently.</p><p>I checked the backend target group health and the internal ALB listeners. Everything looked healthy. I checked the security groups — the frontend security group was allowed to reach the internal ALB, and the ALB was allowed to reach the backend instances on the correct port.</p><p>The issue turned out to be in the Nginx proxy_pass configuration on the frontend instances. The internal ALB DNS name was correct, but the port was missing. The backend listens on port 3001, and the proxy_pass directive was forwarding to the ALB on the default port 80. Traffic was reaching the ALB but not finding a matching listener rule, so requests were being dropped.</p><p>Adding :3001 to the proxy_pass URL fixed it. A one-line change, but it took methodical layer-by-layer checking to find — verifying the ALB health, then the listener config, then the Nginx config, then testing the connection directly from a frontend instance using curl.</p><h3>Key Learnings</h3><p>A few things stood out as genuinely valuable from this project:</p><p>• Infrastructure validation is not the same as application validation. A successful terraform apply means resources were created. It does not mean your application is working. You still need to verify health checks, test the application flow, and check runtime logs.</p><p>• Internal load balancers are easy to overlook. Most tutorials focus on public-facing load balancers. The internal ALB is what makes proper tier separation possible — it means the frontend never needs to know the private IPs of the backend instances.</p><p>• Managed services shift complexity, not eliminate it. RDS takes away database server management, but you still need to understand backup retention settings, Multi-AZ behaviour, replica configuration, and how the Terraform provider maps to the AWS API.</p><p>• Debugging multi-tier apps requires thinking in layers. When something fails, you need to know which layer it’s failing at: DNS resolution, security group rules, load balancer listener configuration, application config, or application code. The Nginx port issue could only be found by eliminating layers one at a time.</p><p>• User data scripts are powerful but opaque. When bootstrapping fails, the instance looks healthy from AWS’s perspective. You need to SSH in and check /var/log/cloud-init-output.log to understand what actually happened.</p><h3>Conclusion</h3><p>Building this project gave me a much more grounded understanding of how the different layers of a cloud deployment actually interact. Reading about three-tier architecture is one thing. Watching terraform apply finish and then methodically working through why the login button doesn’t work is something else entirely.</p><p>The Terraform code is not perfect — there are obvious improvements to make around module structure, remote state, and secrets management. But the goal of this project was never to build production-ready infrastructure for a real product. It was to understand how the pieces fit together: network tiers, compute scaling, internal routing, and managed databases.</p><p>If you are working through your own cloud or DevOps learning, I’d strongly recommend building something like this end to end. Start from the network, work up through compute, add the database last, and don’t stop at a successful plan output. Deploy the application. Break it. Debug it. That’s where the understanding actually comes from.</p><p>Github repo: <a href="https://github.com/ShivamSoni1995/BookreviewApp-AWS-Terraform.git">https://github.com/ShivamSoni1995/BookreviewApp-AWS-Terraform.git</a></p><p>#AWS #Terraform #DevOps #CloudComputing #InfrastructureAsCode #ThreeTierArchitecture #RDS #ApplicationLoadBalancer #AutoScaling #VPC #NextJS #NodeJS #SelfHosting #CloudArchitecture #LearningInPublic</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bc10a004487" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Helm for Kubernetes: Deploy, Break, and Roll Back an Application (Hands-On Guide)]]></title>
            <link>https://medium.com/@shivtrent800/helm-for-kubernetes-deploy-break-and-roll-back-an-application-hands-on-guide-05d0d073151e?source=rss-e0ed6343a521------2</link>
            <guid isPermaLink="false">https://medium.com/p/05d0d073151e</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cka]]></category>
            <category><![CDATA[helm]]></category>
            <dc:creator><![CDATA[Shivam Soni]]></dc:creator>
            <pubDate>Sun, 15 Mar 2026 21:48:29 GMT</pubDate>
            <atom:updated>2026-03-15T21:48:29.329Z</atom:updated>
            <content:encoded><![CDATA[<p>Managing applications in Kubernetes can quickly become complicated.</p><p>A single application deployment may involve multiple YAML files:</p><ul><li>Deployments</li><li>Services</li><li>ConfigMaps</li><li>Secrets</li><li>RBAC policies</li><li>Ingress rules</li></ul><p>Maintaining these resources manually across <strong>development, staging, and production environments</strong> becomes difficult and error-prone.</p><p>This is where <strong>Helm</strong> comes in.</p><p>Helm acts as the <strong>package manager for Kubernetes</strong>, allowing engineers to package applications into reusable templates called <strong>charts</strong>.</p><p>In this guide, we will take a <strong>hands-on approach</strong> to understand Helm by following the <a href="https://killercoda.com/chadmcrowell/course/cka/helm-install-nginx">Installing NGINX Ingress with Helm</a> lab on <a href="https://killercoda.com/">Killercoda</a>. It achieves the following:</p><ul><li>Adding Helm repositories</li><li>Inspecting a Helm chart</li><li>Deploying an NGINX ingress controller</li><li>Intentionally breaking the deployment</li><li>Rolling back to a previous working version</li></ul><p>By the end of this article, you’ll understand how Helm manages Kubernetes applications in real-world environments.</p><h3>What is Helm?</h3><p>Helm simplifies Kubernetes application deployment by introducing packaging, templating, and version management.</p><p>Instead of managing dozens of YAML files, you install a <strong>Helm chart</strong>, which contains all required Kubernetes resources packaged together.</p><p>Helm introduces a few important concepts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8IyQcHJxAjtCdtHfM2KTiw.png" /></figure><p>A simplified Helm workflow looks like this:</p><pre>Helm Repository → Helm Chart → Helm Release → Kubernetes Resources</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z5-ivm1D-GnAkfBpKkMfCg.png" /></figure><h3>Verifying Helm Installation</h3><p>Before working with Helm charts, it’s important to confirm that Helm is correctly installed on the system.</p><p>You can verify the installation using:</p><pre>helm version</pre><p>This command prints the Helm client version currently installed.</p><p>Example output might look like this:</p><pre>version.BuildInfo{Version:&quot;v3.14.0&quot;, GitCommit:&quot;...&quot;, GoVersion:&quot;go1.21&quot;}</pre><p>Helm v3 works differently from its earlier versions. In Helm v2, a server-side component called <strong>Tiller</strong> was required to manage deployments. Helm v3 removed this dependency, allowing the Helm CLI to interact directly with the Kubernetes API server.</p><p>This makes Helm simpler and more secure because release information is stored directly inside the cluster as Kubernetes resources rather than managed by an additional server component.</p><h3>Adding Helm Repositories</h3><p>Helm charts are distributed through repositories.</p><p>A Helm repository is essentially a <strong>collection of packaged charts hosted at a remote location</strong>, similar to how Linux distributions host software packages through repositories like APT or YUM.</p><p>To begin working with charts, we first add the official NGINX Helm repository:</p><pre>helm repo add nginx-stable https://helm.nginx.com/stable</pre><p>In this command:</p><ul><li>nginx-stable is the local name we assign to the repository.</li><li>https://helm.nginx.com/stable is the remote location where the charts are hosted.</li></ul><p>Once the repository is added, we update the local Helm cache to fetch the latest chart index:</p><pre>helm repo update</pre><p>This command downloads metadata about all available charts in the configured repositories.</p><p>To confirm that the repository was successfully added, we can list all configured repositories:</p><pre>helm repo list</pre><p>At this point, Helm is now aware of the charts available in the NGINX repository.</p><h3>Inspecting a Helm Chart</h3><p>Before deploying any application using Helm, it’s useful to inspect the chart and understand what it contains.</p><p>Helm provides several commands to explore chart metadata and configuration.</p><p>First, we search the configured repositories for NGINX-related charts:</p><pre>helm search repo nginx</pre><p>This command searches the local repository index and returns a list of charts that match the search term.</p><p>Among the results, we find the chart we are interested in:</p><pre>nginx-stable/nginx-ingress</pre><p>Charts are referenced using the format:</p><pre>repository/chart-name</pre><p>In our case:</p><pre>nginx-stable/nginx-ingress</pre><p>Next, we inspect the metadata of this chart:</p><pre>helm show chart nginx-stable/nginx-ingress</pre><p>This displays information such as:</p><ul><li>Chart name</li><li>Version</li><li>Description</li><li>Maintainers</li></ul><p>This metadata comes from a file called Chart.yaml inside the chart package.</p><p>Helm charts also include a <strong>default configuration file</strong> called values.yaml.</p><p>To view these default values, we run:</p><pre>helm show values nginx-stable/nginx-ingress</pre><p>This file contains configurable parameters such as:</p><ul><li>Number of replicas</li><li>Service type</li><li>Resource limits</li><li>Container image settings</li></ul><p>Understanding these values is important because Helm allows us to override them during installation.</p><h3>Deploying an NGINX Ingress Controller</h3><p>With the chart inspected, we can now deploy the application.</p><p>First, we create a dedicated namespace for the ingress controller:</p><pre>kubectl create namespace nginx-ingress</pre><p>Namespaces help isolate resources inside a Kubernetes cluster.</p><p>Next, we install the chart using Helm:</p><pre>helm install my-nginx-ingress nginx-stable/nginx-ingress \<br>  --namespace nginx-ingress \<br>  --set controller.replicaCount=2 \<br>  --set controller.service.type=NodePort \<br>  --set controller.service.httpPort.nodePort=30080 \<br>  --set controller.service.httpsPort.nodePort=30443</pre><p>Let’s break down this command:</p><ul><li><strong>my-nginx-ingress</strong> is the release name.</li><li><strong>nginx-stable/nginx-ingress</strong> specifies the chart we want to install.</li><li><strong>— namespace</strong> defines where the resources will be created.</li><li><strong>— set</strong> overrides default values from the chart configuration.</li></ul><p>Internally, Helm performs several steps:</p><ol><li>It downloads the chart from the repository.</li><li>It merges configuration values.</li><li>It renders templates into Kubernetes manifests.</li><li>It sends the generated manifests to the Kubernetes API server.</li><li>It stores release metadata inside the cluster.</li></ol><p>We can verify the deployment by checking the pods:</p><pre>kubectl get pods -n nginx-ingress</pre><p>And the services:</p><pre>kubectl get svc -n nginx-ingress</pre><p>At this stage, the NGINX ingress controller should be running in the cluster.</p><h3>Intentionally Breaking the Deployment</h3><p>One of Helm’s most powerful features is its ability to safely upgrade and roll back deployments.</p><p>To understand how this works, we intentionally introduce a faulty configuration.</p><p>We attempt to upgrade the release with an invalid container image tag:</p><pre>helm upgrade my-nginx-ingress nginx-stable/nginx-ingress \<br>  --namespace nginx-ingress \<br>  --set controller.image.tag=&quot;invalid-tag&quot; \<br>  --set controller.replicaCount=5</pre><p>Because the image tag does not exist, Kubernetes will fail to pull the container image.</p><p>We can observe this by watching the pod status:</p><pre>kubectl get pods -n nginx-ingress -w</pre><p>Eventually, the pods will enter an error state such as:</p><pre>ImagePullBackOff<br>ErrImagePull</pre><p>This simulates a real-world scenario where a deployment fails due to an incorrect configuration.</p><h3>Rolling Back to a Previous Working Version</h3><p>Fortunately, Helm keeps track of every deployment revision.</p><p>We can view the release history using:</p><pre>helm history my-nginx-ingress -n nginx-ingress</pre><p>Each upgrade creates a new revision.</p><p>If the latest deployment fails, we can revert to a previous working revision.</p><p>For example:</p><pre>helm rollback my-nginx-ingress 3 -n nginx-ingress</pre><p>This command restores the configuration from revision 3.</p><p>Once the rollback completes, we can verify that the deployment is healthy again:</p><pre>kubectl get pods -n nginx-ingress</pre><p>The pods should now return to a running state.</p><h3>What This Experiment Shows</h3><p>This simple experiment demonstrates several important Helm capabilities:</p><ul><li>Helm simplifies Kubernetes application deployment through reusable charts.</li><li>Charts allow configuration to be customized without editing YAML files.</li><li>Every Helm deployment is versioned as a release revision.</li><li>Failed upgrades can be quickly reverted using Helm rollback.</li></ul><p>In real production environments, this ability to <strong>deploy safely and recover quickly</strong> makes Helm an essential tool for managing Kubernetes applications.</p><p>You can complete the full lab <a href="https://killercoda.com/chadmcrowell/course/cka/helm-install-nginx">Installing NGINX Ingress with Helm</a> lab on <a href="https://killercoda.com/">Killercoda</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05d0d073151e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a 3-Tier Azure Architecture (Next.js,]]></title>
            <link>https://medium.com/@shivtrent800/building-a-3-tier-azure-architecture-next-js-2348eefd4818?source=rss-e0ed6343a521------2</link>
            <guid isPermaLink="false">https://medium.com/p/2348eefd4818</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[3-tier-architecture]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Shivam Soni]]></dc:creator>
            <pubDate>Sat, 07 Mar 2026 09:36:40 GMT</pubDate>
            <atom:updated>2026-03-07T09:36:40.292Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a 3-Tier Azure Architecture (Next.js, Node.js, MySQL): VNet, NSG, Load Balancer, Private DB</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bwBziJBUoe2wM-LZbWXDwA.png" /></figure><p>Modern cloud applications rarely run on a single server. Instead, production systems follow a <strong>multi-tier architecture</strong> where responsibilities are separated into independent layers.</p><p>In this project, I deployed a <strong>3-tier application architecture on Microsoft Azure</strong> using:</p><ul><li><strong>Next.js</strong> for the frontend</li><li><strong>Node.js + Express</strong> for backend APIs</li><li><strong>Azure Database for MySQL (Flexible Server)</strong> for the database</li><li><strong>Azure Virtual Network, Load Balancers, and NSGs</strong> for networking and security</li></ul><p>The goal was to simulate a <strong>production-style cloud architecture</strong> with proper <strong>network isolation, security boundaries, and scalability</strong>.</p><h3>Tech Stack Used</h3><p><strong>Cloud Platform:</strong> Microsoft Azure<br><strong>Frontend:</strong> Next.js<br><strong>Backend:</strong> Node.js / Express<br><strong>Database:</strong> Azure Database for MySQL Flexible Server<br><strong>Networking:</strong> VNet, Subnets, NSGs, Public Load Balancer, Internal Load Balancer<br><strong>Web Server:</strong> Nginx<br><strong>Process Manager:</strong> systemd</p><h3>Why 3-Tier Architecture?</h3><p>A three-tier architecture separates applications into independent layers.</p><p>LayerResponsibilityPresentation LayerUser interfaceApplication LayerBusiness logic &amp; APIsData LayerPersistent storage</p><p>Benefits include:</p><ul><li>Strong <strong>security isolation</strong></li><li>Independent <strong>scaling</strong></li><li>Easier <strong>maintenance</strong></li><li>Better <strong>fault tolerance</strong></li></ul><h3>Architecture Overview</h3><p>The infrastructure consisted of:</p><ul><li><strong>1 Azure Virtual Network</strong></li><li><strong>6 Subnets</strong></li><li><strong>2 Availability Zones</strong></li><li><strong>2 Load Balancers</strong></li></ul><p>Important Azure networking concept:</p><p><em>Subnets in Azure are </em><strong><em>regional resources</em></strong><em>, not tied to a specific Availability Zone.<br>High availability is achieved by placing </em><strong><em>VMs across zones</em></strong><em>, while subnets remain regional.</em></p><h3>Request Flow Through the Architecture</h3><p>Internet Users<br> │<br> ▼<br>Public Load Balancer<br> │<br> ▼<br>Web Tier (Next.js + Nginx)<br> │<br> ▼<br>Internal Load Balancer<br> │<br> ▼<br>App Tier (Node.js API)<br> │<br> ▼<br>Azure MySQL Flexible Server</p><h3>Step 1 — Virtual Network and Subnet Design</h3><p>A custom Azure <strong>Virtual Network</strong> was created.</p><pre>VNet CIDR: 10.0.0.0/16</pre><p>Subnets were organized per tier:</p><pre>| Subnet              | Purpose                     |<br>| ------------------- | --------------------------- |<br>| Web Subnet 1        | Frontend VM                 |<br>| Web Subnet 2        | Frontend VM (AZ redundancy) |<br>| App Subnet 1        | Backend VM                  |<br>| App Subnet 2        | Backend VM (AZ redundancy)  |<br>| DB Delegated Subnet | Azure MySQL Flexible Server |<br>| Management Subnet   | Bastion / operations        |</pre><p>VMs were <strong>distributed across Availability Zones</strong> to improve resilience.</p><h3>Step 2 — Network Security Groups (NSGs)</h3><p>Network Security Groups enforce communication boundaries between tiers.</p><h3>Web Tier Rules</h3><p>Allow:</p><p>Port 80<br>Source: Internet</p><h3>App Tier Rules</h3><p>Allow:</p><p>Port 3001<br>Source: Web subnet CIDR ranges</p><p>This ensures only frontend servers can access backend APIs.</p><h3>Database Tier Rules</h3><p>Allow:</p><p>Port 3306<br>Source: App subnet CIDR ranges</p><p>Only backend servers can reach the database.</p><h3>Implementation Walkthrough: What We Actually Deployed on Azure VMs</h3><p>This section reflects the <strong>real commands executed during deployment</strong>.</p><h3>Step 3 — Clone the Repository</h3><p>On both Web and App VMs:</p><pre>git clone https://github.com/pravinmishraaws/book-review-app</pre><h3>Step 4 — Deploy Backend on App VM</h3><p>Navigate to backend directory:</p><pre>cd book-review-app/backend</pre><p>Install dependencies:</p><pre>npm install</pre><h3>Create Backend Environment File</h3><p>Create .env:</p><pre>DB_HOST=&lt;mysql-host&gt;<br>DB_USER=appuser<br>DB_PASS=&lt;password&gt;<br>DB_NAME=book_review_db<br>JWT_SECRET=&lt;secret&gt;<br>PORT=3001</pre><h3>Backend systemd Service</h3><p>Create:</p><pre>/etc/systemd/system/bookreview-backend.service</pre><p>Recommended configuration:</p><pre>[Unit]<br>Description=Book Review Backend<br>After=network.target<br>[Service]<br>User=azureuser<br>WorkingDirectory=/home/azureuser/book-review-app/backend<br>EnvironmentFile=/home/azureuser/book-review-app/backend/.env<br>ExecStart=/usr/bin/node /home/azureuser/book-review-app/backend/src/server.js<br>Restart=always<br>RestartSec=5<br>[Install]<br>WantedBy=multi-user.target</pre><p>Enable service:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable bookreview-backend<br>sudo systemctl start bookreview-backend</pre><h3>Verify Backend Health</h3><p>The backend must be running before frontend requests succeed.</p><p>Run on the App VM:</p><pre>curl http://127.0.0.1:3001/api/books</pre><h3>Step 5 — Initialize Database</h3><p>Connect to MySQL:</p><pre>mysql -h &lt;mysql-host&gt; -u &lt;admin&gt; -p --ssl-mode=REQUIRED</pre><p>Create database:</p><pre>CREATE DATABASE book_review_db;</pre><p>Create application user using <strong>host-scoped grants</strong>:</p><pre>CREATE USER &#39;appuser&#39;@&#39;10.0.11.%&#39; IDENTIFIED BY &#39;password&#39;;<br>CREATE USER &#39;appuser&#39;@&#39;10.0.12.%&#39; IDENTIFIED BY &#39;password&#39;;</pre><pre>GRANT ALL PRIVILEGES ON book_review_db.* TO &#39;appuser&#39;@&#39;10.0.11.%&#39;;<br>GRANT ALL PRIVILEGES ON book_review_db.* TO &#39;appuser&#39;@&#39;10.0.12.%&#39;;</pre><pre>FLUSH PRIVILEGES;</pre><p>Temporary troubleshooting fallback:</p><pre>CREATE USER &#39;appuser&#39;@&#39;%&#39; IDENTIFIED BY &#39;password&#39;;</pre><h3>Cross-Region Constraint</h3><p>During deployment, MySQL provisioning was unavailable in the intended region in Azure.</p><p>The database had to be deployed <strong>in a different region</strong>, which required:</p><ul><li>additional <strong>network/firewall configuration</strong></li><li>introduced <strong>cross-region latency</strong></li></ul><p>This is a realistic cloud constraint engineers often encounter.</p><h3>Step 6 — Deploy Frontend on Web VM</h3><p>Navigate to frontend directory:</p><pre>cd book-review-app/frontend</pre><p>Install dependencies:</p><pre>npm install</pre><p>Build production bundle:</p><pre>npm run build</pre><p>Run Next.js in production mode:</p><pre>npm start -- -p 3000</pre><h3>Frontend systemd Service</h3><p>Example service:</p><pre>[Unit]<br>Description=Book Review Frontend<br>After=network.target<br>[Service]<br>User=azureuser<br>WorkingDirectory=/home/azureuser/book-review-app/frontend<br>ExecStart=/usr/bin/npm start -- -p 3000<br>Restart=always<br>[Install]<br>WantedBy=multi-user.target</pre><h3>Step 7 — Configure Nginx Reverse Proxy</h3><p>Nginx routes requests to frontend and backend.</p><p>Full configuration example:</p><pre>server {<br>    listen 80;<br><br>    location / {<br>        proxy_pass http://127.0.0.1:3000;<br>        proxy_http_version 1.1;<br>        proxy_set_header Host $host;<br>    }<br><br>    location /api/ {<br>        proxy_pass http://&lt;internal-lb-ip&gt;:3001;<br>        proxy_http_version 1.1;<br>        proxy_set_header Host $host;<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8K6ZqQLd2Jx2lwXIVGOzsA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_DPb3Wj8klf5Wpi4BAdFA.png" /></figure><h3>Database Networking Model</h3><p>Azure MySQL Flexible Server uses:</p><ul><li><strong>delegated subnet</strong></li><li><strong>private networking</strong></li><li><strong>private DNS</strong></li></ul><p>The database is not deployed into multiple subnets directly; Azure manages high availability internally.</p><h3>Validation Checklist</h3><p>Deployment was verified using the following checks.</p><h3>Backend API</h3><pre>curl http://127.0.0.1:3001/api/books</pre><h3>Web → App connectivity</h3><pre>curl http://&lt;internal-lb-ip&gt;:3001/api/books</pre><h3>Nginx proxy</h3><pre>curl http://127.0.0.1/api/books</pre><h3>Database connectivity</h3><pre>nc -zv &lt;mysql-host&gt; 3306</pre><h3>End-to-End test</h3><p>Open in browser:</p><pre>http://&lt;public-load-balancer-ip&gt;</pre><p>Frontend loads and communicates with the backend successfully.</p><h3>Real Issues We Faced and Fixed</h3><p>Several practical problems occurred during deployment.</p><h3>VM Core Quotas</h3><p>Certain VM sizes were unavailable due to subscription limits.</p><h3>MySQL Provisioning Disabled</h3><p>Flexible Server was unavailable in one region.</p><h3>VNet Peering Failure</h3><p>CIDR overlap caused routing issues:</p><pre>10.0.0.0/16<br>10.0.0.0/24</pre><h3>Key Lessons From This Project</h3><p>This project reinforced several cloud architecture concepts:</p><ul><li>Designing <strong>secure multi-tier networks</strong></li><li>Implementing <strong>service isolation</strong></li><li>Troubleshooting <strong>real cloud infrastructure issues</strong></li><li>Deploying <strong>full-stack applications on Azure</strong></li></ul><h3>Final Thoughts</h3><p>Building a <strong>3-tier architecture on Azure</strong> is one of the best ways to understand how production systems operate.</p><p>This project provided practical experience with:</p><ul><li>cloud networking</li><li>load balancing</li><li>secure infrastructure design</li><li>backend and frontend deployment</li><li>troubleshooting distributed systems</li></ul><p>For anyone learning <strong>Cloud Engineering or DevOps</strong>, projects like this bridge the gap between <strong>theory and real infrastructure design</strong>.</p><p><strong>Grateful for the support throughout the DevOps Micro Internship Cohort‑2. Special thanks to </strong><a href="https://www.linkedin.com/in/pravin-mishra-aws-trainer/"><strong>Pravin Mishra</strong></a><strong> for the opportunity, Lead Co‑Mentor </strong><a href="https://www.linkedin.com/in/praveenpandey07/"><strong>Praveen Pandey</strong></a><strong> for the guidance, and and co-mentors </strong><a href="https://www.linkedin.com/in/emmanuelulu/"><strong>Emmanuel Ulu</strong></a><strong>, </strong><a href="https://www.linkedin.com/in/nkechiahanonye/"><strong>Nkechi Anna Ahanonye</strong></a><strong>, </strong><a href="https://www.linkedin.com/in/anisa-bibi/"><strong>Anisa Bibi</strong></a><strong> and </strong><a href="https://www.linkedin.com/in/akintade-aduroja/"><strong>Akintade Aduroja</strong></a><strong>. 🌟 👏</strong></p><p><strong>P.S. This post is part of the DevOps Micro Internship (DMI) Cohort-2 by </strong><a href="https://www.linkedin.com/in/pravin-mishra-aws-trainer/"><strong>Pravin Mishra</strong></a><strong>. You can start your DevOps journey by joining this Discord community (</strong><a href="https://lnkd.in/dQQ3nkCW"><strong>https://lnkd.in/dQQ3nkCW</strong></a><strong> ).</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2348eefd4818" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a React Application on AWS EC2 Using Nginx (with Real Troubleshooting Lessons)]]></title>
            <link>https://medium.com/@shivtrent800/deploying-a-react-application-on-aws-ec2-using-nginx-with-real-troubleshooting-lessons-78bcd7328ead?source=rss-e0ed6343a521------2</link>
            <guid isPermaLink="false">https://medium.com/p/78bcd7328ead</guid>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Shivam Soni]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 04:07:43 GMT</pubDate>
            <atom:updated>2026-02-02T04:07:43.044Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*SLO4xIVkVwR1beyq9RPaoQ.png" /></figure><p>Deploying a web application live on the internet is one of the most rewarding learning milestones for anyone entering the Cloud and DevOps space.</p><p>Recently, I completed a hands-on deployment task where I hosted a React application on an AWS EC2 instance using <strong>Nginx</strong> as the web server. The assignment helped me understand not only the deployment steps, but also the real-world troubleshooting mindset required in production environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*SLO4xIVkVwR1beyq9RPaoQ.png" /></figure><p>This post captures the full journey — from provisioning the server to validating logs and ensuring the deployment is production-ready.</p><h3>🌐 Why This Activity Matters</h3><p>Modern DevOps is not just about writing YAML files or launching servers. It’s about understanding:</p><ul><li>How applications reach users over the internet</li><li>How web servers like Nginx serve frontend builds</li><li>How small misconfigurations can cause outages</li><li>How to verify deployments using system and network tools</li></ul><p>This activity was a complete end-to-end learning experience.</p><h3>🛠 Step 1: Launching an AWS EC2 Instance</h3><p>The first step was provisioning an <strong>Ubuntu EC2 instance</strong> in AWS.</p><p>Once the instance was running, I connected to it securely via SSH:</p><pre>ssh -i key.pem ubuntu@&lt;public-ip&gt;</pre><p>This reinforced an important security practice:</p><p>✅ SSH access should always be key-based (no passwords shared).</p><h3>📦 Step 2: Installing Required Packages</h3><p>To prepare the server for deployment, I installed Node.js, npm, and Nginx:</p><pre>sudo apt update<br>sudo apt install -y nodejs npm nginx</pre><p>Then I verified the versions:</p><pre>node -v<br>npm -v</pre><p>And ensured Nginx was running:</p><pre>sudo systemctl start nginx<br>sudo systemctl enable nginx</pre><h3>📁 Step 3: Cloning the React Application Repository</h3><p>Next, I cloned the React project into the instance:</p><pre>git clone https://github.com/pravinmishraaws/my-react-app.git<br>cd my-react-app</pre><p>This step introduced the workflow of pulling application code directly onto a cloud VM.</p><h3>✍️ Step 4: Updating the Application Content</h3><p>As part of the assignment, I edited the React App.js file to include my name and deployment date:</p><pre>cd src<br>nano App.js</pre><p>This ensured the deployed build was uniquely identifiable.</p><h3>⚙️ Step 5: Building the React App for Production</h3><p>React applications must be compiled into static assets before serving via Nginx.</p><p>From the project root, I ran:</p><pre>npm install<br>npm run build</pre><p>This generated the production-ready build/ folder containing:</p><ul><li>index.html</li><li>Static JS/CSS bundles</li></ul><h3>🌍 Step 6: Deploying the Build to Nginx Web Root</h3><p>Nginx serves files from:</p><pre>/var/www/html</pre><p>So I copied the build output there:</p><pre>sudo rm -rf /var/www/html/*<br>sudo cp -r build/* /var/www/html/<br>sudo chown -R www-data:www-data /var/www/html<br>sudo chmod -R 755 /var/www/html</pre><h3>🔧 Step 7: Configuring Nginx for React SPA Routing</h3><p>React is a Single Page Application (SPA), meaning routes must redirect back to index.html.</p><p>So I updated the default Nginx config:</p><pre>echo &#39;server {<br>  listen 80;<br>  server_name _;<br>  root /var/www/html;<br>  index index.html;<br> <br>  location / {<br>    try_files $uri /index.html;<br>  }<br> <br>  error_page 404 /index.html;<br>}&#39; | sudo tee /etc/nginx/sites-available/default &gt; /dev/null</pre><p>Then I tested the config before restarting:</p><pre>sudo nginx -t<br>sudo systemctl restart nginx</pre><p>This is a critical production habit:</p><p>✅ Always validate config before restart to avoid downtime.</p><p><strong>Test the App</strong><br>Get your public IP:</p><pre>curl ifconfig.me</pre><p>Access it in your browser:</p><pre>http://&lt;your-public-ip&gt;</pre><h3>🧪 Step 8: Debugging a Real Deployment Issue</h3><p>Initially, my site timed out in the browser.</p><p>Instead of guessing, I followed structured troubleshooting:</p><h3>Confirm Nginx is listening:</h3><pre>sudo ss -tulpen | grep :80</pre><h3>Check service status:</h3><pre>systemctl status nginx</pre><h3>Inspect logs:</h3><pre>sudo tail -n 30 /var/log/nginx/access.log<br>sudo journalctl -u nginx -n 50</pre><p>The logs confirmed successful 200 OK responses and even showed my curl requests:</p><pre>&quot;GET / HTTP/1.1&quot; 200 ... &quot;curl/8.5.0&quot;</pre><p>That gave me confidence that deployment was correct.</p><h3>📊 Step 9: Verifying Server Health</h3><p>In production, deployment is incomplete without monitoring resources.</p><p>So I checked:</p><h3>Uptime &amp; load:</h3><pre>uptime</pre><h3>Memory usage:</h3><pre>free -h</pre><h3>Disk usage:</h3><pre>df -h</pre><h3>Largest directories:</h3><pre>sudo du -sh /var/* | sort -h</pre><p>This ensured the instance had enough baseline capacity.</p><h3>✅ Final Outcome</h3><p>By the end of this activity:</p><p>✅ React app successfully deployed via Nginx</p><p>✅ Static assets served correctly</p><p>✅ Logs confirmed healthy traffic</p><p>✅ Nginx enabled on boot</p><p>✅ Only required ports were exposed (22 &amp; 80)</p><p>The application was accessible through the EC2 public IP.</p><h3>💡 Key Takeaways</h3><p>This assignment taught me something very valuable:</p><blockquote><em>Real DevOps learning happens while debugging real problems.</em></blockquote><p>Small issues like:</p><ul><li>Wrong build location</li><li>Missing permissions</li><li>Incorrect web root</li><li>Misconfigured routing</li></ul><p>Can cause major production outages.</p><p>But with fundamentals, logs, and patience, solutions become clear.</p><h3>🙌 Closing Thoughts</h3><p>This hands-on deployment was part of my journey in the <strong>DevOps Micro Internship (DMI Cohort-2)</strong> by <a href="https://www.linkedin.com/in/pravin-mishra-aws-trainer/">Pravin Mishra</a>.</p><p>I’m grateful for the mentorship and the real-world mindset this program encourages.</p><p>P.S. You can start your DevOps journey by joining this Discord community ( <a href="https://lnkd.in/dQQ3nkCW">https://lnkd.in/dQQ3nkCW</a> ).</p><p>More deployments and deeper cloud projects ahead 🚀</p><h3>🔖 Tags</h3><p>#AWS #EC2 #Nginx #ReactJS #DevOps #CloudComputing #Linux #Deployment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78bcd7328ead" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD and GitOps Pipeline with Jenkins, Docker Hub, and ArgoCD]]></title>
            <link>https://medium.com/@shivtrent800/ci-cd-and-gitops-pipeline-with-jenkins-docker-hub-and-argocd-0a40e7499063?source=rss-e0ed6343a521------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a40e7499063</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Shivam Soni]]></dc:creator>
            <pubDate>Mon, 16 Jun 2025 22:25:49 GMT</pubDate>
            <atom:updated>2025-06-16T22:25:49.597Z</atom:updated>
            <content:encoded><![CDATA[<p>The developer pushes code to a GitHub repo, triggering Jenkins to build and push a Docker image and update Kubernetes manifests. ArgoCD then pulls the updated manifests (using GitOps principles) to deploy into the Kubernetes cluster.</p><p>ArgoCD is a “declarative, GitOps continuous delivery tool for Kubernetes”. In this flow, Git repositories are the source of truth. When Jenkins updates a manifest in the Git repo, ArgoCD automatically syncs it to the cluster.</p><h3>1. Clone the Project Repository</h3><p>Begin by cloning the Git repository containing the Flask app, Dockerfile, Jenkinsfile, and Kustomize manifests. For example:</p><pre>git clone https://github.com/ShivamSoni1995/Flask-App-ArgoCD.git</pre><p>This repo should include your Flask source (e.g. <a href="http://app.py/">app.py</a>), Dockerfile, a Jenkinsfile, and a kustomize/ directory with Kubernetes manifests.</p><h3>2. Flask App and Dockerfile</h3><p>Create a simple Flask application (e.g. app/<a href="http://app.py/">app.py</a>) and a requirements.txt. For example:</p><pre>from flask import Flask<br>app = Flask(__name__)</pre><pre>@app.route(&quot;/&quot;)<br>def hello():<br>    return &quot;Hello from Flask!&quot;</pre><pre>if __name__ == &quot;__main__&quot;:<br>    app.run(host=&#39;0.0.0.0&#39;, port=80)</pre><p>Include a Dockerfile to containerize it. For instance:</p><pre>FROM python:3.9-slim<br>WORKDIR /app<br>COPY requirements.txt .<br>RUN pip install -r requirements.txt<br>COPY . .<br>CMD [&quot;python&quot;, &quot;app.py&quot;]</pre><p>This builds a Docker image with the Flask app. Push this code to GitHub so Jenkins can build it.</p><h3>3. Kubernetes Manifests with Kustomize</h3><p>Define your Deployment and Service YAML under a Kustomize base. These are the deployment and service YAML</p><pre># kustomize/base/deployment.yaml<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: flask-app<br>  labels:<br>    app: flask-app<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: flask-app<br>  template:<br>    metadata:<br>      labels:<br>        app: flask-app<br>    spec:<br>      containers:<br>      - name: flask-app<br>        image: youruser/flask-app:v1       # initial tag<br>        ports:<br>        - containerPort: 80<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: flask-app-svc<br>spec:<br>  type: LoadBalancer<br>  selector:<br>    app: flask-app<br>  ports:<br>    - port: 80<br>      targetPort: 80</pre><p>Using Kustomize makes it easy to patch image tags. ArgoCD natively supports Kustomize applications.</p><p>Kustomization.yaml</p><pre># kustomize/base/kustomization.yaml<br>resources:<br>- deployment.yaml<br>- service.yaml</pre><h3>4. Jenkins Pipeline (CI)</h3><p>Create a Jenkinsfile (declarative pipeline) to build, tag, and push the Docker image, then update the manifest in Git. Key stages:</p><pre>pipeline {<br>  agent any</pre><pre>  environment {<br>    IMAGE = &quot;shivamsoni1995/flask-app-argocd&quot;<br>    TAG = &quot;v${BUILD_NUMBER}&quot;<br>    BRANCH = &quot;main&quot;<br>    GIT_REPO = &quot;https://github.com/ShivamSoni1995/Flask-App-ArgoCD.git&quot;<br>  }</pre><pre>  stages {<br>    stage(&#39;Checkout&#39;) {<br>      steps {<br>        git branch: &quot;${BRANCH}&quot;, credentialsId: &#39;github-creds&#39;, url: &quot;${GIT_REPO}&quot;<br>      }<br>    }</pre><pre>    stage(&#39;Build &amp; Push Docker Image&#39;) {<br>      steps {<br>        withCredentials([usernamePassword(credentialsId: &#39;dockerhub-creds&#39;, usernameVariable: &#39;DOCKER_USER&#39;, passwordVariable: &#39;DOCKER_PASS&#39;)]) {         <br>          sh &quot;docker build -t ${IMAGE}:${TAG} .&quot;<br>          sh &quot;echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin&quot;<br>          sh &quot;docker push ${IMAGE}:${TAG}&quot;<br>        }<br>      }<br>    }</pre><pre>    stage(&#39;Update Image in deployment.yml&#39;) {<br>      steps {<br>        sh &quot;yq e &#39;.spec.template.spec.containers[0].image = \&quot;${IMAGE}:${TAG}\&quot;&#39; -i deployment.yml&quot;<br>      }<br>    }</pre><pre>    stage(&#39;Commit &amp; Push updated deployment.yml&#39;) {<br>      steps {<br>        withCredentials([usernamePassword(credentialsId: &#39;github-creds&#39;, usernameVariable: &#39;GIT_USER&#39;, passwordVariable: &#39;GIT_PASS&#39;)]) {<br>          sh &quot;&quot;&quot;<br>            git config user.name &quot;jenkins-bot&quot;<br>            git config user.email &quot;jenkins-bot@example.com&quot;<br>            git add deployment.yml<br>            git commit -m &quot;Update image tag to ${TAG} [ci skip]&quot; || echo &#39;No changes&#39;<br>            git push <a href="https://$%7BGIT_USER%7D:$%7BGIT_PASS%7D@github.com/ShivamSoni1995/Flask-App-ArgoCD.git">https://${GIT_USER}:${GIT_PASS}@github.com/ShivamSoni1995/Flask-App-ArgoCD.git</a> ${BRANCH}<br>          &quot;&quot;&quot;</pre><pre>        }<br>      }<br>    }<br>  }</pre><pre>  post {<br>    always {<br>      cleanWs()<br>    }<br>  }<br>}</pre><p>This pipeline first builds youruser/flask-app:${BUILD_NUMBER} and pushes to Docker Hub. It then clones the GitOps repo, updates the deployment.yaml with the new image tag (using yq), commits, and pushes. Ensure you add your Docker Hub credentials (dockerhub-creds) and any necessary GitHub credentials to Jenkins.</p><h3>5. Register the GitOps Repository in ArgoCD</h3><p>Install ArgoCD on your cluster and expose its server (e.g. via kubectl patch svc argocd-server to LoadBalancer). Get the initial admin password:</p><pre>kubectl -n argocd get secret argocd-initial-admin-secret -o \<br>  jsonpath=&quot;{.data.password}&quot; | base64 -d</pre><p>Then log in (web UI or CLI) using user admin. In ArgoCD, connect the GitHub repo (the one with Kustomize manifests) so ArgoCD can pull it. For example, via CLI:</p><pre>argocd login &lt;ARGOCD_SERVER&gt;<br>argocd repo add https://github.com/youruser/gitops-flask.git \<br>  --username youruser --password &lt;GitHubToken&gt;</pre><p>This adds the repo (see example syntax). Alternatively, create a Kubernetes secret of type <a href="http://argocd.argoproj.io/secret-type">argocd.argoproj.io/secret-type</a>: repository with username and password for GitHub. ArgoCD will use this to fetch manifests.</p><h3>6. Create the ArgoCD Application</h3><p>Define an ArgoCD Application resource (or use the UI) that points to your manifest repo. Example flask-app-argocd.yaml</p><pre>apiVersion: argoproj.io/v1alpha1<br>kind: Application<br>metadata:<br>  name: flask-app<br>  namespace: argocd<br>spec:<br>  project: default<br>  source:<br>    repoURL: https://github.com/ShivamSoni1995/Flask-App-ArgoCD<br>    targetRevision: HEAD<br>    path: .<br>  destination:<br>    server: https://kubernetes.default.svc<br>    namespace: default<br>  syncPolicy:<br>    automated:<br>      prune: true<br>      selfHeal: true</pre><p>This tells ArgoCD to deploy the kustomize/base manifests from the repo into the default namespace. (The format follows ArgoCD’s spec.) The automated syncPolicy ensures ArgoCD applies changes immediately.</p><p>Apply this manifest with kubectl:</p><pre>kubectl apply -n argocd -f argo-application.yaml</pre><p>ArgoCD will then create and sync the app. In the ArgoCD UI you should see the flask-app Application with a green sync status.</p><h3>7. Run Jenkins and Verify Deployment</h3><p>Trigger the Jenkins job (e.g. by pushing a change or manually). Jenkins will build the Docker image, push it, and commit the updated manifest. ArgoCD will detect the Git change and automatically sync to the cluster. You can verify by:</p><pre>kubectl get pods -l app=flask-app<br>kubectl get svc flask-app-svc</pre><p>The service’s external IP should expose your Flask app. Access it to confirm the deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*S7X-YjGH1IuBr0Emct7P1Q.png" /></figure><p>By combining Jenkins for CI (building images) and ArgoCD for CD (GitOps deployment), this pipeline automates the full workflow. Jenkins handles the multi-stage build/test cycle (Jenkins pipelines are Groovy scripts defining multi-stage workflows), and ArgoCD continuously reconciles the cluster with the git-stored manifests. This ensures reliable, automated delivery of the Flask application into Kubernetes.</p><p>Github repo: <a href="https://github.com/ShivamSoni1995">https://github.com/ShivamSoni1995</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a40e7499063" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>