Deploying a robust Kubernetes cluster monitoring solution(node-exporter,prometheus & grafana) with Helm
Noble Mutuwa Mulaudzi
Posted on September 11, 2023
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
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.
Clone the repo and navigate to the application's folder
Apply the
cluster.yaml
,deployment.yaml
, andservice.yaml
files:
eksctl create cluster -f cluster.yaml
kubectl apply -f deployment.yaml
kubectl apply -f deployment.yaml
Retrieve the service and access your application via the load balancer:
kubectl get svc
Here is our application running on an EKS cluster
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
3. Create a Namespace for Monitoring (Optional):
kubectl create namespace monitoring
4. Install Prometheus using Helm:
helm install prometheus-stack prometheus-community/kube-prometheus-stack -n monitoring
Exposing Prometheus and Grafana Services
To access Prometheus and Grafana, edit the services within the monitoring namespace, and change the service type to LoadBalancer:
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:
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!
Posted on September 11, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024