Getting Started with Watcher
The Watcher continuously monitors your Kubernetes resources and sends structured notifications when resources are created, updated, or deleted. Here’s how to get started:Configuration Options
- Through Agentkube UI: Navigate to
Settings>Watcherfor visual configuration - Through YAML file: Create or edit
~/.agentkube/watcher.yamlfor programmatic setup
Quick Configuration Example
How Watcher Works
The event processing flow follows these steps:- Detection: Controllers detect Kubernetes resource changes using SharedIndexInformers
- Processing: Events are queued, processed, and enriched with metadata
- Filtering: Events are filtered based on your configuration settings
- Notification: The configured dispatcher formats and sends notifications
Message Format
When the watcher sends events to your webhook endpoint, it posts a JSON payload with this structure:Event Types
The watcher sends three types of events for each monitored resource: • Create events - when resources are added to the cluster • Update events - when existing resources are modified• Delete events - when resources are removed from the cluster
Configuration File Structure
Thewatcher.yaml file contains two main sections: handlers and resources.
Basic Configuration Example
Notification Handlers
Configure where notifications should be sent when events occur.Only configure one handler at a time. Multiple handlers are not supported simultaneously.
Webhook Handler
Send events to any HTTP endpoint:Slack Integration
Slack Webhook
Slack API Token
Email Notifications
Microsoft Teams
Resource Monitoring
Configure which Kubernetes resources to monitor for changes.Core Resources
RBAC Resources
Cluster Resources
Custom Resources
Monitor Custom Resource Definitions (CRDs):Namespace Filtering
Control which namespaces to monitor:Troubleshooting
Common Issues
- No events received: Check if the selected resources are actually changing in your cluster
- Webhook not working: Verify the endpoint URL is correct and accessible
- Slack notifications failing: Ensure webhook URL is valid and channel exists
- Email not sending: Check SMTP credentials and server configuration
Configuration Validation
Ensure your configuration file contains:- At least one handler configured properly
- At least one resource type enabled
- Valid webhook URLs or notification service credentials
- Proper YAML syntax and structure

