Skip to content

Repository files navigation

Cloud-Native DevSecOps Three-Tier Application on AWS EKS πŸš€

LinkedIn GitHub Live App Grafana

AWS Kubernetes Terraform Jenkins ArgoCD Docker


🌐 Live Deployment

Cloud Native Task Manager


Welcome to the Cloud-Native DevSecOps Three-Tier Application Deployment project! πŸš€

This repository hosts the implementation of a Three-Tier Web App using ReactJS, Node.js, PostgreSQL, and Redis, deployed on AWS EKS. The entire platform is Infrastructure as Code β€” from bootstrap to teardown, every component is declarative and automated.

⚑ Built across 4 deployment cycles. 17 production issues encountered and resolved. Every fix is documented. This is not a tutorial follow-along.


πŸ“– Project Overview

πŸ› οΈ Infrastructure as Code β€” Everything Automated:

  • Terraform provisions Jenkins server, EKS cluster, VPC, ALB controller, EBS CSI driver, ExternalDNS, and Prometheus/Grafana monitoring
  • JCasC (Jenkins Configuration as Code) auto-configures plugins, credentials, SonarQube, and pipeline jobs β€” zero UI clicking
  • ArgoCD App-of-Apps pattern deploys all application components from a single kubectl apply
  • ExternalDNS auto-creates Route 53 records from Ingress annotations
  • Bootstrap + Destroy scripts for full lifecycle management

🚒 The deployment covers:

  1. Bootstrap β€” S3, DynamoDB, ECR, key pair (one idempotent script)
  2. Jenkins Server β€” Terraform + JCasC with 102 pre-installed plugins and automated SonarQube setup
  3. EKS Cluster β€” Terraform creates VPC, cluster, node groups, OIDC, EBS CSI, ALB controller, ExternalDNS, and monitoring stack
  4. Application Deployment β€” ArgoCD App-of-Apps deploys database, backend, frontend, ingress, and Grafana ingress
  5. CI/CD Pipeline β€” 9-stage DevSecOps pipeline with SonarQube + Trivy + ECR + GitOps
  6. Teardown β€” Ordered destroy script

πŸ—οΈ Architecture

Architecture Diagram


πŸ“Έ Deployment Evidence

Jenkins CI/CD Pipelines β€” 9 Stages Green

Backend Pipeline Frontend Pipeline

ArgoCD β€” All Apps Synced & Healthy

ArgoCD

SonarQube β€” Quality Gate Passed

SonarQube

Grafana β€” Three-Tier Namespace Monitoring

Grafana

Route 53 β€” DNS Records Auto-Created by ExternalDNS

Route53


CI/CD Flow:

Code Push β†’ Jenkins β†’ SonarQube Analysis β†’ Quality Gate β†’ Trivy FS Scan
    β†’ Docker Build β†’ Trivy Image Scan β†’ Push to ECR
    β†’ Update K8s Manifest in Git β†’ ArgoCD Auto-Deploy β†’ EKS

DNS Flow (Automated):

Ingress Annotation β†’ ExternalDNS β†’ Route 53 A Record β†’ ALB
platinum-consults.com         β†’ App ALB
grafana.platinum-consults.com β†’ Grafana ALB

🧰 Tech Stack

Layer Technology Purpose
☁️ Cloud AWS (us-east-1) EKS, ECR, ALB, Route 53, IAM, EBS, S3
⎈ Orchestration Kubernetes (EKS) Container orchestration, service discovery
βš›οΈ Frontend React + Nginx SPA served via multi-stage Docker build (~25MB)
🟒 Backend Node.js + Express REST API with health checks, CRUD, Redis caching
🐘 Database PostgreSQL 15 Persistent storage with PVC on EBS
πŸ”΄ Cache Redis 7 Alpine In-memory caching with TTL, LRU eviction
πŸ”§ CI/CD Jenkins + JCasC 9-stage automated DevSecOps pipeline, zero-click setup
πŸ” Code Quality SonarQube Static analysis, quality gates (auto-configured)
πŸ›‘οΈ Security Trivy Filesystem + image vulnerability scanning
πŸ”„ GitOps ArgoCD App-of-Apps pattern, automatic deployment from Git
πŸ“ IaC Terraform Full stack β€” Jenkins, EKS, VPC, ALB, DNS, monitoring
πŸ“Š Monitoring Prometheus + Grafana Metrics, dashboards, custom alerts (Terraform-managed)
🌐 DNS Route 53 + ExternalDNS Automatic DNS from Ingress annotations
πŸ“¦ Registry Amazon ECR Private Docker image storage
πŸšͺ Ingress AWS LB Controller L7 load balancing, path-based routing

πŸ“ Repository Structure

cloud-native-eks/
β”œβ”€β”€ πŸ“‚ Application-Code/
β”‚   β”œβ”€β”€ πŸ“‚ backend/                    # Node.js Express API
β”‚   β”‚   β”œβ”€β”€ server.js                   # CRUD API + health checks + Redis caching
β”‚   β”‚   β”œβ”€β”€ Dockerfile                  # Alpine-based, non-root user, healthcheck
β”‚   β”‚   └── package.json
β”‚   └── πŸ“‚ frontend/                   # React Single Page Application
β”‚       β”œβ”€β”€ src/App.js                  # Task manager with live health indicators
β”‚       β”œβ”€β”€ Dockerfile                  # Multi-stage build (Node β†’ Nginx, ~25MB)
β”‚       └── nginx.conf                  # SPA routing, security headers
β”œβ”€β”€ πŸ“‚ EKS-Terraform/                  # ⭐ Full EKS IaC (replaces eksctl)
β”‚   β”œβ”€β”€ main.tf                         # VPC, EKS cluster, node groups, OIDC
β”‚   β”œβ”€β”€ ebs-csi.tf                      # EBS CSI driver addon + IRSA
β”‚   β”œβ”€β”€ alb-controller.tf               # ALB controller IAM + IRSA
β”‚   β”œβ”€β”€ helm-alb.tf                     # ALB controller Helm release
β”‚   β”œβ”€β”€ helm-monitoring.tf              # Prometheus + Grafana Helm release
β”‚   β”œβ”€β”€ external-dns-iam.tf             # ExternalDNS IAM + Route 53 hosted zone
β”‚   β”œβ”€β”€ helm-external-dns.tf            # ExternalDNS Helm release
β”‚   β”œβ”€β”€ namespaces.tf                   # three-tier, monitoring, argocd
β”‚   β”œβ”€β”€ providers.tf                    # Kubernetes + Helm providers
β”‚   β”œβ”€β”€ variables.tf                    # All configurable values
β”‚   β”œβ”€β”€ outputs.tf                      # Cluster endpoint, kubectl command
β”‚   └── backend.tf                      # S3 remote state
β”œβ”€β”€ πŸ“‚ Jenkins-Server-TF/
β”‚   β”œβ”€β”€ main.tf                         # EC2, SG, IAM role + EKS inline policy
β”‚   β”œβ”€β”€ tools-install.sh                # 13 tools + 102 plugins pre-installed
β”‚   └── πŸ“‚ jcasc/
β”‚       β”œβ”€β”€ jenkins.yaml                # JCasC config
β”‚       └── setup-jcasc.sh             # One-command secret injection
β”œβ”€β”€ πŸ“‚ Jenkins-Pipeline-Code/
β”‚   β”œβ”€β”€ Jenkinsfile-Backend             # 9-stage DevSecOps pipeline
β”‚   └── Jenkinsfile-Frontend            # 9-stage DevSecOps pipeline
β”œβ”€β”€ πŸ“‚ Kubernetes-Manifests-file/
β”‚   β”œβ”€β”€ πŸ“‚ Database/
β”‚   β”‚   β”œβ”€β”€ postgres.yaml               # Secret + PVC + Deployment + Service
β”‚   β”‚   └── redis.yaml                  # Deployment + Service
β”‚   β”œβ”€β”€ πŸ“‚ Backend/ & Frontend/
β”‚   β”‚   └── deployment.yaml             # Deployment + Service
β”‚   β”œβ”€β”€ ingress.yaml                    # ALB + ExternalDNS annotation
β”‚   β”œβ”€β”€ grafana-ingress.yaml            # Grafana ALB + ExternalDNS subdomain
β”‚   └── monitoring-alerts.yaml          # Custom PrometheusRule (5 alerts)
β”œβ”€β”€ πŸ“‚ argocd/
β”‚   β”œβ”€β”€ app-of-apps.yaml                # ⭐ Root app (one kubectl apply)
β”‚   └── πŸ“‚ apps/                       # Child apps auto-created
β”œβ”€β”€ πŸ“‚ assets/
β”‚   β”œβ”€β”€ architecture.png                # Architecture diagram
β”‚   β”œβ”€β”€ app-live.png                    # Live app screenshot
β”‚   β”œβ”€β”€ argocd-dashboard.png            # ArgoCD all apps synced
β”‚   β”œβ”€β”€ grafana-dashboard.png           # Grafana three-tier metrics
β”‚   β”œβ”€β”€ jenkins-pipelines-backend.png   # Backend pipeline 9 stages green
β”‚   β”œβ”€β”€ jenkins-pipelines-frontend.png  # Frontend pipeline 9 stages green
β”‚   β”œβ”€β”€ route53-records.png             # ExternalDNS auto-created records
β”‚   └── sonarqube-quality-gate.png      # Both projects passed
β”œβ”€β”€ πŸ“‚ docs/
β”‚   β”œβ”€β”€ DEPLOYMENT-GUIDE.md
β”‚   └── ISSUES-REPORT.md
β”œβ”€β”€ bootstrap.sh                        # ⭐ One-command prerequisite setup
β”œβ”€β”€ destroy.sh                          # ⭐ Ordered teardown script
└── README.md

βœ… Prerequisites

  • AWS Account with IAM user
  • AWS CLI v2 configured
  • Terraform >= 1.9.0
  • vCPU quota β‰₯ 20
  • Git & GitHub account with PAT
  • Domain name with ability to change nameservers

πŸš€ Deployment Guide (5 Commands)

# 1. Bootstrap
bash bootstrap.sh

# 2. Deploy Jenkins
cd Jenkins-Server-TF && terraform init && terraform apply -auto-approve

# 3. Setup Jenkins (one interactive command)
ssh -i test.pem ubuntu@<jenkins-ip>
sudo bash /opt/setup-jcasc.sh

# 4. Deploy EKS + everything
cd EKS-Terraform && terraform init && terraform apply -auto-approve

# 5. Deploy apps
kubectl apply -f argocd/app-of-apps.yaml

πŸ“– Full Deployment Guide | ⚠️ Issues Report


πŸ”„ CI/CD Pipeline Stages

# Stage Tool Purpose
1 🧹 Cleanup Jenkins Fresh workspace
2 πŸ“₯ Checkout Git Clone repo
3 πŸ” SonarQube sonar-scanner Code quality
4 βœ… Quality Gate SonarQube Pass/fail
5 πŸ›‘οΈ Trivy FS Trivy Source scan
6 🐳 Docker Build Docker Build image
7 πŸ›‘οΈ Trivy Image Trivy Image CVEs
8 πŸ“€ Push ECR AWS ECR Private registry
9 πŸ“ Update Manifest sed + git Trigger ArgoCD

πŸ“Š Monitoring & Alerts

Component Access
Grafana grafana.platinum-consults.com
Prometheus Internal (ClusterIP)
Alertmanager Internal (ClusterIP)
Alert Severity
πŸ”΄ PodDown Critical
🟑 HighCPUUsage Warning
πŸ”΄ PodCrashLooping Critical
πŸ”΄ PostgreSQLDown Critical
πŸ”΄ RedisDown Critical

⚠️ Challenges & Solutions

17 issues across 4 deployments β€” Full Report

# Challenge Solution
1 eks:DescribeClusterVersions denied EKS inline policy in Terraform
2 Instance profile creds cached Export credentials directly
3 npm ci build failure npm install --omit=dev
4 ArgoCD CRD too large --server-side --force-conflicts
5 ArgoCD overwrote pods Push to Git before ArgoCD
6 Pods Pending (pod limit) t3.xlarge (58 pods/node)
7 vCPU quota limit Request increase to 20
8 Quality Gate timeout Webhook via private IP
9 SCM credential empty Username with password type
10 sonar-scanner not found jenkins-plugin-manager JAR
11 ALB not provisioning Broader IAM in Terraform
12 ImagePullBackOff sed regex to correct tags
13 Ingress ADDRESS empty Delete and reapply
14 JCasC sonarGlobalConfiguration Groovy init script
15 Plugin dependency hell jenkins-plugin-manager JAR
16 SonarQube rejects localhost Private IP for webhook
17 Grafana wrong datasource Clean old configmaps, Terraform manages monitoring

πŸ“ˆ Reports

Automation Report

Phase Before After
Prerequisites 6 CLI commands bash bootstrap.sh
Jenkins 15+ UI clicks terraform apply + setup-jcasc.sh
EKS + networking eksctl + 8 commands terraform apply (41 resources)
Monitoring Manual helm + config Terraform Helm provider
DNS Console clicking ExternalDNS (automatic)
Apps 3 ArgoCD UI forms kubectl apply -f app-of-apps.yaml
Teardown 8 commands bash destroy.sh

Security Report

Check Tool Result
Code Quality SonarQube βœ… Passed
Source CVEs Trivy FS βœ… Clean
Image CVEs Trivy Image βœ… Scanned
Secrets JCasC + K8s Secrets βœ… No hardcoded
IAM IRSA per service βœ… Least privilege
Database ClusterIP βœ… Not exposed

🧹 Cleanup

bash destroy.sh

πŸ‘€ Author

Ibrahim β€” DevOps Engineer

GitHub Live App Grafana


πŸ“„ License

MIT License β€” see LICENSE for details.

Happy Deploying! πŸš€

About

Three-tier app on AWS EKS: React + Node.js + PostgreSQL - full IaC with Terraform, GitOps via ArgoCD, Jenkins JCasC, SonarQube, Trivy security scanning, and Prometheus/Grafana monitoring | 17 production issues documented

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages