Skip to content

Cherry-pick #27552 to 7.15: Support kube_state_metrics v2.0.0#28049

Merged
MichaelKatsoulis merged 4 commits intoelastic:7.15from
MichaelKatsoulis:backport_27552_7.15
Sep 22, 2021
Merged

Cherry-pick #27552 to 7.15: Support kube_state_metrics v2.0.0#28049
MichaelKatsoulis merged 4 commits intoelastic:7.15from
MichaelKatsoulis:backport_27552_7.15

Conversation

@MichaelKatsoulis
Copy link
Copy Markdown
Contributor

@MichaelKatsoulis MichaelKatsoulis commented Sep 22, 2021

Cherry-pick of PR #27552 to 7.15 branch. Original message:

What does this PR do?

This PR enables Metricbeat to support kube-state-metrics version 2.0.0 for kubernetes.

In v2.0.0 some breaking changes where introduced.

  1. Following fields where removed and replaced by kube_pod_container_resource_requests and kube_pod_container_resource_limits.

    • kube_pod_container_resource_requests_cpu_cores
    • kube_pod_container_resource_limits_cpu_cores
    • kube_pod_container_resource_requests_memory_bytes
    • kube_pod_container_resource_limits_memory_bytes
  2. Following fields where removed and replaced by kube_node_status_capacity and kube_node_status_allocatable.

    • kube_node_status_capacity_pods
    • kube_node_status_capacity_cpu_cores
    • kube_node_status_capacity_memory_bytes
    • kube_node_status_allocatable_pods
    • kube_node_status_allocatable_cpu_cores
    • kube_node_status_allocatable_memory_bytes

Metricbeat was updated to support both new and old format of those fields.

Why is it important?

After version 2.0.0 of kube-state-metrics some fields where deprecated and replaced by others.
Without this PR fields

  • cpu.request.cores
  • cpu.limit.cores
  • memory.limit.bytes
  • memory.request.bytes
  • pod.capacity.total
  • cpu.capacity.cores
  • memory.capacity.bytes
  • pod.allocatable.total
  • cpu.allocatable.cores
  • memory.allocatable.bytes

where missing when kube-state-metrics v2.0.0 and higher was present in the Kubernetes
cluster.

Details can be found here.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Run metricbeat as daemonset in a Kubernetes cluster where kube-state-metrics v2.0.0 or higher is deployed and watch those fields getting populated in Elasticsearch.

Related issues

Screenshots

ksm-v2-state_container
ksm-v1 8-state_container
ksm-v2 0-state_node

* Support kube_pod_container_resource_requests and kube_pod_container_resource_limits
* Add kube_node_status_capacity and kube_node_status_allocatable support
* Add tests for ksm v2 for all state data streams

(cherry picked from commit 1596d64)
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 22, 2021
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 22, 2021
Copy link
Copy Markdown
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just fix the changelog

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Sep 22, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-09-22T14:39:56.767+0000

  • Duration: 96 min 34 sec

  • Commit: 6430a49

Test stats 🧪

Test Results
Failed 0
Passed 9231
Skipped 2319
Total 11550

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 9231
Skipped 2319
Total 11550

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test

@MichaelKatsoulis MichaelKatsoulis merged commit 90b7999 into elastic:7.15 Sep 22, 2021
@zube zube bot removed the [zube]: Done label Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Team:Integrations Label for the Integrations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants