Skip to main content
Agentkube’s Watcher feature provides real-time monitoring of your Kubernetes clusters, automatically detecting resource changes and delivering structured notifications through various channels including webhooks, Slack, email, and other services.

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

  1. Through Agentkube UI: Navigate to Settings > Watcher for visual configuration
  2. Through YAML file: Create or edit ~/.agentkube/watcher.yaml for programmatic setup

Quick Configuration Example

Start with a simple webhook handler and a few resource types to test your setup before expanding to full monitoring.

How Watcher Works

The event processing flow follows these steps:
  1. Detection: Controllers detect Kubernetes resource changes using SharedIndexInformers
  2. Processing: Events are queued, processed, and enriched with metadata
  3. Filtering: Events are filtered based on your configuration settings
  4. 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

The watcher.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:
The namespace filter is ignored when monitoring namespace resources themselves.

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