A complete, production-oriented DevOps infrastructure for deploying and operating a cloud-native data structures application on AWS using Kubernetes.
This project demonstrates a full DevOps workflow featuring:
- Infrastructure as Code with Terraform
- Microservices deployed on Kubernetes
- CI/CD automation with Jenkins
- Configuration management with Helm
- Monitoring and observability with Prometheus and Grafana
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AWS Cloud β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Kubernetes Cluster β β
β β β β
β β ββββββββββββ ββββββββββββ ββββββββββββ β β
β β β Frontend β β Backend β β Database β β β
β β β (React) βββΆβ (Flask) βββΆβ(Postgres)β β β
β β ββββββββββββ ββββββββββββ ββββββββββββ β β
β β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β Monitoring Stack β β β
β β β ββββββββββββ ββββββββββββ β β β
β β β βPrometheusββββββββββΆβ Grafana β β β β
β β β ββββββββββββ ββββββββββββ β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β²
β
βββββββββββ΄ββββββββββ
β CI/CD Pipeline β
β (Jenkins) β
βββββββββββ¬ββββββββββ
β
βββββββββββ΄ββββββββββ
β GitHub Repos β
β (Frontend/Backend)β
βββββββββββββββββββββ
This is the DevOps Infrastructure Repository (aks_data_structures_devops).
aks_data_structures_devops/
βββ devops-infra/ # Main DevOps infrastructure
β βββ terraform/ # Infrastructure as Code
β β βββ environments/ # Environment-specific configs
β β β βββ dev/
β β β βββ prod/
β β βββ modules/ # Reusable Terraform modules
β β βββ kubernetes/
β β βββ networking/
β β βββ database/
β βββ kubernetes/ # Kubernetes manifests
β β βββ namespaces/
β β βββ frontend/
β β βββ backend/
β β βββ database/
β β βββ ingress/
β β βββ monitoring/
β βββ jenkins/ # CI/CD Pipelines
β β βββ Jenkinsfile # Main orchestration
β β βββ Jenkinsfile.frontend
β β βββ Jenkinsfile.backend
β β βββ jenkins-config/
β βββ helm/ # Helm Charts
β β βββ frontend/
β β βββ backend/
β βββ scripts/ # Deployment scripts
βββ aws-infrastrucutre-terraform/ # AWS infrastructure
βββ README.md # This file
- Docker
- kubectl
- Minikube (for local development) or AWS EKS access
- Terraform >= 1.0.0
- Helm >= 3.0
- Jenkins (for CI/CD)
-
Start Minikube
minikube start eval $(minikube docker-env)
-
Deploy Infrastructure
cd devops-infra/scripts chmod +x *.sh ./setup.sh
-
Deploy Application
./deploy.sh dev
-
Access the Application
minikube service frontend-service minikube service backend-service
-
Configure Terraform
cd devops-infra/terraform/environments/dev cp terraform.tfvars.example terraform.tfvars # Edit terraform.tfvars with your AWS credentials
-
Initialize and Apply
terraform init terraform plan terraform apply
-
Deploy via Jenkins
- Configure Jenkins with GitHub webhooks
- Trigger pipeline from Jenkins UI or via webhook
- Repository:
aks_data_structures_frontend - Framework: React/Vue.js
- Deployment: Kubernetes Deployment with 2 replicas
- Health Check:
/healthendpoint - Configuration: ConfigMap for API URL
- Repository:
aks_data_structures_backend - Framework: Flask
- Database: PostgreSQL
- Endpoints:
/health- Basic health check/health/ready- Readiness probe (DB connected)/health/live- Liveness probe/metrics- Prometheus metrics/api/*- REST API endpoints
- Type: PostgreSQL (StatefulSet)
- Storage: Persistent Volume Claim (10Gi)
- Credentials: Kubernetes Secrets
Pipeline Stages:
- Checkout - Clone repositories
- Build - Build Docker images
- Test - Run unit tests
- Scan - Security scanning (Trivy)
- Tag - Tag images with build number and git SHA
- Push - Push to container registry
- Deploy - Deploy to Kubernetes using Helm
- Verify - Health checks and integration tests
Pipeline Files:
Jenkinsfile- Main orchestration pipelineJenkinsfile.frontend- Frontend-specific pipelineJenkinsfile.backend- Backend-specific pipeline
- Scrapes metrics from all services
- 15-day retention
- Alert rules for:
- High error rate
- High latency
- Pod restarts
- Database connection failures
- High CPU/Memory usage
- Pre-configured dashboards:
- Application metrics (request rate, latency, errors)
- Kubernetes cluster health
- Database performance
Features:
- Environment awareness (dev/prod)
- Feature toggles
- Configurable scaling
- Resource limits
Usage:
# Deploy with Helm
helm install backend devops-infra/helm/backend \
--set environment=prod \
--set replicaCount=4 \
--set features.showDatabaseInfo=true
helm install frontend devops-infra/helm/frontend \
--set environment=prod \
--set features.showEnvironment=trueREACT_APP_API_URL=http://backend-service:5000/api
REACT_APP_ENV=productionFLASK_ENV=production
DATABASE_URL=postgresql://user:pass@postgres-headless:5432/appdb
SECRET_KEY=your-secret-key
PROMETHEUS_MULTIPROC_DIR=/tmpSecrets are stored in Kubernetes Secrets. To update:
# Update database password
kubectl create secret generic postgres-secrets \
--from-literal=POSTGRES_PASSWORD='newpassword' \
--dry-run=client -o yaml | kubectl apply -f -Prometheus:
kubectl port-forward svc/prometheus-service 9090:9090
# Open http://localhost:9090Grafana:
kubectl port-forward svc/grafana-service 3000:3000
# Open http://localhost:3000
# Default credentials: admin/admin123- Request Rate:
rate(http_requests_total[5m]) - Error Rate:
rate(http_requests_total{status=~"5.."}[5m]) - Latency:
histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) - Active Connections:
db_connections_active
Developer β GitHub Push β Jenkins Webhook β Pipeline Execution
β
Checkout Repos β Build Images β Run Tests β Security Scan
β
Tag Images β Push to Registry β Deploy via Helm β Verify
β
Health Checks β Integration Tests β Notify (Slack)
setup.sh- Initial environment setupdeploy.sh- Deploy applicationcleanup.sh- Teardown resourcesrun-local.sh- Run locally with Minikube
# Deploy to dev environment
./deploy.sh dev
# Deploy with monitoring
./deploy.sh dev true
# Deploy using Helm
./deploy.sh dev false trueHelm controls which environment the application runs in:
# values.yaml
environment: "dev" # or "prod"The UI displays: Environment: DEV or Environment: PROD
# values.yaml
replicaCount: 2 # Scale to 4, 8, etc.# values.yaml
features:
showDatabaseInfo: false # Toggle database info display
enableAnalytics: false # Toggle analytics# Check pod status
kubectl get pods
# Check pod logs
kubectl logs <pod-name>
# Describe pod for events
kubectl describe pod <pod-name># Check database pod
kubectl get pods -l app=postgres
# Check database logs
kubectl logs <postgres-pod-name>
# Test connection
kubectl exec -it <postgres-pod-name> -- psql -U appuser -d appdb# Check Jenkins logs
kubectl logs <jenkins-pod-name>
# Verify credentials
# Check Jenkins UI β Credentials- Kubernetes Documentation
- Helm Documentation
- Terraform AWS Provider
- Prometheus Documentation
- Grafana Documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License.
DevOps Team
Note: This is a comprehensive DevOps infrastructure setup. Ensure all secrets are properly managed and never committed to version control.