With ArgoCD managing CD pipeline for many of my applications, I really wanted a way to receive notifications about deployment changes, outages, etc.
ArgoCD Notifications seemed perfect for this, so I have set it up with my Gmail account, and here is how I did it.
Prerequisites
- A Kubernetes cluster with ArgoCD installed
- A Gmail account
Gmail account setup
Before installing the notification controller, generate a new app password for your gmail account, so that the notification controller can send emails on your behalf.
Feel free to set up a new Gmail account for this purpose. I just used my personal account to send notifications to myself.
See the “Create & use app passwords” section in Sign in with app passwords - Gmail Help for the steps, and keep the generated password around.
Installation
First, install the notification controller:
|
|
Then create a secret with the app password (email includes the “@gmail.com” part):
|
|
Check the logs of the notification controller to see if it picked up the config.
Configuration
In the argocd
namespace, there should be a configmap called argocd-notifications-cm
creaed along with the installation. Edit it and add the following to the data field:
|
|
This will tell the notification controller to send emails to <your-email>
when the specified triggers are fired.
A special case
This section only applies if you manage multiple Kustomize applications under a single GitHub repository, and deploy them with ArgoCD.
As of the time of writing, the default triggers have a problem… The on-deployed
trigger will fire for every application in the repository, not just the one that was deployed, resulting in an overwhelming amount of emails.
To fix this, you can modify the once-per
field of the trigger.on-deployed
section in argocd-notifications-cm
. Example:
|
|
Testing
You can use either a new application or an existing one to test notifications. The easiest way is to just go to your ArgoCD UI and sync an application. You should see an email in your inbox shortly.
Conclusion
Using a Gmail account and an app password is not the most secure way, I know, but it is the easiest way to get notifications set up quickly.
Originally I was thinking about setting up a self-hosted mail server that I can use for other projects as well, but it was not as simple as I initially thought especially for outbound emails. Maybe I will figure it out one day.