question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[kubernetes_state] Metrics for HPA renamed in 2.x

See original GitHub issue

Output of the info page It may be poor judgement, but it seems to me irrelevant for this issue

Additional environment details (Operating System, Cloud provider, etc): Datadog Agent 7.24.1 with Datadog Cluster Agent 1.9.1 deployed in a Kubernetes 1.17 cluster.

Steps to reproduce the issue:

  1. Deploy the newest stable Datadog Agent (optional: and the cluster agent) in a Kubernetes 1.17+ cluster
  2. Deploy kube-state-metrics 2.0.0-beta (The only version compatible with Kubernetes 1.17+)
  3. Create a deployment with horizontal pod autoscaler (HPA)
  4. Look at the metrics explorer/summary in Datadog.

Describe the results you received: The kubernetes_state.hpa.* metrics are not being sent. The reason is that kube-state-metrics 2.x has renamed the metrics internally from kube_hpa_* to kube_horizontalpodautoscaler_* (https://github.com/kubernetes/kube-state-metrics/pull/1003). Same metrics, different prefix. These metrics are not correctly recognized by the kubernetes_state check.

Describe the results you expected: I expect the Datadog integration to send the horizontal pod autoscaler metrics to Datadog.

Additional information you deem important (e.g. issue happens only occasionally): I have worked around the issue by ‘monkey-patching’ the Docker container to rename the kube_hpa_* metrics to kube_horizontalpodautoscaler_* at:

However, this is not strictly compatible with the old kube_state_metrics as kube_state_metrics 1.x will report a label hpa with the name of the horizontal pod autoscaler, while in 2.x this tag is renamed to horizontalpodautoscaler, so I had to change some monitors/dashboards to make it work correctly.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:12
  • Comments:6

github_iconTop GitHub Comments

2reactions
TheHodge1234commented, Sep 15, 2021

I have just run into this issue, after Datadog support told me to upgrade to 2.x to fix another issue I have now lost the HPA metrics!

This needs fixing

0reactions
TheHodge1234commented, Oct 7, 2021

I have an open ticket with Datadog support on this - they are pretty adamant that it works - but everything they have told me to do so far doesn’t work!

They appear to believe that the issue is that we are utilising KSM Legacy and not KSM Core - but i have tried (using their info) to move to KSM Core, and it still breaks the HPA metrics. KSM Core does not require us to even run an external KSM pod

Read more comments on GitHub >

github_iconTop Results From Across the Web

kube-state-metrics goes v2.0 - Kubernetes
All metrics with a prefix of kube_hpa_* were renamed to kube_horizontalpodautoscaler_* . Metric labels that relate to Kubernetes were converted ...
Read more >
How to Configure Kubernetes Horizontal Pod Autoscaler ...
In order to work, HPA needs a metrics server available in your cluster to scrape required metrics, such as CPU and memory utilization....
Read more >
CHANGELOG.md - kubernetes/kube-state-metrics
[FEATURE] Add experimental Custom-Resource State Metrics #1710 @iamnoah ... [CHANGE] v2: Rename hpa metrics to use full horizontalpodautoscaler #1003 All ...
Read more >
Kubernetes State Metrics Core - Datadog Docs
The Kubernetes State Metrics Core check leverages kube-state-metrics version 2+ and includes major performance and tagging improvements compared to the ...
Read more >
Kubernetes pod autoscaler using custom metrics - Sysdig
The Kubernetes HPA is able to retrieve metrics from several APIs out of the box: metrics.k8s.io , custom.metrics.k8s.io (the one that we will ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found