Skip to main content

Kube State Metrics

Kube-state-metrics exports Kubernetes object state such as workload replicas, pod phases, and resource requests. It is a single-replica, stateless metrics service.

Source paths

  • lumie-infra/observability/kube-state-metrics/argocd.yaml
  • lumie-infra/observability/kube-state-metrics/helm-values.yaml

Runtime contract

  • one replica in kube-state-metrics
  • headless ClusterIP service
  • ServiceMonitor enabled with release: prometheus
  • ServiceMonitor written into the prometheus namespace

Important relabeling behavior

Lumie rewrites exported labels back into the familiar namespace, pod, and container labels:

- sourceLabels: [exported_namespace]
targetLabel: namespace
- sourceLabels: [exported_pod]
targetLabel: pod

Source path: lumie-infra/observability/kube-state-metrics/helm-values.yaml

This keeps Grafana dashboards and PromQL queries compatible with standard label expectations.

Failure modes

  • Running more than one replica would duplicate metrics series, which is why the repo intentionally stays with a single replica.
  • If relabeling is removed, dashboards that expect namespace, pod, or container labels break even while kube-state-metrics itself remains healthy.

Verification

kubectl get applications.argoproj.io -n argocd kube-state-metrics
kubectl get pods -n kube-state-metrics
kubectl get servicemonitors -n prometheus | rg kube-state-metrics
kubectl describe deploy -n kube-state-metrics kube-state-metrics