A tool for monitoring Kubernetes job execution status and sending notifications to Slack and Datadog.
- Notifications for Kubernetes job start, success, and failure
- Slack notifications with log attachments
- Datadog service check notifications
- Support for multiple container log collection
- Per-job notification customization
- Easy deployment with Helm charts
helm repo add kube-job-notifier https://yutachaos.github.io/kube-job-notifier/
helm install kube-job-notifier/kube-job-notifier --generate-name- Apply the manifests:
kubectl apply -f manifests/sample/- Verify the deployment:
kubectl get poConfigure using environment variables:
export MSTEAMSV2_ENABLED=true
export MSTEAMSV2_WEBHOOK_URL=YOUR_WEBHOOK_URL
export SLACK_ENABLED=true
export SLACK_TOKEN=YOUR_SLACK_TOKEN
export SLACK_CHANNEL=YOUR_NOTIFICATION_CHANNEL_ID
export SLACK_STARTED_NOTIFY=true # Optional, default: true
export SLACK_SUCCEEDED_NOTIFY=true # Optional, default: true
export SLACK_FAILED_NOTIFY=true # Optional, default: true
export SLACK_USERNAME=YOUR_NOTIFICATION_USERNAME # Optional
export SLACK_SUCCEED_CHANNEL=YOUR_NOTIFICATION_CHANNEL_ID # Optional
export SLACK_FAILED_CHANNEL=YOUR_NOTIFICATION_CHANNEL_ID # Optional
export DATADOG_ENABLED=true # Optional, default: false
export NAMESPACE=KUBERNETES_NAMESPACE # Optional
export CRONJOB_REGEX=REGEX # Optional, if empty all cronjobs will be includedYou can customize notification channels per job:
kube-job-notifier/default-channel - Default notification channel
kube-job-notifier/success-channel - Channel for successful job notifications
kube-job-notifier/started-channel - Channel for job start notifications
kube-job-notifier/failed-channel - Channel for failed job notifications
You can also suppress notifications:
kube-job-notifier/suppress-success-notification - Suppress success notifications
kube-job-notifier/suppress-started-notification - Suppress start notifications
kube-job-notifier/suppress-failed-notification - Suppress failure notifications
The following permissions are required:
chat:writefiles:write
- Sends Datadog service checks when jobs succeed or fail
- For more details: https://docs.datadoghq.com/developers/service_checks/dogstatsd_service_checks_submission/
You can specify log collection mode using the kube-job-notifier/log-mode annotation:
ownerContainer- Get logs only from container with the same name as the job (default)podOnly- Get logs from the pod, works perfectly with single container podspodContainers- Get logs from all pod containers and concatenate them
go run *.go -kubeconfig {YOUR_KUBECONFIG_PATH}For detailed documentation, visit: https://yutachaos.github.io/kube-job-notifier/