DEV Community

Hisyam Johan
Hisyam Johan

Posted on • Edited on

1

Monitor k8s with Loki, Prometheus and Grafana

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

To access Grafana locally, run the following command:

kubectl port-forward svc/monitoring-stack-grafana 8080:80 -n monitoring
Enter fullscreen mode Exit fullscreen mode

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:

  1. Go to the Grafana dashboard.
  2. Click on "Configuration" in the side menu.
  3. Click on "Data Sources".
  4. Click on "Add data source".
  5. Set the following configurations:

That's it! You have successfully set up monitoring for Kubernetes using Loki, Prometheus, and Grafana.

Enjoy monitoring your Kubernetes cluster!

Sources:

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay