A production-grade DevSecOps pipeline implementing security best practices, automated deployments, and comprehensive monitoring
Features • Architecture • Prerequisites • Quick Start • Documentation
- Overview
- Features
- Architecture
- Tech Stack
- Prerequisites
- Installation
- Pipeline Stages
- Monitoring Setup
- Domain Configuration
- Security
- Troubleshooting
- Contributing
- License
This project demonstrates a complete DevSecOps pipeline for deploying an Amazon clone application on AWS EKS. It integrates security scanning, automated testing, container orchestration, and GitOps practices to create a robust, production-ready deployment workflow.
---Access the live application at:
https://amazon.rohandevops.co.in
- SonarQube - Static code analysis and quality gates
- Trivy - Filesystem and container image vulnerability scanning
- OWASP Dependency Check - Third-party dependency scanning
- Quality Gates - Automated security thresholds enforcement
- Jenkins Pipeline - Automated build, test, and deployment
- ArgoCD - GitOps-based continuous delivery
- Docker - Containerization and image management
- AWS EKS - Production-grade Kubernetes cluster
- Prometheus - Metrics collection and alerting
- Grafana - Visualization dashboards
- Node Exporter - System-level metrics
- Jenkins Metrics - Pipeline performance monitoring
- AWS Load Balancer Controller - Ingress management
- Route 53 - DNS management
- ACM - SSL/TLS certificate management
- Host-based routing - Domain-based traffic routing
┌─────────────────────────────────────────────────────────────────┐
│ Developer │
│ ↓ │
│ Git Push (GitHub) │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ Jenkins Pipeline │
│ ┌──────────┬──────────┬──────────┬──────────┬──────────┐ │
│ │SonarQube │ Trivy │ Build │ Push │ Deploy │ │
│ │ Scan │ Scan │ Docker │DockerHub │Container │ │
│ └──────────┴──────────┴──────────┴──────────┴──────────┘ │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ ArgoCD (GitOps) │
│ Auto-sync with Git repo │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ AWS EKS Cluster (Kubernetes) │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Application Pods with Load Balancer │ │
│ └──────────────────────────────────────────────────────────┘ │
│ ↑ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Prometheus + Grafana (Monitoring Stack) │ │
│ └──────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
↓
Route 53 + ACM (DNS + SSL)
↓
End Users
| Category | Technologies |
|---|---|
| Cloud Platform | AWS (EC2, EKS, Route 53, ACM, IAM) |
| Container Orchestration | Kubernetes, Helm, eksctl |
| CI/CD | Jenkins, ArgoCD |
| Security | SonarQube, Trivy, OWASP Dependency Check |
| Monitoring | Prometheus, Grafana, Node Exporter |
| Container Runtime | Docker |
| IaC & Config | kubectl, AWS CLI |
| Programming | Node.js, JavaScript |
| Version Control | Git, GitHub |
Before starting, ensure you have:
- AWS Account with appropriate permissions
- GitHub account
- Domain name (GoDaddy or any registrar)
- Basic understanding of:
- Linux commands
- Docker & Kubernetes
- CI/CD concepts
- AWS services
- EC2 Instance: t2.xlarge or higher
- OS: Ubuntu 22.04 LTS
- Storage: Minimum 30GB
- Security Group: Ports 22, 80, 443, 8080, 9000, 9090, 9100, 3000 open
# Update system
sudo apt update && sudo apt upgrade -y
# Install common tools
sudo apt install -y bash-completion wget git zip unzip curl jq net-tools \
build-essential ca-certificates apt-transport-https gnupg fontconfig
# Source bash completion
source /etc/bash_completion# Jenkins
sudo apt install fontconfig openjdk-21-jre -y
sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt update && sudo apt install jenkins -y
sudo systemctl enable --now jenkins
# Docker
sudo apt-get install docker.io -y
sudo usermod -aG docker $USER
sudo usermod -aG docker jenkins
sudo chmod 660 /var/run/docker.sock
sudo systemctl restart docker
# AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && sudo ./aws/install
# kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
# eksctl
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
# Helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# Trivy
wget -qO - https://get.trivy.dev/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://get.trivy.dev/deb generic main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy -yAccess Jenkins at http://<your-ec2-ip>:8080
# Get initial admin password
sudo cat /var/lib/jenkins/secrets/initialAdminPasswordRequired Jenkins Plugins:
- Eclipse Temurin installer
- NodeJS
- Email Extension
- OWASP Dependency-Check
- SonarQube Scanner
- Prometheus metrics
- Docker Pipeline
- Docker plugins suite
docker run -d --name sonarqube \
-p 9000:9000 \
-v sonarqube_data:/opt/sonarqube/data \
-v sonarqube_logs:/opt/sonarqube/logs \
-v sonarqube_extensions:/opt/sonarqube/extensions \
sonarqube:lts-communityAccess at http://<your-ec2-ip>:9000 (default: admin/admin)
eksctl create cluster \
--name devsecops \
--region us-west-2 \
--node-type m7i-flex.large \
--nodes 2 \
--with-oidc
aws eks update-kubeconfig --name devsecops --region us-west-2# Download IAM policy
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.13.3/docs/install/iam_policy.json
# Create IAM policy
aws iam create-policy \
--policy-name AWSLoadBalancerControllerIAMPolicy \
--policy-document file://iam_policy.json
# Create service account
eksctl create iamserviceaccount \
--cluster=devsecops \
--namespace=kube-system \
--name=aws-load-balancer-controller \
--attach-policy-arn=arn:aws:iam::<YOUR-ACCOUNT-ID>:policy/AWSLoadBalancerControllerIAMPolicy \
--override-existing-serviceaccounts \
--approve
# Install via Helm
helm repo add eks https://aws.github.io/eks-charts
helm repo update eks
helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
-n kube-system \
--set clusterName=devsecops \
--set serviceAccount.create=false \
--set serviceAccount.name=aws-load-balancer-controllerhelm repo add argo https://argoproj.github.io/argo-helm
kubectl create namespace argocd
helm install argocd argo/argo-cd --namespace argocd
# Change service to LoadBalancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
# Get password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -dThe Jenkins pipeline includes the following stages:
- Clean Workspace - Ensures clean build environment
- Git Checkout - Pulls latest code from repository
- SonarQube Analysis - Static code analysis
- Quality Gate - Enforces quality standards
- Install Dependencies - NPM package installation
- Trivy FS Scan - Scans filesystem for vulnerabilities
- Build Docker Image - Creates container image
- Tag & Push - Pushes to DockerHub
- Trivy Image Scan - Scans container image
- Deploy to Container - Deploys to staging
- Email Notification - Sends build report
sudo useradd --system --no-create-home --shell /usr/sbin/nologin prometheus
wget -O prometheus.tar.gz "https://github.com/prometheus/prometheus/releases/download/v3.6.0/prometheus-3.6.0.linux-amd64.tar.gz"
tar -xvf prometheus.tar.gz
cd prometheus-*/
sudo mkdir -p /data /etc/prometheus
sudo mv prometheus promtool /usr/local/bin/
sudo mv prometheus.yml /etc/prometheus/
sudo chown -R prometheus:prometheus /etc/prometheus /data
sudo systemctl enable --now prometheussudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update && sudo apt-get install -y grafana
sudo systemctl enable --now grafana-serverAccess Grafana at http://<your-ec2-ip>:3000 (default: admin/admin)
| Dashboard | ID | Purpose |
|---|---|---|
| Node Exporter Full | 1860 | System metrics |
| Jenkins Performance | 9964 | Jenkins monitoring |
| Kubernetes Dashboard | 18283 | K8s cluster metrics |
| EKS Cluster | 17119 | EKS-specific metrics |
- Create hosted zone with your domain name
- Add wildcard domain:
*.yourdomain.com - Copy all 4 nameservers
- Go to GoDaddy DNS settings
- Change nameservers to Route 53 nameservers
- Wait for propagation (up to 48 hours)
- Go to AWS Certificate Manager
- Request public certificate for
yourdomain.com - Create DNS validation records in Route 53
- Copy certificate ARN
Edit k8s-hostbased-https/ingress.yaml:
annotations:
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:region:account:certificate/id
spec:
rules:
- host: amazon.yourdomain.com- Name:
amazon - Type: A Record
- Alias: Yes
- Target: ALB created by ingress
Store sensitive credentials in Jenkins:
- SonarQube Token - ID:
sonar-token - DockerHub Token - ID:
docker-cred - AWS Credentials - Configure via AWS CLI
- ✅ All passwords stored as Jenkins credentials
- ✅ Regular vulnerability scanning with Trivy
- ✅ Code quality gates with SonarQube
- ✅ HTTPS enforced via ACM certificates
- ✅ IAM roles for EKS with OIDC
- ✅ Network policies in Kubernetes
- ✅ Security groups properly configured
Jenkins not starting
sudo systemctl status jenkins
sudo journalctl -u jenkins -n 50Docker permission denied
sudo usermod -aG docker $USER
newgrp dockerEKS cluster not accessible
aws eks update-kubeconfig --name devsecops --region us-west-2
kubectl get nodesArgoCD application not syncing
kubectl get pods -n argocd
kubectl logs -n argocd deployment/argocd-serverPrometheus not scraping metrics
promtool check config /etc/prometheus/prometheus.yml
sudo systemctl restart prometheus- Jenkins Pipeline Documentation
- ArgoCD Documentation
- AWS EKS Best Practices
- Prometheus Documentation
- Trivy Documentation
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Jenkins community for excellent CI/CD tools
- ArgoCD team for GitOps implementation
- Prometheus & Grafana for monitoring solutions
- Aqua Security for Trivy scanner
- AWS for cloud infrastructure
⭐ Star this repository if you find it helpful!
Made with ❤️ by DevSecOps Team


