Skip to content

Instantly share code, notes, and snippets.

@mikamboo
Last active May 22, 2022 17:29
Show Gist options
  • Save mikamboo/108f8d43e5e0460d646b98bae82694fc to your computer and use it in GitHub Desktop.
Save mikamboo/108f8d43e5e0460d646b98bae82694fc to your computer and use it in GitHub Desktop.
Kubernetes : Monitoring Stack - Prometheus & Grafana
title author date cover
Kubernetes : Prometheus + Grafana
mikamboo
2020-04-24 23:43

Kubernetes : Prometheus + Grafana

grafana

Monitor Kubernetes cluster using Prometheus + Grafana

Requirements

  • A ready to use kubenetes cluster
  • Helm client wich can access to cluster

Install stack

Step 1 : Create monitoring stack namespace

kubectl create namespace monitoring

Step 2 : Install Prometheus + Grafana

  • Init Helm repos
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
  • Install Prometheus + Grafana
helm install grafana --namespace monitoring grafana/grafana
helm install prometheus --namespace monitoring bitnami/prometheus

Step 3 : Connect

export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace monitoring port-forward $POD_NAME 9090
export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=grafana" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace monitoring port-forward $POD_NAME 3000

# Get "admin" password
kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
  • Grafana datasource settings

Use following URL as Prometheus server url: http://prometheus-server.monitoring.svc.cluster.local

WARNING: Grafana - By default Persistence is disabled !!!

Links

@mikamboo
Copy link
Author

Update 05/2022

All in one: Use prometheus-community Helm chart

Comportements

Installation

Get Helm Repository

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

Install Chart

helm install prometheus-stack -n monitoring prometheus-community/kube-prometheus-stack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment