Skip to content

Latest commit

 

History

History
141 lines (112 loc) · 6.31 KB

README.md

File metadata and controls

141 lines (112 loc) · 6.31 KB

[LAB] AWS EKS cluster

A laboratory for EKS cluster. Contains a publicly acessible grafana service, for monitoring data visualization.

image

The Prometheus and Grafana deployment is based o kube-prometheus-stack helm chart. https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack

In adition to the community monitoring items and dashboards, this project contains a service monitor called ping-exporter. https://github.com/czerwonk/ping_exporter.

It runs as a daemonset, sending ping requests to every node on the cluster, collecting data about connectivity between nodes.

A specific Grafana dashboard was created to visualize it, named: Ping Exporter - Inter node ping statistics

Dependencies

Usage

Install terraform dependencies

terraform init

Preview the execution plan and apply it

terraform plan
terraform apply

Apply kubectl kubeconfig

aws eks update-kubeconfig --name eks_lab_cluster --region us-west-1

Grafana

Used for data visualization, it's configured with some community dashboards from kube-prometheus-stack

To access it, after running the terraform apply, get the Grafana Load Balancer URL with:

terraform output grafana_url

Paste it on your browser and use the following credentials to access it.

username: admin

password: admin123

Navigate to Dashboards and search for Ping Exporter - Inter node ping statistics. The source node can be selected on the NodeIP template variable on the top left corner.

Clean up

To clean up created resources and avoid costs don't forget to run

terraform destroy

References and resources

Documentation generated using terraform-docs https://github.com/terraform-docs/terraform-docs

terraform-docs markdown . | tee README.md

Creating a serviceMonitor for prometheus operator

https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/user-guides/getting-started.md

https://stackoverflow.com/questions/52991038/how-to-create-a-servicemonitor-for-prometheus-operator

Provisioning a EKS cluster

https://learn.hashicorp.com/tutorials/terraform/eks

AWS EKS cluster with terraform - Examples

https://antonputra.com/category/aws-amazon-web-services/

Requirements

Name Version
terraform >= 0.13
aws ~> 3.0
grafana 1.13.3
helm 2.2.0
kubectl 1.11.3
null 3.1.0

Providers

Name Version
aws 3.52.0
grafana 1.13.3
helm 2.2.0
kubernetes 2.3.2
null 3.1.0

Modules

Name Source Version
eks terraform-aws-modules/eks/aws 17.1.0
networking ./networking n/a
ping-exporter ./ping-exporter n/a

Resources

Name Type
grafana_dashboard.ping-exporter resource
helm_release.prometheus resource
kubernetes_namespace.monitoring resource
kubernetes_service.grafana resource
null_resource.wait_for_grafana_dns resource
aws_eks_cluster.cluster data source
aws_eks_cluster_auth.cluster data source
aws_instances.cluster_nodes data source

Inputs

Name Description Type Default Required
cluster_name Name of the cluster string "lab_cluster" no
monitoring_namespace Namespace for monitoring resources string "monitoring" no
region AWS region string "us-west-1" no
worker_nodes Number of worker nodes number 3 no

Outputs

Name Description
cluster_endpoint Endpoint for EKS control plane.
cluster_id EKS cluster ID.
cluster_name Kubernetes Cluster Name
config_map_aws_auth A kubernetes configuration to authenticate to this EKS cluster.
grafana_url Grafana external URL
kubectl_config kubectl config as generated by the module.