Skip to content

mostafaibrahim24/devsecops-gitops-cicd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevSecOps CI/CD Pipeline with GitOps Deployment on Amazon EKS

This project showcases an end-to-end CI/CD pipeline showcasing DevSecOps practices, Infrastructure as Code, GitOps, and Monitoring for deploying resilient multi-tier applications on Kubernetes (Amazon EKS).

The Project Diagram

Blank diagram

Repositories 📦

  • Where feature code and pipeline/workflow definition lives (Current repo)
  • K8s Manifests Click Here
  • Infrastructure-as-Code of EKS and networking Click Here

📢 Quick Note

Anything related to my K8s deployment architecture, resource details, and operational patterns documented in the manifests repo.

Pipeline Flow

The pipeline follows a sequential workflow from code commit to deployment:

1. Secret Scanning (using GitLeaks)

The pipeline begins with secret detection to identify accidentally committed credentials, API keys, or sensitive data in the codebase.

2. Compile/Build and Unit Test

Compiles source code and executes unit tests to validate functionality and catch bugs early in the development cycle.

3. SAST (using Semgrep)

Analyzes source code for security vulnerabilities, insecure coding patterns, and compliance violations without executing the application.

4. Code-level Dependency Scan (using Trivy)

Scans project dependencies for known CVEs in libraries and packages. Trivy was selected over OWASP Dependency-Check for significantly faster scan times while maintaining comparable detection accuracy.

5. Image Build

Multi-stage Docker builds using Chainguard base images, which provide a minimal attack surface with significantly reduced vulnerability exposure compared to standard base images.

6. Container Image Security Scan

Comprehensive security analysis of the final deployable artifact, scanning all image layers for vulnerabilities before release.

7. Software Bill of Materials SBOM Generation (Syft)

Generates an SBOM documenting all components, libraries, dependencies, and licenses included in the application for supply chain security and compliance.

8. Push to Registry

Verified and security-scanned images are tagged and pushed to the container registry for deployment.

9. Update Manifests

Pipeline automatically updates Kubernetes manifests with the new image tag and commits changes to the manifests repository, triggering the GitOps deployment workflow.

Slack Alerting/Notify (Github Actions Composite Action)

Custom GitHub Actions composite action delivers contextual alerts to Slack with relevant links and data for rapid response.

Examples:

Pasted image (11) Pasted image (10)

GitOps Continuous Deployment

image image
Git serves as the single source of truth for the entire system's desired state. ArgoCD continuously monitors the manifests repository and automatically synchronizes cluster state.


Doing:

  • Continuous Monitoring
  • State Comparison
  • Automatic Synchronization
  • Drift Detection

Live Environment:

Pasted image (9) Pasted image (8)

Monitoring Stack (Prometheus, Alertmanager, Grafana, Loki, & Promtail)

Comprehensive platform observability using industry-standard cloud-native tools:

Metrics Collection (Prometheus)

image image-removebg-preview (23)
  • Scrapes metrics from application services, databases, and infrastructure components
  • Prometheus Adapter exposes custom application metrics to HPA for app-aware autoscaling decisions
  • ServiceMonitor CRDs enable automatic discovery of backend, frontend, and database endpoints

Alerting with Alertmanager


Processes alerts triggered by Prometheus rule evaluations based on defined metric thresholds and delivers notifications to Slack channels for immediate team awareness.

Live Alerts:

Pasted image (5) Pasted image (12) Pasted image (13)

Log Collection and Aggregation with Loki and Promtail

image
  • Loki aggregates logs from all containers and services across the cluster
  • Promtail agents collect and ship logs from Kubernetes pods to Loki
  • Enables correlation between metric anomalies and log events for faster troubleshooting

Visualization with Grafana

image
Grafana serves as the central observability interface, providing real-time visualization of system health and performance. Custom dashboards aggregate data from both Prometheus (metrics) and Loki (logs), enabling operators to correlate performance trends with application behavior and SLO tracking.

Live Custom Dashboard with custom metrics and logs aggregated:

Pasted image (2) Pasted image (3)

Runtime Security with Falco

image
Kernel-level runtime security monitoring for container behavior anomalies. Detects suspicious activities including privilege escalations, unauthorized file access, unexpected network connections, and malicious process execution. Security alerts integrate with the monitoring pipeline for centralized incident response.

Live violation of a rule:

Pasted image (14)
Pasted image (15)

Live Application Screenshots

Live4 Live7 Live8 Live11

Releases

No releases published

Packages

No packages published

Languages