Persisting Grafana and Prometheus Configuration Data - Kubernetes
If you install Grafana in Kubernetes, you may see that the config data in Grafana may be reset (such as admin password and dashboard configuration) when Grafana pod resets. This is because you have not set up a persistent disk attached to the Grafana during the installation.
I will go over the steps to add a persistent disk to the Grafana during the installation.
If you use the command below, it will install the controller in "ingress-nginx" namespace. This takes an important role in the SSL integration (next article).
helm upgrade ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace --set controller.metrics.enabled=true --set-string controller.podAnnotations."prometheus\.io/scrape"="true" --set-string controller.podAnnotations."prometheus\.io/port"="10254"
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
The command below will add a new namespace, "monitoring".
kubectl create namespace monitoring
The command below will install Prometheus with a persistent volume called "default" in the "monitoring" namespace.
helm install prometheus prometheus-community/prometheus --namespace monitoring --set alertmanager.persistentVolume.storageClass="default" --set server.persistentVolume.storageClass="default"
The command below will install Grafana with a persistent volume called "default" in the "monitoring" namespace. Also, this command will set the admin password.
helm install grafana grafana/grafana --namespace monitoring --set persistence.storageClassName="default" --set persistence.enabled=true --set adminPassword='<new admin password, without brackets>'
That's it. You have aded a persistent disk volume in Grafana. Try resetting the pod and it will persist the new admin password.
Easy Guide to AutoMapper (Simple Class Converter) - C# & .NET (0) | 2023.02.26 |
---|---|
Tips for Performance Improvement - Visual Studio (0) | 2023.02.26 |
Adding SSL to Grafana and Accessing It from Anywhere - Kubernetes (0) | 2023.02.20 |
Comprehensive Setup Guide for Prometheus and Grafana in AKS - Powershell (0) | 2023.02.20 |
Table-Valued Function (TVF) Explained (with Examples) - T-SQL (0) | 2023.02.19 |