Table of Contents
Project details
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.
This is an example of how to list things you need to use the software and how to install them.
- AWS Account - Sign up
- AWS CLI - Install steps
- Terraform - Install steps
- Python - Install steps
- Macs can use
brew install python
- Macs can use
- Docker - Install steps
- Kind - Install steps
- Clone the repo
git clone https://github.com/cxmiller21/aws-eks-microservices.git
- 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
- 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
- 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
- Cleanup
kind get clusters # List clusters (should be names demo-cluster) kind delete cluster --name demo-cluster
- Clone the repo
git clone https://github.com/cxmiller21/aws-eks-microservices.git
- (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)
- 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
- 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
- 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
- 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
- View the "Online Boutique" from the ALB URL output in the previous step and start shopping!
Congrats! The project is now up and running!
- Delete the Online Boutique application
./scripts/delete-online-boutique.sh
- 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
- Add the Loki data source
- Name:
Loki
- Type:
Loki
- URL:
http://loki-distributed-gateway.monitoring.svc.cluster.local:80
- Access:
Server
- Save & Test
- Name:
- Add the Tempo data source
- Name:
Tempo
- Type:
Tempo
- URL:
http://tempo-query-frontend.monitoring.svc.cluster.local:3100
- Access:
Server
- Trace to Logs
- datasource:
Loki
- spanEndTimeShift:
5m
- Tags:
http.status as http_status
,component as ""
- Custom query:
{${__tags}}|="${__trace.traceId}"
- datasource:
- Service graph: Prometheus data source
- Save & Test
- Name:
- Add the Mimir data source
- Name:
Mimir
- Type:
Prometheus
- URL:
http://mimir-nginx.monitoring.svc:80/prometheus
- Access:
Server
- Save & Test
- Name:
- View the Grafana dashboard via the AWS Load Balancer DNS address
- Add new dashboards to view Loki logs and Tempo traces (Dashboards --> New --> Import)
- Loki stack monitoring (Promtail, Loki) Dashboard ID: 14055
- Loki Logs/App Dashboard ID: 13639
Examples TBD
- 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