Monitor k8s with Loki, Prometheus and Grafana
Hisyam Johan
Posted on February 6, 2023
Bismillah...
We will learn how to monitor Kubernetes using Loki, Prometheus, and Grafana using existing helm packages.
I found two helm packages which are very useful.
First, let's install the helm package for Prometheus:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install monitoring-stack prometheus-community/kube-prometheus-stack -n monitoring
Next, let's install the helm package for Loki:
helm upgrade --install loki grafana/loki-stack --set fluent-bit.enabled=true,promtail.enabled=false -n monitoring
To access Grafana locally, run the following command:
kubectl port-forward svc/monitoring-stack-grafana 8080:80 -n monitoring
You can now access Grafana by opening localhost:8080 in your browser. Login with the following credentials:
- Username: admin
- Password: prom-operator
Next, let's configure Loki as a datasource in Grafana. Follow these steps:
- Go to the Grafana dashboard.
- Click on "Configuration" in the side menu.
- Click on "Data Sources".
- Click on "Add data source".
- Set the following configurations:
- Name: Loki
- Type: Loki
- URL: http://loki:3100
- Save & Test
That's it! You have successfully set up monitoring for Kubernetes using Loki, Prometheus, and Grafana.
Enjoy monitoring your Kubernetes cluster!
Sources:
Posted on February 6, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024