DEV Community

Cover image for Deploying a robust Kubernetes cluster monitoring solution(node-exporter,prometheus & grafana) with Helm
Noble Mutuwa  Mulaudzi
Noble Mutuwa Mulaudzi

Posted on

Deploying a robust Kubernetes cluster monitoring solution(node-exporter,prometheus & grafana) with Helm

Introduction

Monitoring your AWS Elastic Kubernetes Service (EKS) cluster is crucial for ensuring its health and performance. In this tutorial, I'll walk you through the process of deploying a robust monitoring solution using Helm, Prometheus, Node Exporter, and Grafana.

Article by Noble Mutuwa Mulaudzi

Architecture Diagram

Architecture Diagram

Prerequisites

Before you begin, make sure you have the following prerequisites in place:

  • An AWS EKS cluster up and running.
  • kubectl installed and configured to connect to your EKS cluster.
  • Helm installed on your local machine.
  • Basic knowledge of Kubernetes concepts.
  • eksctl installed on your local machine

Setting Up the Cluster

If you don't have an EKS cluster, follow these steps to configure your cluster:

source code : Noble Mutuwa K8s monitoring files.

  1. Clone the repo and navigate to the application's folder

  2. Apply the cluster.yaml, deployment.yaml, and service.yaml files:

eksctl create cluster -f cluster.yaml
kubectl apply -f deployment.yaml
kubectl apply -f deployment.yaml
Enter fullscreen mode Exit fullscreen mode

Retrieve the service and access your application via the load balancer:

kubectl get svc
Enter fullscreen mode Exit fullscreen mode

Here is our application running on an EKS cluster

Image description

Setting Up Prometheus, Node Exporter, and Grafana

To set up Prometheus, Grafana, and Node Exporter as a monitoring stack for your Kubernetes cluster, you can use Helm to simplify the deployment process. Here are the steps to install the Prometheus stack on your Kubernetes cluster using Helm:

1. Install Helm (if not already installed):

If you haven't already installed Helm on your Windows machine using Chocolatey or any other method, please follow the instructions provided earlier.

2. Add Helm Chart Repositories:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
Enter fullscreen mode Exit fullscreen mode

3. Create a Namespace for Monitoring (Optional):

kubectl create namespace monitoring
Enter fullscreen mode Exit fullscreen mode

4. Install Prometheus using Helm:

helm install prometheus-stack prometheus-community/kube-prometheus-stack -n monitoring
Enter fullscreen mode Exit fullscreen mode

Exposing Prometheus and Grafana Services

To access Prometheus and Grafana, edit the services within the monitoring namespace, and change the service type to LoadBalancer:

LoadBalancer Services

Accessing Grafana

  • Copy the LoadBalancer URL of the Grafana service and paste it into your web browser.

  • Use the following credentials to log in:

    • Username: admin
    • Password: prom-operator

Set Up Data Sources and Dashboards in Grafana

Configure data sources and import dashboards in Grafana to start visualizing your Kubernetes cluster metrics. You can find various Kubernetes-related dashboards in the Grafana dashboard marketplace.

Here's a dashboard I've configured to monitor my cluster's health:

Cluster Health Dashboard

Congratulations! You've successfully deployed a robust monitoring solution for your AWS EKS cluster. With Prometheus, Node Exporter, and Grafana in place, you can monitor and visualize metrics, helping you keep your Kubernetes environment healthy and efficient.

Article by Noble Mutuwa Mulaudzi

Thank you!

Top comments (0)