Skip to content

Observability Day 0 → Configured Minikube with Prometheus and Grafana.

Notifications You must be signed in to change notification settings

ASISHGOUDA/prometheus-grafana-minikube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Prometheus and Grafana Installation Using Helm Charts

This guide explains how to install Prometheus and Grafana in a Kubernetes cluster using Helm charts.

Prerequisites

Before you begin, ensure the following:

  1. A running Kubernetes cluster.
  2. kubectl CLI installed and configured.
  3. Helm CLI installed (version 3 or later).

Step 1: Add Helm Repositories

Add the Prometheus and Grafana Helm chart repositories:

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

Step 2: Install Prometheus

  1. Create a dedicated namespace for monitoring components:

    kubectl create namespace monitoring
  2. Install Prometheus using the kube-prometheus-stack Helm chart:

    helm install prometheus prometheus-community/kube-prometheus-stack \
      --namespace monitoring
  3. Verify the Prometheus installation:

    kubectl get pods -n monitoring

Step 3: Install Grafana

  1. Install Grafana in the same namespace:

    helm install grafana grafana/grafana \
      --namespace monitoring
  2. Verify the Grafana installation:

    kubectl get pods -n monitoring
  3. Retrieve the Grafana admin password:

    kubectl get secret grafana -n monitoring -o jsonpath="{.data.admin-password}" | base64 --decode

    The default username is admin.

Step 4: Access Prometheus and Grafana

  1. Prometheus:

    • Forward the Prometheus service port:
      kubectl port-forward svc/prometheus-kube-prometheus-prometheus -n monitoring 9090:9090
    • Open your browser and navigate to http://localhost:9090.
  2. Grafana:

    • Forward the Grafana service port:
      kubectl port-forward svc/grafana -n monitoring 3000:80
    • Open your browser and navigate to http://localhost:3000.

Step 5: Configure Grafana

  1. Login to Grafana using the admin credentials retrieved earlier.

  2. Add Prometheus as a data source:

    • Navigate to Configuration → Data Sources → Add Data Source.
    • Select Prometheus.
    • Set the URL to http://prometheus-kube-prometheus-prometheus.monitoring.svc.cluster.local:9090.
    • Click Save & Test.
  3. Import Prebuilt Dashboards:

    • Go to Create → Import.
    • Enter the Dashboard ID from Grafana's Dashboard Library.
    • Example: Use Dashboard ID 315 for Kubernetes cluster monitoring.

Step 6: Uninstall (Optional)

To uninstall Prometheus and Grafana:

  1. Uninstall Prometheus:

    helm uninstall prometheus -n monitoring
  2. Uninstall Grafana:

    helm uninstall grafana -n monitoring
  3. Delete the monitoring namespace:

    kubectl delete namespace monitoring

Notes

  • Ensure sufficient resources are allocated to your Kubernetes cluster for running Prometheus and Grafana.
  • Use PersistentVolumes if you need long-term data storage for Prometheus or Grafana configurations.
  • Secure Grafana with Single Sign-On (SSO) or by enabling HTTPS for production use.

About

Observability Day 0 → Configured Minikube with Prometheus and Grafana.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published