Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[k8s] Fix System Integration to utilise hostfs mounts #6666

Merged

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Jan 31, 2025

What does this PR do?

This PR ensures that the Elastic Agent system integration correctly utilizes the /hostfs mount to collect host-level metrics. Previously, the system integration only monitored processes visible within the container due to missing configuration settings for the /hostfs path.

The changes include:

  • Adding system.hostfs: /hostfs to all relevant system metricsets in both the Helm Chart templates and rendered manifests.

Why is it important?

Without this fix, the Elastic Agent system integration collects only container-level metrics instead of full host-level metrics. This leads to incomplete observability of the Kubernetes nodes and limits visibility into host performance and resource utilization.

By explicitly setting system.hostfs: /hostfs, the agent can correctly access host-level /proc and /sys files, ensuring comprehensive monitoring.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • 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 changes 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/fragments using the changelog tool.
  • I have added an integration test or an E2E test.

Disruptive User Impact

This change does not introduce breaking changes, as it only enhances system integration behavior without modifying existing user configurations. However, users who previously relied on container-only monitoring should be aware that host-level metrics will now be collected.

How to test this PR locally

  1. Deploy the Elastic Agent using the updated Helm Chart having system integration enabled.
  2. Verify that /proc and /sys are mounted under /hostfs inside the container.
  3. Validate that collected metrics reflect the host system rather than just the containerized environment.

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

@pkoutsovasilis pkoutsovasilis added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify backport-8.18 Automated backport to the 8.18 branch labels Jan 31, 2025
@pkoutsovasilis pkoutsovasilis self-assigned this Jan 31, 2025
@pkoutsovasilis pkoutsovasilis force-pushed the helm/hostfs_system_integration branch from 9a1ab37 to 295e36b Compare January 31, 2025 09:19
@pkoutsovasilis pkoutsovasilis force-pushed the helm/hostfs_system_integration branch 2 times, most recently from 31b7f6c to 18d4de5 Compare February 1, 2025 09:58
@pkoutsovasilis pkoutsovasilis changed the title [Helm] Enable System Integration by default and utilise hostfs mounts [Helm] FIx System Integration to utilise hostfs mounts Feb 1, 2025
@pkoutsovasilis pkoutsovasilis changed the title [Helm] FIx System Integration to utilise hostfs mounts [Helm] Fix System Integration to utilise hostfs mounts Feb 1, 2025
@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review February 3, 2025 16:12
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner February 3, 2025 16:12
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@swiatekm
Copy link
Contributor

swiatekm commented Feb 5, 2025

This is also broken in https://github.com/elastic/elastic-agent/blob/main/deploy/kubernetes/elastic-agent-standalone-kubernetes.yaml, are we tracking that as a separate issue? Would probably be simplest to fix both at the same time.

@pierrehilbert
Copy link
Contributor

Shouldn't we also backport this on 9.0 branch?

@pkoutsovasilis pkoutsovasilis added the backport-9.0 Automated backport to the 9.0 branch label Feb 5, 2025
@pkoutsovasilis pkoutsovasilis changed the title [Helm] Fix System Integration to utilise hostfs mounts [k8s] Fix System Integration to utilise hostfs mounts Feb 5, 2025
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@pkoutsovasilis pkoutsovasilis merged commit 45b0cf4 into elastic:main Feb 11, 2025
14 checks passed
mergify bot pushed a commit that referenced this pull request Feb 11, 2025
* [helm]: fix system integration to utilise hostfs mount

* [kustomize]: fix system integration to utilise hostfs mount

---------

Co-authored-by: Julien Lind <julien.lind@elastic.co>
(cherry picked from commit 45b0cf4)
mergify bot pushed a commit that referenced this pull request Feb 11, 2025
* [helm]: fix system integration to utilise hostfs mount

* [kustomize]: fix system integration to utilise hostfs mount

---------

Co-authored-by: Julien Lind <julien.lind@elastic.co>
(cherry picked from commit 45b0cf4)
mergify bot pushed a commit that referenced this pull request Feb 11, 2025
* [helm]: fix system integration to utilise hostfs mount

* [kustomize]: fix system integration to utilise hostfs mount

---------

Co-authored-by: Julien Lind <julien.lind@elastic.co>
(cherry picked from commit 45b0cf4)
mergify bot pushed a commit that referenced this pull request Feb 11, 2025
* [helm]: fix system integration to utilise hostfs mount

* [kustomize]: fix system integration to utilise hostfs mount

---------

Co-authored-by: Julien Lind <julien.lind@elastic.co>
(cherry picked from commit 45b0cf4)
pkoutsovasilis added a commit that referenced this pull request Feb 11, 2025
* [helm]: fix system integration to utilise hostfs mount

* [kustomize]: fix system integration to utilise hostfs mount

---------

Co-authored-by: Julien Lind <julien.lind@elastic.co>
(cherry picked from commit 45b0cf4)

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
pkoutsovasilis added a commit that referenced this pull request Feb 12, 2025
* [helm]: fix system integration to utilise hostfs mount

* [kustomize]: fix system integration to utilise hostfs mount

---------

Co-authored-by: Julien Lind <julien.lind@elastic.co>
(cherry picked from commit 45b0cf4)

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
pkoutsovasilis added a commit that referenced this pull request Feb 12, 2025
* [helm]: fix system integration to utilise hostfs mount

* [kustomize]: fix system integration to utilise hostfs mount

---------

Co-authored-by: Julien Lind <julien.lind@elastic.co>
(cherry picked from commit 45b0cf4)

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
pkoutsovasilis added a commit that referenced this pull request Feb 13, 2025
* [helm]: fix system integration to utilise hostfs mount

* [kustomize]: fix system integration to utilise hostfs mount

---------

Co-authored-by: Julien Lind <julien.lind@elastic.co>
(cherry picked from commit 45b0cf4)

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify backport-8.18 Automated backport to the 8.18 branch backport-9.0 Automated backport to the 9.0 branch bug Something isn't working skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[k8s] System Integration Does Not Utilise /hostfs Mounts
6 participants