Kubernetes Metrics Pipeline: From Exporters and OTel Collector to Mimir
Classifying metric sources
Section titled “Classifying metric sources”Metrics that end up in Mimir in this environment fall into five categories by origin and purpose.
| Source | Deployment mode | Collector path | Purpose |
|---|---|---|---|
| prometheus-node-exporter | DaemonSet | otel-prometheus | Host CPU/memory/disk/network |
| kube-state-metrics | Deployment, 1 replica | otel-meta-monitoring | State of 28 K8s object types (Deployment/Pod/PVC, etc.) |
| kubeletstats/cAdvisor | Built into node | otel-prometheus | Per-container resource usage |
| Application OTLP/Micrometer | Deployment (otel-apps) | otel-apps | Business/service metrics |
| LGTM/Collector self-monitoring | Loki/Mimir/Tempo/Collector’s own endpoints | otel-meta-monitoring | Health of the observability stack itself |
Exporter deployment
Section titled “Exporter deployment”prometheus-node-exporter (DaemonSet)
Section titled “prometheus-node-exporter (DaemonSet)”Deployed with hostNetwork: true and hostPID: true, exposing the node’s actual CPU/memory/disk/network statistics. Since this is host-scoped data, it must exist as one instance per node rather than as a Deployment.
kube-state-metrics (Deployment, 1 replica)
Section titled “kube-state-metrics (Deployment, 1 replica)”Watches the Kubernetes API server and exposes the “declared state” of 28 object types (Deployments, Pods, PVCs, etc.) as metrics. Since this is an API state snapshot rather than host metrics, a single Deployment is enough; more replicas would just duplicate the same values.
otel-prometheus DaemonSet
Section titled “otel-prometheus DaemonSet”receivers: kubeletstats: collection_interval: 20s auth_type: serviceAccount endpoint: "https://${env:K8S_NODE_NAME}:10250" insecure_skip_verify: true metric_groups: - node - pod - container prometheus: config: scrape_configs: - job_name: node-exporter scrape_interval: 30s static_configs: - targets: ["localhost:9100"]kubeletstats pulls cAdvisor metrics (per-container CPU/memory) through kubelet’s /stats/summary API. This receiver requires RBAC, and the Collector’s ServiceAccount is granted nodes/stats access. Because it only scrapes each node’s localhost endpoint without Kubernetes API server discovery, the discovery-related RBAC scope stays minimal.
otel-meta-monitoring Deployment
Section titled “otel-meta-monitoring Deployment”receivers: prometheus: config: scrape_configs: - job_name: kube-state-metrics static_configs: - targets: ["kube-state-metrics.kube-system.svc.cluster.local:8080"] - job_name: loki-self-monitoring static_configs: - targets: ["loki-gateway.loki.svc.cluster.local:80"] - job_name: mimir-self-monitoring static_configs: - targets: ["mimir-gateway.mimir.svc.cluster.local:80"] - job_name: tempo-self-monitoring static_configs: - targets: ["tempo-gateway.tempo.svc.cluster.local:80"] - job_name: otel-collector-self static_configs: - targets: ["otel-apps.otel-collector.svc.cluster.local:8888"]A single Deployment scrapes kube-state-metrics, each LGTM component’s /metrics endpoint, and even the Collector’s own metrics, forwarding everything to Mimir. If this Deployment goes down, the path that “observes the observability stack” itself breaks, one reason it’s deployed as a separate failure domain from the other roles.
Application metrics
Section titled “Application metrics”Applications can send metrics via either the OTLP or Prometheus receiver. Spanmetrics (request count, latency, error rate) derived from trace spans are generated by otel-apps’s spanmetrics connector and forwarded to Mimir through a separate metric pipeline. This is covered in more depth in part 4, the trace pipeline post.
Why OTel scrape instead of ServiceMonitor
Section titled “Why OTel scrape instead of ServiceMonitor”In the Prometheus Operator ecosystem, scrape targets are usually registered declaratively via the ServiceMonitor CRD, and the Operator automates discovery. This implementation snapshot doesn’t use that approach: ServiceMonitor is disabled, and scrape targets are statically defined in the OTel Collector configuration.
- Actual choice: targets are registered as fixed entries under the Collector config’s
scrape_configs. Adding a new workload requires a config change (PR). - Alternative (for comparison): Prometheus Operator with ServiceMonitor auto-registers targets via label selectors, so adding a workload wouldn’t need a separate PR. However, since Prometheus Operator itself isn’t deployed in this environment, this alternative remains a future extension option only.
Cardinality and operational trade-offs
Section titled “Cardinality and operational trade-offs”- Common labels like cluster/namespace are attached to every metric so multiple environments can be distinguished within a single Mimir tenant.
- Mimir’s max series/ingestion limits are sized for this environment’s scale; adding a new high-cardinality metric (e.g., detailed per-pod labels) requires reviewing these limits first.
- Because self-monitoring is a feedback loop that observes its own failures, a failure in
otel-meta-monitoringitself must be detectable through a separate channel too (e.g., liveness probe failure alerts), the fact that alerting isn’t configured yet is revisited in part 5.
Next post
Section titled “Next post”The trace pipeline continues in Distributed Trace Pipeline: From Tail Sampling to Tempo Service Graphs.