"The laziest Pokรฉmon that monitors your Kubernetes workloads while you take a nap!"
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ ๐ฆฅ Slaking - Kubernetes Log Monitoring Service โ
โ โ
โ "When your logs need attention, Slaking wakes up!" โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
A Kubernetes service that monitors workloads for specific annotations and sends filtered logs to Slack channels based on configurations - just like how Slaking watches over its territory!
- ๐ฆฅ Workload Monitoring: Like Slaking's keen senses, watches Kubernetes workloads (Pods, Deployments, StatefulSets, etc.) for specific annotations
- ๐ Log Filtering: Filters logs based on configurable patterns and criteria - Slaking knows exactly what to look for!
- ๐ฑ Slack Integration: Sends filtered logs to designated Slack channels - Slaking's way of communicating
- โ๏ธ Configuration Management: Supports multiple configurations for different workloads and channels
- โค๏ธ Health Monitoring: Built-in health checks and metrics - Slaking stays healthy!
- ๐ฆ Helm Chart: Complete Helm chart for easy deployment and management
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Kubernetes โ โ ๐ฆฅ Slaking โ โ Slack โ
โ Workloads โโโโโถโ Service โโโโโถโ Channels โ
โ (with โ โ โ โ โ
โ annotations) โ โ - Watcher โ โ - #alerts โ
โ โ โ - Filter โ โ - #errors โ
โ โ โ - Forwarder โ โ - #debug โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
Slaking's territory spans from your Kubernetes cluster to your Slack workspace!
The easiest way to deploy Slaking is using the provided Helm chart from the GitHub Pages repository:
# Add the Helm repository
helm repo add slaking https://elementtech.github.io/slaking
helm repo update
# Install the chart - Wake up Slaking to watch ALL namespaces!
helm install slaking slaking/slaking \
--namespace slaking \
--create-namespace \
--set env.SLACK_TOKEN="xoxb-your-token" \
--set env.SLACK_DEFAULT_CHANNEL="#alerts" \
--set env.K8S_WATCH_ALL_NAMESPACES="true"
# Install the chart to watch specific namespaces only
helm install slaking slaking/slaking \
--namespace slaking \
--create-namespace \
--set env.SLACK_TOKEN="xoxb-your-token" \
--set env.SLACK_DEFAULT_CHANNEL="#alerts" \
--set env.K8S_WATCH_ALL_NAMESPACES="false" \
--set env.K8S_NAMESPACES="production,staging,monitoring"
Alternative: Install from local chart directory (if you have the source code):
# Quick deployment with automated script (watches all namespaces by default)
./helm-deploy.sh
# Manual Helm deployment from local chart
helm install slaking ./charts/slaking \
--namespace slaking \
--create-namespace \
--set env.SLACK_TOKEN="xoxb-your-token" \
--set env.SLACK_DEFAULT_CHANNEL="#alerts" \
--set env.K8S_WATCH_ALL_NAMESPACES="true"
Benefits of Helm deployment:
- โ Easy configuration management
- โ Environment-specific values files
- โ Automatic RBAC setup
- โ Prometheus ServiceMonitor integration
- โ Horizontal Pod Autoscaler support
- โ Ingress configuration
- โ Comprehensive health checks
- โ Easy upgrades and rollbacks
For users who prefer direct Kubernetes manifests:
# Deploy using vanilla manifests
./deploy.sh
# Or manually
kubectl apply -f k8s/
Add these annotations to your Kubernetes workloads - Slaking will watch for these signals:
metadata:
annotations:
slaking.enabled: "true"
slaking.channel: "#alerts"
slaking.filters: "error|exception|fatal"
slaking.level: "error"
slaking.include-labels: "app=myapp,environment=prod"
Annotation | Description | Default |
---|---|---|
slaking.enabled |
Enable log forwarding for this workload | false |
slaking.channel |
Slack channel to send logs to | #general |
slaking.filters |
Regex patterns to filter logs | .* |
slaking.level |
Minimum log level (debug, info, warn, error) | info |
slaking.include-labels |
Comma-separated key=value pairs to include | "" |
slaking.exclude-labels |
Comma-separated key=value pairs to exclude | "" |
slaking.max-lines |
Maximum lines per message | 10 |
slaking.cooldown |
Cooldown period between messages (seconds) | 60 |
Slaking supports two modes for watching Kubernetes namespaces:
This is the default and recommended configuration. Slaking will monitor all namespaces in your cluster and only process logs from workloads that have the slaking.enabled: "true"
annotation.
Environment Configuration:
# Set to watch all namespaces
K8S_WATCH_ALL_NAMESPACES=true
# Leave K8S_NAMESPACES empty or unset
Helm Configuration:
helm install slaking slaking/slaking \
--set env.K8S_WATCH_ALL_NAMESPACES="true"
Benefits:
- โ No need to specify namespaces manually
- โ Automatically picks up new namespaces
- โ Works with any workload regardless of namespace
- โ Simpler configuration and maintenance
For environments where you want to limit Slaking's scope to specific namespaces (e.g., for security or performance reasons).
Environment Configuration:
# Disable watching all namespaces
K8S_WATCH_ALL_NAMESPACES=false
# Specify namespaces to watch
K8S_NAMESPACES=production,staging,monitoring
Helm Configuration:
helm install slaking slaking/slaking \
--set env.K8S_WATCH_ALL_NAMESPACES="false" \
--set env.K8S_NAMESPACES="production,staging,monitoring"
Use Cases:
- ๐ Multi-tenant clusters where you want to isolate monitoring
- ๐ Performance optimization for large clusters
- ๐ก๏ธ Security requirements that limit cross-namespace access
- Kubernetes cluster (1.19+)
- kubectl configured and connected to your cluster
- Docker installed and running
- Slack workspace with API access
- Helm 3.0+ (for Helm deployment)
-
Install from Helm repository (Recommended):
# Add the Helm repository helm repo add slaking https://elementtech.github.io/slaking helm repo update # Install with your Slack configuration - Time to wake up Slaking! # This will watch ALL namespaces by default helm install slaking slaking/slaking \ --namespace slaking \ --create-namespace \ --set env.SLACK_TOKEN="xoxb-your-token" \ --set env.SLACK_DEFAULT_CHANNEL="#alerts" \ --set env.K8S_WATCH_ALL_NAMESPACES="true"
-
Alternative: Local development setup:
# Clone and install dependencies git clone https://github.com/ElementTech/slaking.git cd slaking npm install # Set up environment variables cp env.example .env # Edit .env with your Slack token and other settings # By default, it will watch all namespaces # Deploy using automated script ./helm-deploy.sh
-
Configure your workloads with annotations and watch logs flow to Slack! ๐ฆฅ
# Update the repository
helm repo update
# Check available versions
helm search repo slaking/slaking
# Upgrade to latest version (maintains current namespace configuration)
helm upgrade slaking slaking/slaking \
--namespace slaking \
--reuse-values
# Upgrade and change to watch all namespaces
helm upgrade slaking slaking/slaking \
--namespace slaking \
--set env.K8S_WATCH_ALL_NAMESPACES="true" \
--reuse-values
# Upgrade and change to watch specific namespaces only
helm upgrade slaking slaking/slaking \
--namespace slaking \
--set env.K8S_WATCH_ALL_NAMESPACES="false" \
--set env.K8S_NAMESPACES="production,staging" \
--reuse-values
# Or upgrade to a specific version
helm upgrade slaking slaking/slaking \
--namespace slaking \
--version 1.0.1 \
--reuse-values
GET /health
- Health check (Slaking's vital signs)GET /metrics
- Prometheus metrics (Slaking's stats)POST /config
- Update configurationGET /config
- Get current configurationGET /status
- Service status (includes namespace configuration)
The service exposes Prometheus metrics at /metrics
for monitoring - Slaking's performance stats:
slaking_logs_processed_total
slaking_logs_filtered_total
slaking_slack_messages_sent_total
slaking_errors_total
Create a Grafana dashboard with these queries:
# Log processing rate
rate(slaking_logs_processed_total[5m])
# Error rate
rate(slaking_errors_total[5m])
# Active streams
slaking_active_streams
# Slack message rate
rate(slaking_slack_messages_sent_total[5m])
The Helm chart supports extensive configuration:
# values-production.yaml
replicaCount: 3
hpa:
enabled: true
maxReplicas: 5
serviceMonitor:
enabled: true
config:
slack:
defaultChannel: "#prod-alerts"
kubernetes:
# Watch all namespaces (recommended)
watchAllNamespaces: true
namespaces: []
# OR watch specific namespaces only
# watchAllNamespaces: false
# namespaces: ["production", "staging"]
env:
SLACK_TOKEN: "xoxb-your-token"
K8S_WATCH_ALL_NAMESPACES: "true"
# K8S_NAMESPACES: "production,staging" # Only needed if watchAllNamespaces: false
Create separate values files for different environments:
values-production.yaml
- Production settingsvalues-staging.yaml
- Staging settingsvalues-development.yaml
- Development settings
-
No logs being sent to Slack
- Check if annotations are properly set
- Verify Slack token and channel permissions
- Check service logs for errors
-
Too many messages
- Adjust cooldown period
- Refine filter patterns
- Set appropriate log levels
-
Permission denied
- Ensure proper RBAC configuration
- Check service account permissions
-
Helm repository not found (404 error)
- Ensure GitHub Pages is enabled for the
gh-pages
branch - Check that the chart-releaser action has run successfully
- Verify the repository URL is correct:
https://elementtech.github.io/slaking
- Wait a few minutes after pushing changes for GitHub Pages to update
- Ensure GitHub Pages is enabled for the
Repository-based Helm deployment:
helm upgrade slaking slaking/slaking \
--namespace slaking \
--set env.LOG_LEVEL=debug \
--reuse-values
Local Helm deployment:
helm upgrade slaking ./charts/slaking \
--namespace slaking \
--set env.LOG_LEVEL=debug
# Test health endpoint
kubectl port-forward -n slaking svc/slaking 3000:3000
curl http://localhost:3000/health
# Test metrics endpoint
kubectl port-forward -n slaking svc/slaking-metrics 9090:9090
curl http://localhost:9090/metrics
# Check status
helm list -n slaking
kubectl get pods -n slaking
# View logs
kubectl logs -n slaking -l app=slaking
# Test deployment
kubectl port-forward -n slaking svc/slaking 3000:3000
curl http://localhost:3000/health
# Upgrade deployment
helm upgrade slaking slaking/slaking \
--namespace slaking \
--reuse-values
# Uninstall
helm uninstall slaking -n slaking
kubectl delete namespace slaking
# Check status
./helm-deploy.sh status
# View logs
./helm-deploy.sh logs
# Test deployment
./helm-deploy.sh test
# Upgrade deployment
./helm-deploy.sh upgrade
# Uninstall
./helm-deploy.sh uninstall
The service requires minimal permissions:
- Read access to pods and their logs
- Watch access to deployments, statefulsets, daemonsets
- Read access to namespaces
- Service runs on ClusterIP by default
- Metrics endpoint is separate for Prometheus scraping
- No external access required
- Slack token is stored in Kubernetes Secret
- Consider using external secret management (HashiCorp Vault, AWS Secrets Manager, etc.)
๐ฆฅ Slaking says: "Thanks for choosing me as your Kubernetes monitor!"
"When your logs need attention, I'll be there to help!"
MIT
Made with โค๏ธ by the Slaking team - Because even the laziest Pokรฉmon can be the most reliable! ๐ฆฅ