Skip to content

Kubernetes Metrics Pipeline: From Exporters and OTel Collector to Mimir

Interactive Diagram

새 탭 ↗

Metrics that end up in Mimir in this environment fall into five categories by origin and purpose.

SourceDeployment modeCollector pathPurpose
prometheus-node-exporterDaemonSetotel-prometheusHost CPU/memory/disk/network
kube-state-metricsDeployment, 1 replicaotel-meta-monitoringState of 28 K8s object types (Deployment/Pod/PVC, etc.)
kubeletstats/cAdvisorBuilt into nodeotel-prometheusPer-container resource usage
Application OTLP/MicrometerDeployment (otel-apps)otel-appsBusiness/service metrics
LGTM/Collector self-monitoringLoki/Mimir/Tempo/Collector’s own endpointsotel-meta-monitoringHealth of the observability stack itself

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.

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.

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.

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.

PlantUML Diagram
PlantUML Diagram

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.
  • 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-monitoring itself 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.

The trace pipeline continues in Distributed Trace Pipeline: From Tail Sampling to Tempo Service Graphs.