Towards Dev

A publication for sharing projects, ideas, codes, and new theories.

Follow publication

Enable SMTP in Grafana using Helm Charts in Kubernetes cluster(EKS)

--

Helm charts of most of the well-known opensource projects are kind of overwhelming at first glance. But they are made so that we can provide all the configuration while deploying, there is no need to edit docker or change anything just setup configuration. In this post, we will go through the setup of Gmail SMTP notification in grafana.

Banner

We will deploy the helm chart from the official repo http://grafana.github.io/helm-chart

Before we start make sure you have the following dependencies things:

  • helm
  • kubectl
  • Kubernetes cluster(minikube, kind, or any cloud provider) I am gonna use EKS.

Note: To setup minikube locally follow Link

Let's start first we need to import the helm chart using the following command

helm repo add grafana https://grafana.github.io/helm-charts

For setting up email notifications you need a Gmail account with 2FA enabled so that we can create an app password.

First let's enable IMAP in your Gmail account:

  • Go to Gmail → See All Settings
See all settings
  • Now enable IMAP → Hit save
  • Create an app password, Select App: Mail and Device: Others and click generate. It will give you a 16-letter password.

Lets deploy our grafana now

Now let's create overider_values.yaml please fill update your password and user.

env: 
GF_SMTP_ENABLED: "true"
GF_SMTP_HOST: "smtp.gmail.com:465"
GF_SMTP_PASSWORD: "qqqquuuuiiiioooo" #16 digit 2FA AppPassword
GF_SMTP_USER: "youremail@gmail.com"
GF_SMTP_FROM_ADDRESS: "youremail@gmail.com"
GF_SMTP_FROM_NAME: "Grafana"
  • Create a namespace for your deployment
kubectl create namespace grafana
  • Now lets deploy the helm charts
helm install grafana grafana/grafana 
--namespace grafana \
--set persistence.storageClassName="gp2" \
--set persistence.enabled=true
--set adminPassword=admin \
--set service.type=LoadBalancer \
--values ./override_values.yaml

This will deploy our grafana and create the following resources.

Now let's test it.

  • Open grafana dashboard using the external IP (if not available expose your service)
  • Logging using user: adminand password: admin
  • Go to Alerting → Contact Point
  • Edit the default email contact point.
  • Now enter your email and click Test
  • You should receive a test email like this.
  • Now setup your alters and notifications

Happy Helming !!!

References:

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Published in Towards Dev

A publication for sharing projects, ideas, codes, and new theories.

Written by Chetan Pandey

A Software Engineer from New Delhi, India with interests in Data Science, GoLang, NodeJS, Python Development, Microservices, APIs, VOIP, Neural Networks, UI/UX

No responses yet

Write a response