/EKS-Prometheus-Grafana

Deploy Prometheus monitoring and Grafana Dashboards on an EKS cluster using Terraform and Helm.

Primary LanguageHCLMIT LicenseMIT

Kubernetes AWS Terraform Docker Nginx Shell Script

Stars Forks Issues License

Project Title

EKS-Prometheus-Grafana Tweet

Description

Deploy Prometheus monitoring and Grafana Dashboards on an EKS cluster using Terraform and Helm.

image

Getting Started

Dependencies

  • Docker
  • AWS user with programmatic access and high privileges
  • Linux terminal
  • Deploy an EKS K8 Cluster with Self managed Worker nodes on AWS using Terraform.
  • Deploy a NGINX Ingress on the above EKS cluster (Pod->service->Ingress->ELB+ACM->Route 53->Domain URL)
  • Deploy a Cluster Autoscaler on the above EKS cluster using Terraform and Helm

Installing

  • Clone the repository
  • Set environment variable TF_VAR_AWS_PROFILE
  • Review terraform variable values in variables.tf, locals.tf
  • Override values in the Helm chart through the "chart_values.yaml" file
  • Update the "adminPassword:" attribute with a value, in the grafana section of "chart_values.yaml" file
  • Update kubernetes.tf with the AWS S3 bucket name and key name from the output of the EKS K8 Cluster

Executing program

  • Configure AWS user with AWS CLI.
docker-compose run --rm aws configure --profile $TF_VAR_AWS_PROFILE

docker-compose run --rm aws sts get-caller-identity
  • Specify appropriate Terraform workspace.
docker-compose run --rm terraform workspace show

docker-compose run --rm terraform workspace select default
  • Run Terraform apply to create the EKS cluster, k8 worker nodes and related AWS resources.
./run-docker-compose.sh terraform init

./run-docker-compose.sh terraform validate

./run-docker-compose.sh terraform plan

./run-docker-compose.sh terraform apply
  • Verify prom and grafana related deployments, pods and services are running and the Ingress is setup correctly.
./run-docker-compose.sh kubectl get all -A | grep -i monitoring

./run-docker-compose.sh kubectl get ingress -n monitoring
  • View the Grafana application URL using the Domain Https URL, prefixed by "grafana." and when prompted, enter grafana admin username and password.

Help

  • Grafana ingress is not connected to the AWS Network load balancer.
Issue: The external address field on the ingress remains empty. ideally, it is expected to list the NLB Domain address.

Fix:  Added the below assignment under the Ingress section of grafana service in the helm chart_values.yaml
ingressClassName: nginx

Reference: https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress

Authors

Sivanandam Manickavasagam

Version History

  • 0.1
    • Initial Release

License

This project is licensed under the MIT License - see the LICENSE file for details

Repo rosters

Stargazers

Stargazers repo roster for @SM4527/EKS-Prometheus-Grafana