Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moshclouds/monitoring-k8s-with-prometheus-and-grafana
Learn how to set up Prometheus and Grafana on Minikube for monitoring Kubernetes clusters. This beginner-friendly guide covers installation, service exposure, and dashboard visualization for real-time cluster insights. ๐๐
https://github.com/moshclouds/monitoring-k8s-with-prometheus-and-grafana
grafana helm kubernetes minikube observability prometheus
Last synced: about 11 hours ago
JSON representation
Learn how to set up Prometheus and Grafana on Minikube for monitoring Kubernetes clusters. This beginner-friendly guide covers installation, service exposure, and dashboard visualization for real-time cluster insights. ๐๐
- Host: GitHub
- URL: https://github.com/moshclouds/monitoring-k8s-with-prometheus-and-grafana
- Owner: moshclouds
- Created: 2025-02-04T13:09:54.000Z (1 day ago)
- Default Branch: master
- Last Pushed: 2025-02-04T16:13:37.000Z (1 day ago)
- Last Synced: 2025-02-04T17:25:01.573Z (1 day ago)
- Topics: grafana, helm, kubernetes, minikube, observability, prometheus
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Monitoring Kubernetes with Prometheus and Grafana on Minikube
## ๐ฅ Introduction
Kubernetes is a powerful orchestration tool, but monitoring its performance is crucial for ensuring smooth operations. This is where **Prometheus** and **Grafana** come into play. Prometheus is a leading open-source monitoring solution, while Grafana is a visualization tool that helps make sense of the collected data.
In this guide, weโll walk through setting up **Prometheus and Grafana on Minikube**, a local Kubernetes cluster, to monitor and visualize cluster metrics. This tutorial is **beginner-friendly** and will help you get hands-on experience with Kubernetes monitoring.
---
## โ Prerequisites
Before we start, ensure you have the following installed:
- **Minikube** ([Install Guide](https://minikube.sigs.k8s.io/docs/start/))
- **kubectl** ([Install Guide](https://kubernetes.io/docs/tasks/tools/))
- **Helm** ([Install Guide](https://helm.sh/docs/intro/install/))To verify Minikube is installed, run:
```sh
minikube version
```---
## โ๏ธ Step 1: Start Minikube
First, start your Minikube cluster:
```sh
minikube start
```
Check the status:
```sh
minikube status
```---
## ๐ฆ Step 2: Create a Namespace for Monitoring
It's a good practice to keep monitoring components in a separate namespace.
```sh
kubectl create namespace monitoring
```---
## ๐ก Step 3: Deploy Prometheus
1๏ธโฃ Add the **Prometheus Helm repository**:
```sh
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```2๏ธโฃ Install **Prometheus**:
```sh
helm install prometheus prometheus-community/prometheus -n monitoring
```3๏ธโฃ Verify the installation:
```sh
kubectl get pods -n monitoring
```4๏ธโฃ Check the running ports of the Prometheus pod:
```sh
kubectl describe pod -n monitoring
```5๏ธโฃ Expose the Prometheus service:
```sh
kubectl expose service prometheus-server --type=NodePort --target-port=9090 --name=prometheus-server-exp -n monitoring
```6๏ธโฃ Verify the exposed service:
```sh
kubectl get svc -n monitoring
```7๏ธโฃ Access Prometheus in the browser:
```sh
minikube service prometheus-server-exp -n monitoring
```---
## ๐ Step 4: Deploy Grafana
1๏ธโฃ Add the **Grafana Helm repository**:
```sh
helm repo add grafana https://grafana.github.io/helm-charts
```2๏ธโฃ Install **Grafana**:
```sh
helm install grafana grafana/grafana -n monitoring
```3๏ธโฃ Get the default Grafana admin password:
```sh
kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}"
```๐ Decode the base64-encoded password using a third-party tool or command-line utility.
4๏ธโฃ Check the running ports of the Grafana pod:
```sh
kubectl describe pod -n monitoring
```5๏ธโฃ Expose the Grafana service:
```sh
kubectl expose service grafana --type=NodePort --target-port=3000 --name=grafana-exp -n monitoring
```6๏ธโฃ Access Grafana in the browser:
```sh
minikube service grafana-exp -n monitoring
```
---
## ๐ ๏ธ Step 5: Add Prometheus as a Data Source in Grafana
1๏ธโฃ In Grafana, navigate to **Settings โ Data Sources โ Add Data Source**.
2๏ธโฃ Select **Prometheus**.
3๏ธโฃ Use the following URL:```
http://:
```
4๏ธโฃ Click **Save & Test** to confirm the connection.
---
## ๐ Step 6: Import Kubernetes Dashboards in Grafana
Grafana provides pre-built dashboards for Kubernetes monitoring:
1๏ธโฃ Go to **Dashboards โ Import**.
2๏ธโฃ Enter **Dashboard ID:** `3662`.
3๏ธโฃ Select the Prometheus data source and click **Import**.
You should now see real-time metrics from your Minikube cluster! As shown below๐
---
## ๐ฏ Conclusion
Congratulations! You have successfully set up **Prometheus and Grafana on Minikube**. You can now:
- Monitor **CPU, memory, and network usage**.
- Visualize real-time metrics with **Grafana dashboards**.
- Set up **alerts** using Alertmanager.To further improve your monitoring setup, consider configuring **Alertmanager** for notifications and exploring **custom dashboards**.
๐ **Next Steps**:
- Learn more about **Prometheus Query Language (PromQL)**.
- Customize Grafana dashboards to fit your needs.
- Set up monitoring for real-world Kubernetes clusters using **kube-prometheus**.---
๐ Useful Links:
- [Prometheus Docs](https://prometheus.io/docs/)
- [Grafana Docs](https://grafana.com/docs/)
- [Helm Charts](https://github.com/prometheus-community/helm-charts)