Skip to content

AWS EKS Project to test using EKS, Micro-services, Tracing, Log Aggregation, and Monitoring tools

Notifications You must be signed in to change notification settings

cxmiller21/aws-eks-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


AWS EKS Microservice Application

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contact
  6. Acknowledgments

About The Project

EKS Project Diagram (TODO build diagram)

Project details

(back to top)

Built With

  • Python
  • Java
  • EKS
  • ECR
  • OpenTelemetry
  • S3
  • SNS
  • TODO: Add Grafana, Prometheus, Loki, Tempo, Mimir, and other

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

Getting Started

Locally

  1. Clone the repo
    git clone https://github.com/cxmiller21/aws-eks-microservices.git
  2. Create the Kind Kubernetes cluster
    # Creates a local Kubernetes cluster using Docker containers
    # Creates the Grafa LGTM (Loki, Grafana, Tempo, and Mimir/Prometheus - aka "Looks Good to Me") Stack
    ./scripts/create-kind-cluster.sh
  3. Access ArgoCD and Grafana
    # Enable port-forwarding to ArgoCD
    kubectl port-forward service/argo-cd-argocd-server -n argocd 8080:80
    # Get the ArgoCD password
    kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
    # Visit `localhost:8080` and login with the username `admin` and the password from the command above
    
    # View Grafana at
    kubectl port-forward service/grafana 3000:80 -n monitoring
  4. Create Online Boutique microservices application in the Kind cluster
    # View Grafana at 127.0.0.1:3000 (username: admin, password: prom-operator)
    # Start online-boutique application
    kubectl apply -f ./kubernetes/local/online-boutique.yaml
    # Expose the application via a NodePort
    kubectl port-forward service/frontend-service 8080:8080 -n online-boutique
  5. Cleanup
    kind get clusters # List clusters (should be names demo-cluster)
    kind delete cluster --name demo-cluster

Deploy to AWS EKS

  1. Clone the repo
    git clone https://github.com/cxmiller21/aws-eks-microservices.git
  2. (optional) Create a new AWS CLI profile
    # Create a new AWS User or Access Keys for the project
    aws configure --profile aws-eks-demo
    # Enter AWS Access Key ID, AWS Secret Access Key, Default region (us-east-1) name, and Default output format (press enter for default)
  3. Create Terraform AWS Resources (~20 minutes)
    cd ./terraform
    terraform init
    # TODO: create .terraform.tfvars file and add federated_role_name = "xyz"
    terraform plan # Confirm resources
    terraform apply # Enter `yes` when prompted
  4. Allow local connections to EKS cluster (if not done already)
    # Add the EKS Cluster to the ~/.kube/conf file to execute local kubectl commands
    aws eks --region us-east-1 update-kubeconfig --name aws-eks-demo
  5. Get the ArgoCD password
    # Visit the AWS ALB URL for ArgoCD and login with the username `admin` and the password from the command below
    kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
  6. Create the Online Boutique microservices application in the EKS Cluster (run from project root) (TBD Have ArgoCD Application auto-create this)
./scripts/install-online-boutique.sh
  1. View the "Online Boutique" from the ALB URL output in the previous step and start shopping!

Congrats! The project is now up and running!

AWS EKS Cleanup

  1. Delete the Online Boutique application
    ./scripts/delete-online-boutique.sh
  2. Run the cleanup-eks.py script (TBD)
    # Having trouble deleting EKS Ingress/ALB resources via Terraform, so this script will delete the resources to
    successfully run Terraform destroy
    ./scripts/cleanup-eks.py

Grafana Dashboards

Data Sources

  1. Add the Loki data source
    1. Name: Loki
    2. Type: Loki
    3. URL: http://loki-distributed-gateway.monitoring.svc.cluster.local:80
    4. Access: Server
    5. Save & Test
  2. Add the Tempo data source
    1. Name: Tempo
    2. Type: Tempo
    3. URL: http://tempo-query-frontend.monitoring.svc.cluster.local:3100
    4. Access: Server
    5. Trace to Logs
      1. datasource: Loki
      2. spanEndTimeShift: 5m
      3. Tags: http.status as http_status, component as ""
      4. Custom query: {${__tags}}|="${__trace.traceId}"
    6. Service graph: Prometheus data source
    7. Save & Test
  3. Add the Mimir data source
    1. Name: Mimir
    2. Type: Prometheus
    3. URL: http://mimir-nginx.monitoring.svc:80/prometheus
    4. Access: Server
    5. Save & Test

Dashboards

  1. View the Grafana dashboard via the AWS Load Balancer DNS address
  2. Add new dashboards to view Loki logs and Tempo traces (Dashboards --> New --> Import)
    1. Loki stack monitoring (Promtail, Loki) Dashboard ID: 14055
    2. Loki Logs/App Dashboard ID: 13639

(back to top)

Usage

Examples TBD

(back to top)

Roadmap

  • Validate EKS cluster logging and monitoring
  • Create AWS EKS cluster with Terraform and validate logging, monitoring, and tracing
  • Create AWS EKS cluster diagram that shows key Cluster components (Auth, ALBs, Logging, Monitoring, and Tracing)
  • Create diagram that shows the Online Boutique microservices application components

(back to top)

About

AWS EKS Project to test using EKS, Micro-services, Tracing, Log Aggregation, and Monitoring tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published