Skip to content

Sends emails when Jobs end based on labels

License

Notifications You must be signed in to change notification settings

NYU-ITS/k8s-emailer

Repository files navigation

Kubernetes emailer

This is a simple controller that watches your Jobs and sends an email when they complete or fail. It is meant to offer similar functionality to what typical batch schedulers provide, for example SLURM.

screenshot of inbox with notification emails

It is available as a Helm Chart which should make it easy to install anywhere:

helm install \
    k8s-emailer \
    oci://ghcr.io/remram44/k8s-emailer/helm-charts/k8s-emailer \
    --version 0.1.3 \
    --namespace kube-system \
    --set emailTag=MY-ORG-CLUSTER \
    --set emailServer.host=smtp.example.org \
    --set [email protected]

Then users can annotate their jobs to receive emails automatically:

apiVersion: batch/v1
kind: Job
metadata:
  labels:
    k8s-emailer.hpc.nyu.edu/mode: "all"
    # "all": email for all status changes (succeeds, fails, restarts)
    # "failure": email on failure (not success)
    # "complete": email or failure or success
  annotations:
    k8s-emailer.hpc.nyu.edu/addresses: "[email protected], [email protected]"
  # ...
spec:
  # ...