Ravindra BagaleCourses & study guides मराठी

Chapter 87: Prometheus and Grafana Monitoring

DevOps

87.10 Lab — kube-prometheus-stack with Helm

Story. You help a PhonePe-style wallet API lab on kind. Budget notes stay in INR for class. Your job: install kube-prometheus-stack with Helm (skills from chapter 85), scrape a sample app with a ServiceMonitor, open Grafana, and fire a safe test alert into Alertmanager — without putting webhook secrets in Git.

Lab steps

  1. Confirm kubectl get nodes on kind or Minikube.
  2. Add the prometheus-community Helm repo using the official chart documentation (Artifact Hub / chart docs — do not invent random URLs).
  3. Create namespace monitoring if needed.
  4. Install release kube-prometheus-stack into monitoring with Helm. Keep default admin passwords only for lab; change them.
  5. Wait until Prometheus, Alertmanager and Grafana pods are Ready: kubectl -n monitoring get pods.
  6. Port-forward Prometheus 9090 and open Status → Targets.
  7. Deploy a tiny app with /metrics and a Service that has a named metrics port.
  8. Apply a ServiceMonitor with labels your Prometheus instance selects.
  9. Confirm the new target is UP. Query a metric in the Prometheus UI.
  10. Port-forward Grafana; log in with the Secret password; open Explore and graph that metric.
  11. Optional: add a PrometheusRule with for: 1m in lab, watch it appear in Alertmanager, then remove it.

What good looks like

  • Prometheus Targets page shows kubelet/node exporters UP and your app UP.
  • Grafana Explore draws your PromQL line.
  • You can explain ServiceMonitor label matching to a friend.
  • No Slack webhook or SMTP password appears in any Git commit.

Do the Helm install yourself. Watching a screenshot of Grafana is not the same as fixing an empty Targets list.

Did you understand? Let us try it once more.