What are the dangers of high-cardinality metrics in Kubernetes and how do you avoid them?
AdvancedProductionObservability & Day-2 Operations
Answer
Labels such as Pod name, user ID or URL path multiply series, blowing up memory, ingestion cost and query times, and can OOM Prometheus. Avoid unbounded labels, drop pod-level labels for short-lived Jobs in aggregation, apply relabeling limits (sample_limit, label_limit), and track topk(10, count by (__name__)({__name__=~".+"})).
More on Observability & Day-2 Operations
What are the three pillars of observability and the standard tools on Kubernetes?BeginnerWhat is kube-state-metrics and how does it differ from metrics-server?BeginnerWhich alerts do you set up first on a cluster?BeginnerWhere do container logs live and how do you ship them?BeginnerWhat is the difference between `kubectl logs --previous` and `kubectl logs -f`?BeginnerWhat does a good runbook for a Kubernetes alert include?Beginner