How do you capture Kubernetes events, and why bother?
BeginnerProductionKubernetes & Multi-Cluster Observability
Answer
Events (FailedScheduling, BackOff, Evicted, FailedMount, Killing) explain why a pod misbehaved, but the API server keeps them for only one hour by default. Ship them to Loki so they survive and can be correlated with metrics.
Options: Grafana Alloy's loki.source.kubernetes_events component, or kubernetes-event-exporter writing JSON to stdout or Loki.
sum by (reason) (count_over_time({job="integrations/kubernetes/eventhandler"} | json | type="Warning" [10m]))
We overlay warning events on service dashboards as annotations, which makes "it started right after the node drain" obvious.
More on Kubernetes & Multi-Cluster Observability
Which `kube-prometheus-stack` values do you always change before going to production?IntermediateOn a managed control plane (EKS, GKE, AKS), which default components and rules do you turn off?IntermediateOne Prometheus per cluster or one central Prometheus scraping every cluster?AdvancedHow do you make sure every series can be traced back to its cluster and environment?BeginnerKarpenter replaces nodes every few hours. How do you keep monitoring cheap and useful?AdvancedHow do you use metrics to right-size requests and limits across the cluster?Intermediate