Grafana
DevOps,  Grafana,  Kubernetes,  Monitoring Tools

Grafana running on kubernetes: How to configure SMTP integration

Grafana has a built-in alerting system and it can be used to trigger email notifications whenever an alert is raised. This page shows you how to configure the integration with an external SMTP server.

  • Create a ConfigMap that includes the grafana.ini main configuration file
    • Sample ConfigMap yaml manifest:
apiVersion: v1
data:
  grafana.ini: |
    [analytics]
    check_for_updates = true
    [grafana_net]
    url = https://grafana.net
    [log]
    mode = console
    [paths]
    data = /var/lib/grafana/
    logs = /var/log/grafana
    plugins = /var/lib/grafana/plugins
    provisioning = /etc/grafana/provisioning
    [server]
    domain =
    [smtp]
    enabled = true
    host = smtp.test.com:587
    user = test@test.com
    password = xxxxxxxxx
    startTLS_policy = MandatoryStartTLS
    skip_verify = true
    from_address = test@test.com
    from_name = Grafana
kind: ConfigMap
metadata:
  annotations:
    meta.helm.sh/release-name: prometheus
    meta.helm.sh/release-namespace: monitoring
  labels:
    app.kubernetes.io/instance: prometheus
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: grafana
    app.kubernetes.io/version: 9.1.4
    helm.sh/chart: grafana-6.38.0
  name: prometheus-grafana
  namespace: monitoring
  • Restart grafana pod(s) to apply the new config described above:
# kubectl delete -n monitoring $(kubectl get pods -n monitoring -o=name -l app.kubernetes.io/name=grafana)