Skip to content

About

End-to-end Cloud Native infrastructure using Terraform, Docker, and Kubernetes with automated CI/CD pipelines.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

152 Commits

Folders and files

Repository files navigation

eks-gitops-platform

Amazon EC2 AWS Identity and Access Management (IAM) Amazon DynamoDB Amazon Route 53 Elastic Load Balancing (ELB) Amazon CloudWatch

Amazon EKS platform where Terraform provisions the infrastructure, ArgoCD handles GitOps delivery, and workloads access AWS through short-lived credentials using OIDC federation instead of stored keys.

Why I built this

I built this to go beyond a basic Kubernetes demo and practice the patterns I would expect to find in a real platform engineering environment: infrastructure fully defined in code, deployments driven by Git rather than by someone typing kubectl, and a worker that costs nothing while it has no work to do.

The application

The platform runs a small e commerce style application so the infrastructure has a realistic workload to carry. The API is built with FastAPI and serves a storefront page and an operations dashboard. Orders placed through the API are published to SQS, and a separate worker consumes the queue and writes the results to DynamoDB.

The application itself is intentionally simple. It exists to give the platform something real to deploy, scale, and secure, not to demonstrate frontend work.

What this demonstrates

Infrastructure as code with Terraform. GitOps delivery with ArgoCD. Zero static AWS credentials, using OIDC for CI and IRSA for pods. Event driven autoscaling with KEDA, including scale to zero. Multi AZ VPC architecture with public and private subnets across three Availability Zones. Observability with Prometheus and Grafana.

AWS · EKS · Terraform · Kubernetes · ArgoCD · GitHub Actions · Helm · KEDA · SQS · DynamoDB · Prometheus · Grafana · OIDC · IRSA

Architecture

Production-Grade Amazon EKS GitOps Platform - Architecture

Walkthrough

A 5 minute video covering the application, the GitOps deployment flow, the security model, and KEDA scaling in action.

Watch the 5 minute walkthrough (replace with your Loom link before publishing)

How a deploy happens

git push  ->  GitHub Actions  ->  tests + Terraform plan  ->  build + Trivy scan
   ->  ECR  ->  Helm values.yaml bump  ->  ArgoCD  ->  EKS
  1. CI runs the test suite with an 80 percent coverage gate, and on a pull request posts a Terraform plan for review.
  2. On merge to main, CI builds the image, scans it with Trivy, pushes it to ECR, and bumps the tag in the Helm chart.
  3. ArgoCD polls Git every 3 minutes, detects the change, and applies the Helm release as a rolling update, with a PodDisruptionBudget keeping at least one pod available throughout.

Nobody runs kubectl apply against production. The only path in is a Git commit.

Security by design

  1. GitHub Actions to AWS: OIDC federation, no long-lived access keys stored anywhere.
  2. Pods to AWS: IRSA, each service assumes its own scoped IAM role through a projected OIDC token, using short-lived credentials instead of stored keys.
  3. Container security: every image is scanned with Trivy, and the build fails on CRITICAL vulnerabilities.

Full reasoning and the alternatives I rejected are in ADR 002 and ADR 004.

Scaling

api-service scales on CPU through a standard HPA, 2 to 10 pods. worker-service scales on SQS queue depth through KEDA, 0 to 20 pods. CPU is a lagging signal for a queue consumer, it stays low right up until a burst of messages needs processing, so KEDA reading the queue directly reacts sooner. When the queue is empty the worker runs zero pods, not a padded minimum kept warm just in case.

The comparison against a plain HPA is in ADR 003.

Observability

Prometheus and Grafana run through kube-prometheus-stack, with a ServiceMonitor per service. Application and VPC Flow Logs go to CloudWatch with 30 day retention.

Cost awareness

Baseline cost is roughly $258/month when the environment is running, mainly from the EKS control plane, EC2 nodes, ALB, and three NAT Gateways. I don't keep the environment running continuously, I provision it when I need to demo or extend the platform. Full breakdown, including the single NAT Gateway option for dev and test, is in docs/cost-analysis.md.

Design decisions

Every non obvious technical choice is written up as an ADR, including what I rejected and why.

001, GitOps over imperative kubectl 002, IRSA over node IAM roles 003, KEDA over HPA for the worker 004, GitHub Actions OIDC over static IAM credentials

Run it yourself

Requirements: AWS CLI 2.15+, Terraform 1.7+, kubectl 1.29+, Helm 3.14+, ArgoCD CLI 2.10+.

cd terraform
terraform init
terraform plan -out=tfplan
terraform apply tfplan

$(terraform output -raw configure_kubectl)
kubectl get nodes -o wide

The full setup, including the Terraform state backend bootstrap, the ArgoCD bootstrap, and how to verify the GitOps and KEDA scaling loops end to end, is in docs/deployment.md.

What I would build next

EKS Auto Mode, blue or green deployments, and Kyverno admission policies.

About

Built and maintained by Patrício Lumbe.

patriciolumbe.com | LinkedIn

About

End-to-end Cloud Native infrastructure using Terraform, Docker, and Kubernetes with automated CI/CD pipelines.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages