🚀 Monitoring Kubernetes Cluster with Prometheus and Grafana — Beginner Friendly Guide

Abdur RahmanAbdur Rahman
4 min read

Introduction

Why is Monitoring Essential?

Imagine you're managing a huge project with multiple Kubernetes clusters. Everything seems to be running smoothly… until it’s not. One cluster crashes, another eats up all your CPU, and suddenly you're playing a guessing game while production burns.
Enter Monitoring Tools.

Monitoring helps you track your system’s health, catch issues before they become disasters, and (most importantly) keeps you from pulling all-nighters with a gallon of coffee debugging invisible bugs. ☕🔥


What are Prometheus & Grafana?

Prometheus

Prometheus is a powerful monitoring tool that scrapes metrics from the Kubernetes API and stores them in a Time Series Database (TSDB). It has its own query language called PromQL, which you can use to ask questions like:

  • "Hey, how’s my CPU doing?"

  • "Are my pods still breathing?"

You can even use Alertmanager to send alerts to Slack, email, or your favorite panic channel when something’s off.

Grafana

Grafana is the cool, artsy friend of Prometheus. It visualizes all the data Prometheus collects — think graphs, dashboards, and charts that actually make sense. You can monitor:

  • Pod status

  • Node health

  • Deployment metrics

  • CPU/memory utilization

In short, Grafana makes raw numbers look beautiful (and useful).


Goal of This Blog

To help you: ✅ Set up Prometheus and Grafana
✅ Run them locally using Minikube
✅ Start monitoring your cluster like a pro (or at least pretend to be one 😉)


Prerequisites

Before we get started, make sure you’ve got the following installed:

  • Docker

  • Minikube

  • Kubectl

  • Basic Kubernetes knowledge (No PhD needed!)


🛠️Installing Prometheus & Grafana using Helm

But first, what’s Helm?

Helm is like apt for Ubuntu or npm for Node.js — but for Kubernetes.
It makes installing complex apps like Prometheus and Grafana ridiculously easy.


🔧 Install Helm on Ubuntu (Debian)

curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null

sudo apt-get install apt-transport-https -y

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list

sudo apt-get update && sudo apt-get install helm -y

Add Prometheus & Grafana Helm Repos

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

Install Prometheus and Grafana

# Install Prometheus
helm install prometheus prometheus-community/prometheus

# Install Grafana
helm install grafana grafana/grafana

After installing Grafana, Helm will output a command to retrieve the admin password. Run it like so:

kubectl get secret --namespace default grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

This will give you the default password (username is admin).


Expose Services

By default, these services are internal. Let’s expose them using NodePort so you can access them via your browser.

# Expose Prometheus
kubectl expose service prometheus-server --type=NodePort --target-port=9090 --name=prometheus-server-ext

# Expose Grafana
kubectl expose service grafana --type=NodePort --target-port=3000 --name=grafana-ext

Now grab the Minikube IP:

minikube ip

And check the service ports:

kubectl get svc

Now access Prometheus and Grafana in your browser:

  • Prometheus: http://<minikube-ip>:<prometheus-port>

  • Grafana: http://<minikube-ip>:<grafana-port>

Example:

http://192.168.49.2:31337
http://192.168.49.2:30664

📊 Set Up Grafana

  1. Open Grafana in your browser

  2. Login with username: admin and the password you retrieved earlier

  3. Click the Grafana logo > Go to Connections > Data Sources

  4. Add Prometheus as a new data source (URL will usually be http://prometheus-server)

  5. Test the connection and save


🧮 Import Prebuilt Dashboard

Now for the magic. Import a prebuilt dashboard to see real-time system metrics:

  1. Go to Home > + Create > Import Dashboard

  2. Enter the dashboard ID: 1860

  3. Select Prometheus as the data source

  4. Click "Import"

Boom 💥! You’ll now see CPU usage, memory, node health, and more — all beautifully visualized.


Final Thoughts

Don’t wait for your clusters to go wild before you set up monitoring. It’s like installing a fire alarm before the kitchen catches fire.

With Grafana and Prometheus in place, you’ll sleep better knowing your clusters are under 24/7 watch — no Red Bull required. 😎

Happy Monitoring,
~ Abdur Rahman

0
Subscribe to my newsletter

Read articles from Abdur Rahman directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abdur Rahman
Abdur Rahman