Overview
TheAlertChannel custom resource defines how and where to send alerts. AlertChannels are cluster-scoped resources that can be referenced by any CronJobMonitor.
Channel Types
Slack
Send rich formatted alerts to Slack channels via webhooks
PagerDuty
Create incidents in PagerDuty for on-call escalation
Deliver alerts via SMTP email with custom templates
Webhook
POST alerts to any HTTP endpoint with custom payloads
Slack
Send alerts to Slack channels using incoming webhooks.Slack Configuration
Reference to a Secret containing the Slack webhook URL.Create the secret:
Override the webhook’s default channel (e.g.,
#alerts, @username).Go template for custom message formatting. If not specified, uses a built-in template.Available variables:
{\{ .Type }\}- Alert type (JobFailed, DeadManTriggered, etc.){\{ .Severity }\}- critical or warning{\{ .Title }\}- Alert title{\{ .Message }\}- Alert message{\{ .CronJob.Namespace }\},{\{ .CronJob.Name }\}- CronJob reference{\{ .MonitorRef.Namespace }\},{\{ .MonitorRef.Name }\}- Monitor reference{\{ .Context.Logs }\}- Pod logs{\{ .Context.Events }\}- Kubernetes events (array){\{ .Context.SuggestedFix }\}- Suggested fix text{\{ .Context.ExitCode }\}- Container exit code{\{ .Context.Reason }\}- Termination reason
{\{ .Severity | upper }\}- Uppercase{\{ .Severity | lower }\}- Lowercase{\{ .Message | truncate 100 }\}- Truncate to N chars{\{ formatTime .Timestamp "RFC3339" }\}- Format time
PagerDuty
Create incidents in PagerDuty for on-call escalation.PagerDuty Configuration
Reference to a Secret containing the PagerDuty integration/routing key.Create the secret:
Default PagerDuty severity. Valid values:
critical, error, warning, info.The dispatcher maps CronJob Guardian severities to PagerDuty:- Guardian
critical→ PagerDutycritical - Guardian
warning→ PagerDuty configured severity (default:error)
PagerDuty incidents include dedup_key based on the alert key, so repeated alerts update the same incident instead of creating duplicates.
Email Configuration
Reference to a Secret containing SMTP configuration.Required secret keys:
host- SMTP server hostnameport- SMTP server port (e.g., “587”)username- SMTP usernamepassword- SMTP password
Sender email address.
List of recipient email addresses.
Go template for email subject. Defaults to:
CronJob Guardian Alert: {\{ .CronJob.Name }\}Go template for email body. If not specified, uses a built-in template.
Webhook
Send alerts to custom HTTP endpoints with flexible payload templates.Webhook Configuration
Reference to a Secret containing the webhook URL.Create the secret:
HTTP method:
POST or PUT.Custom HTTP headers to include in requests.Environment variable substitution is supported:
Go template for the JSON payload. If not specified, sends a default structure.Use
{\{ .Field | jsonEscape }\} for string fields to ensure proper JSON escaping.Rate Limiting
All channel types support rate limiting to prevent alert storms:Maximum alerts per hour for this channel.
Maximum alerts per minute (burst allowance).
Rate limits are per-channel. The global dispatcher also has rate limits (default: 50/min) that apply across all channels.
Test on Save
Enable test alert dispatch when the AlertChannel is created or updated:Status Fields
The controller updates the status with operational metrics:Whether the channel is operational.
Total alerts successfully sent via this channel since creation.
Total alerts that failed to send.
Number of consecutive failures. Resets to 0 on successful send.
Channel Lifecycle
The AlertChannel controller:-
Registration: When an AlertChannel is created, the controller:
- Validates the configuration
- Fetches referenced secrets
- Registers the channel with the alert dispatcher
- Optionally sends a test alert (
testOnSave: true)
-
Updates: When an AlertChannel is updated:
- Re-validates configuration
- Re-fetches secrets (in case they changed)
- Updates the dispatcher’s channel registry
- Optionally re-tests
-
Deletion: When an AlertChannel is deleted:
- Removes from dispatcher registry
- In-flight alerts may still be delivered
- Pending (delayed) alerts referencing the channel are cancelled
Referencing Channels
CronJobMonitors reference AlertChannels by name:Examples
Slack Example
Complete Slack configuration
PagerDuty Example
PagerDuty integration setup
Email Example
SMTP email configuration
Webhook Example
Custom webhook integration
Next Steps
CronJobMonitor
Learn how to configure monitors
Alert Templates
Customize alert message formatting