π¨ Building a Production Kubernetes Alerting Pipeline β Google Chat (No SaaS Required)
One of the biggest operational challenges isn't deploying Kubernetes...
It's knowing something is broken before your users do.
Recently, I built a lightweight production alerting pipeline for our Kubernetes cluster that delivers critical alerts directly to Google Chat in real time.
The best part?
β No expensive third-party SaaS β Fully self-hosted β Lightweight β Easy to extend
ποΈ Architecture
Application Metrics
β
βΌ
Prometheus
β
βΌ
Prometheus Rules
β
βΌ
Alertmanager
β
βΌ
Python/Flask Bridge
β
βΌ
Google Chat SpaceSimple, reliable, and easy to maintain.
β‘ What We Monitor
Instead of alerting on everything (which quickly leads to alert fatigue), we focus on signals that actually matter.
π¨ HTTP Errors
- 5xx Error Rate
- 4xx Error Rate (excluding expected 401/404 responses)
- Per-URI Error Ratio
π Application Health
- High latency
- Failed Jobs
- Container waiting state
- CrashLoopBackOff
- Deployment replica mismatch
- HPA reaching maximum replicas
- Pod readiness failures
Only actionable alerts reach the team.
π₯ Prometheus Rules
The alerting logic is built using PromQL, calculating error percentages over a rolling five-minute window.
Example:
5xx Requests
βββββββββββββββ > 10%
Total RequestsSimilarly,
- 4xx error ratio
- Per-URI error ratio
- Kubernetes health alerts
are evaluated continuously.
π Lightweight Google Chat Bridge
Rather than relying on external notification services, I built a tiny Python + Flask webhook bridge.
Its job is simple:
π¨ Receive alerts from Alertmanager
β¬οΈ
π¨ Format them into readable messages
β¬οΈ
π¬ Deliver them directly to Google Chat
Since the bridge is completely independent, alert rules can evolve without redeploying the notification service.
π― Alertmanager Strategy
A few design choices dramatically reduced unnecessary notifications.
β Default receiver
Unmatched alerts are discarded instead of generating noise.
π¦ Intelligent Grouping
Alerts are grouped by:
- Alert Name
- Namespace
This keeps related events together instead of flooding the chat.
π
Alert Inhibition
Critical alerts automatically suppress lower-severity alerts for the same workload.
Instead of receiving:
β Warning
β Info
β Critical
You only receive:
π¨ Critical
β° Smart Repeat Interval
Long-running incidents are reminded every 4 hours, avoiding notification spam while keeping important issues visible.
π Deployment
Deployment is straightforward:
β Deploy the Google Chat bridge
β Apply Prometheus alert rules
β Update Alertmanager configuration
β Restart Alertmanager
After deployment, test by sending a sample alert to Alertmanager and verify it reaches Google Chat.
π Result
The final solution delivers:
β Real-time 4xx & 5xx error alerts
β Pod crash notifications
β HPA saturation alerts
β Deployment health alerts
β Resolved notifications
β Minimal resource footprint
β Fully self-hosted
β No additional SaaS cost
#DevOps #Kubernetes #EKS #Prometheus #Alertmanager #Monitoring #SRE #CloudNative #PlatformEngineering #Observability #GoogleChat #k8s π