Skip to content

Expose http timeout setting in Kubernetes package for kube state metrics#19391

Merged
MichaelKatsoulis merged 4 commits into
elastic:backport-kubernetes-1.83from
MichaelKatsoulis:expose-timeout-kubernetes-ksm
Jun 5, 2026
Merged

Expose http timeout setting in Kubernetes package for kube state metrics#19391
MichaelKatsoulis merged 4 commits into
elastic:backport-kubernetes-1.83from
MichaelKatsoulis:expose-timeout-kubernetes-ksm

Conversation

@MichaelKatsoulis

Copy link
Copy Markdown
Contributor

Proposed commit message

In large kubernetes cluster, fetching metrics from kube state metrics can exceed the default http timeout of 10s.
This error leads to leader nodes failures that are unrecoverable.
With this PR we expose the timeout option for KSM datasets that controls the http tiemout.
This option is availble in beats and standalone agent.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Screenshots

Screenshot 2026-06-05 at 12 02 42 PM

@MichaelKatsoulis MichaelKatsoulis requested a review from a team as a code owner June 5, 2026 09:03
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

✅ Elastic Docs Style Checker (Vale)

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.

@MichaelKatsoulis MichaelKatsoulis requested a review from gizas June 5, 2026 09:05
@github-actions

This comment has been minimized.

Comment thread packages/kubernetes/manifest.yml Outdated
- name: timeout
type: text
title: Timeout
description: HTTP request timeout. Raise on large clusters if scrapes exceed 10s and you see `context deadline exceeded` errors.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Valid time units are ns, us, ms, s, m, h.

This is what we have in other timeouts in the integration

This points to this https://github.com/elastic/beats/blob/5f41561f849f0c899682cb5909f1a96dac43b59b/metricbeat/mb/mb.go#L349 beats which validates there.
In case of s is missing it treats this as seconds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done!

multi: false
required: false
show_user: false
default: 10s

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

qq: why in the screenshot shows 30s?
Did u change the value? just to verify that we dont miss sth

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes!

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Buildkite failed in Dev scripts unit tests before reaching your Kubernetes changes. The failing test relies on package names that do not exist on the PR base backport branch, so the failure is not caused by the files changed in this PR.

Remediation

  • Update dev/scripts/test_get_release_commit.sh to avoid hardcoded real-repo package fixtures (prometheus, zscaler_zpa, security_detection_engine) for branch-agnostic CI; use only the existing dummy-repo fixture section (setup_dummy_repo) for deterministic tests.
  • Re-run the failing step after that test adjustment.
Investigation details

Root Cause

dev/scripts/test_get_release_commit.sh currently starts with hardcoded real-package assertions:

  • dev/scripts/test_get_release_commit.sh:70
  • dev/scripts/test_get_release_commit.sh:74
  • dev/scripts/test_get_release_commit.sh:78

Those call dev/scripts/get_release_commit.sh, which exits with:

  • dev/scripts/get_release_commit.sh:52 (Error: package '${PACKAGE_NAME}' not found.)

In this Buildkite run (backport branch context), those package manifests are absent, so the test fails deterministically before validating PR-specific logic.

Evidence

Verification

  • Reproduced the same failure mode from the test/script paths above (missing package fixture causes immediate non-zero exit from get_release_commit.sh).

Follow-up

  • Consider making these script tests fully fixture-driven (dummy repo only) to keep them stable across backport branches with different package inventories.

Note

🔒 Integrity filter blocked 2 items

The following items were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

What is this? | From workflow: PR Buildkite Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

✅ All changelog entries have the correct PR link.

@andrewkroh andrewkroh added Integration:kubernetes Kubernetes Team:obs-ds-hosted-services Observability Hosted Services team [elastic/obs-ds-hosted-services] labels Jun 5, 2026
@elasticmachine

Copy link
Copy Markdown

💚 Build Succeeded

History

@MichaelKatsoulis MichaelKatsoulis merged commit d62851b into elastic:backport-kubernetes-1.83 Jun 5, 2026
9 checks passed
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package kubernetes - 1.83.1 containing this change is available at https://epr.elastic.co/package/kubernetes/1.83.1/

zmoog added a commit that referenced this pull request Jun 19, 2026
…ics (#19662)

In large Kubernetes clusters, fetching metrics from kube state metrics can exceed the default HTTP timeout of 10s. This error leads to leader node failures that are unrecoverable. This PR exposes the `timeout` option for KSM datasets, controlling the HTTP timeout. This option is available in Beats and standalone agent.

This is a forward-port of #19391 (merged into `backport-kubernetes-1.83`) to `main`.
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package kubernetes - 1.85.2 containing this change is available at https://epr.elastic.co/package/kubernetes/1.85.2/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Integration:kubernetes Kubernetes Team:obs-ds-hosted-services Observability Hosted Services team [elastic/obs-ds-hosted-services]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants