Interview Prep/Monitoring & Observability/Kubernetes monitoring and the Prometheus Operator

kube-state-metrics pod OOMKilled in a large cluster

AdvancedTroubleshootingKubernetes monitoring and the Prometheus Operator
Answer

Likely causes → Thousands of objects × all resources × all labels (--metric-labels-allowlist=pods=[*]) in one replica.

Diagnose → kubectl top pod -n monitoring -l app.kubernetes.io/name=kube-state-metrics; check series count by job="kube-state-metrics".

Fix → Restrict --resources, narrow --metric-labels-allowlist, and shard horizontally (--shard/--total-shards, or StatefulSet auto-sharding).

Prevent → Track KSM series per resource type.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Kubernetes monitoring and the Prometheus Operator