Table of Contents
- Prerequisites
- 1. Add the Grafana Helm Repository
- 2. Create a Namespace
- 3. Install Grafana with Default Values
- 4. Custom Configuration via `values.yaml`
- 5. Install with Custom Values
- 6. Verify the Deployment
- 7. Access the Grafana UI
- 8. Upgrading Grafana
- 9. Uninstalling Grafana
- 10. Common Troubleshooting
- 11. Complete `values.yaml` Example
- 12. Useful References
Prerequisites
Before you begin, ensure the following are in place:
- Kubernetes cluster (v1.23+) with
kubectlaccess - Helm (v3.8+) — Install Helm
- Prometheus already deployed (see
prometheus-helm-install.md) - Sufficient cluster resources (recommended: 1 CPU core, 512 MB RAM minimum)
Verify your tools:
kubectl version --client
helm version
kubectl cluster-info1. Add the Grafana Helm Repository
helm repo add grafana https://grafana.github.io/helm-charts
helm repo updateVerify the repo was added:
helm search repo grafana/grafana2. Create a Namespace
If you are deploying Grafana alongside Prometheus, reuse the same namespace:
kubectl create namespace monitoring
# Skip if 'monitoring' already exists3. Install Grafana with Default Values
For a quick installation with defaults:
helm install grafana grafana/grafana \
--namespace monitoring4. Custom Configuration via values.yaml
Pull the default values first:
helm show values grafana/grafana > grafana-values.yamlKey Configuration Sections
4.1 Admin Credentials
⚠️ Never hardcode passwords in
values.yamlcommitted to version control. Use a Kubernetes Secret instead (see section 4.2).
adminUser: admin
adminPassword: "your-secure-password" # For dev/testing only4.2 Admin Password via Kubernetes Secret (Recommended)
Create the secret manually:
kubectl create secret generic grafana-admin-secret \
--from-literal=admin-user=admin \
--from-literal=admin-password=your-secure-password \
--namespace monitoringThen reference it in values.yaml:
admin:
existingSecret: grafana-admin-secret
userKey: admin-user
passwordKey: admin-password4.3 Resource Limits
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi4.4 Persistent Storage
persistence:
enabled: true
type: pvc
size: 10Gi
storageClassName: "standard" # Replace with your StorageClass
accessModes:
- ReadWriteOnce4.5 Replica Count
replicas: 1
# For HA, set replicas > 1 and configure a shared database backend4.6 Configure Prometheus as a Data Source
This is the most important integration step. Grafana can auto-provision data sources on startup:
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus-server.monitoring.svc.cluster.local:80
access: proxy
isDefault: true
jsonData:
timeInterval: "15s"
httpMethod: POSTTip: The URL
http://prometheus-server.monitoring.svc.cluster.local:80follows the patternhttp://<helm-release-name>-server.<namespace>.svc.cluster.local:80. Adjust if your Prometheus release name or namespace differs.
4.7 Auto-provision Dashboards
You can pre-load community dashboards from grafana.com/dashboards by their ID:
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
# Kubernetes cluster overview — Dashboard ID 7249
kubernetes-cluster:
gnetId: 7249
revision: 1
datasource: Prometheus
# Node Exporter full — Dashboard ID 1860
node-exporter:
gnetId: 1860
revision: 37
datasource: Prometheus
# Prometheus stats — Dashboard ID 2
prometheus-stats:
gnetId: 2
revision: 2
datasource: Prometheus4.8 SMTP / Email Alerting
grafana.ini:
smtp:
enabled: true
host: smtp.example.com:587
user: grafana@example.com
password: "smtp-password"
from_address: grafana@example.com
from_name: Grafana
startTLS_policy: MandatoryStartTLS4.9 Authentication (OAuth / OIDC)
Example for GitHub OAuth:
grafana.ini:
auth.github:
enabled: true
allow_sign_up: true
client_id: YOUR_GITHUB_CLIENT_ID
client_secret: YOUR_GITHUB_CLIENT_SECRET
scopes: user:email,read:org
auth_url: https://github.com/login/oauth/authorize
token_url: https://github.com/login/oauth/access_token
api_url: https://api.github.com/user
allowed_organizations: your-github-org4.10 Ingress (Optional)
ingress:
enabled: true
ingressClassName: nginx
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
cert-manager.io/cluster-issuer: letsencrypt-prod # If using cert-manager
hosts:
- grafana.example.com
paths:
- /
tls:
- secretName: grafana-tls
hosts:
- grafana.example.com4.11 Grafana Plugins
Install plugins at startup:
plugins:
- grafana-clock-panel
- grafana-piechart-panel
- grafana-worldmap-panel
- vonage-status-panel5. Install with Custom Values
helm install grafana grafana/grafana \
--namespace monitoring \
--values grafana-values.yamlOr override individual values inline:
helm install grafana grafana/grafana \
--namespace monitoring \
--set persistence.enabled=true \
--set persistence.size=10Gi \
--set adminPassword=your-secure-password6. Verify the Deployment
Check that the pod is running:
kubectl get pods -n monitoring -l app.kubernetes.io/name=grafanaExpected output:
NAME READY STATUS RESTARTS AGE
grafana-6d9b8c8f7d-xxxxx 1/1 Running 0 1m
Check the service:
kubectl get svc -n monitoring -l app.kubernetes.io/name=grafana7. Access the Grafana UI
If you did not configure an Ingress, use port-forwarding:
kubectl port-forward -n monitoring svc/grafana 3000:80Then open your browser at: http://localhost:3000
Log in with:
- Username:
admin - Password: retrieved via the command below (if not set explicitly)
kubectl get secret --namespace monitoring grafana \
-o jsonpath="{.data.admin-password}" | base64 --decode; echo8. Upgrading Grafana
helm upgrade grafana grafana/grafana \
--namespace monitoring \
--values grafana-values.yamlTo upgrade to a specific chart version:
helm upgrade grafana grafana/grafana \
--namespace monitoring \
--values grafana-values.yaml \
--version 7.3.99. Uninstalling Grafana
helm uninstall grafana --namespace monitoring⚠️ Note: This does not delete PersistentVolumeClaims (PVCs). Delete them manually if needed:
kubectl delete pvc -n monitoring -l app.kubernetes.io/name=grafana
10. Common Troubleshooting
Pod not starting
kubectl describe pod -n monitoring -l app.kubernetes.io/name=grafana
kubectl logs -n monitoring -l app.kubernetes.io/name=grafanaCannot connect to Prometheus data source
Inside the Grafana UI go to Connections → Data Sources → Prometheus and click Save & Test. Common causes:
- Wrong service URL — verify with:
kubectl get svc -n monitoring - Prometheus pod not running — check
kubectl get pods -n monitoring - Network policy blocking traffic between namespaces
Dashboards not loading after provisioning
kubectl logs -n monitoring -l app.kubernetes.io/name=grafana | grep dashboardEnsure the dashboardProviders path matches the options.path in your provider config.
Forgotten admin password
Reset it by exec-ing into the pod:
kubectl exec -it -n monitoring \
$(kubectl get pod -n monitoring -l app.kubernetes.io/name=grafana -o jsonpath='{.items[0].metadata.name}') \
-- grafana-cli admin reset-admin-password new-passwordCheck the Helm release status
helm status grafana -n monitoring
helm get values grafana -n monitoring11. Complete values.yaml Example
A minimal but production-ready configuration combining all of the above:
replicas: 1
admin:
existingSecret: grafana-admin-secret
userKey: admin-user
passwordKey: admin-password
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi
persistence:
enabled: true
size: 10Gi
storageClassName: "standard"
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus-server.monitoring.svc.cluster.local:80
access: proxy
isDefault: true
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
kubernetes-cluster:
gnetId: 7249
revision: 1
datasource: Prometheus
node-exporter:
gnetId: 1860
revision: 37
datasource: Prometheus
plugins:
- grafana-clock-panel
- grafana-piechart-panel
ingress:
enabled: false # Set to true and configure hosts/tls for production12. Useful References
- Grafana Helm Chart on GitHub
- Grafana Documentation
- Grafana Dashboard Library
- Grafana Provisioning Docs
- kube-prometheus-stack — installs Prometheus + Grafana together