Cherry-pick #16834 to 7.x: Fix k8s metadata issue #16976
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #16834 to 7.x branch. Original message:
What does this PR do?
This PR fixes labels in k8s metadata. Issues found in 7.6 version: https://discuss.elastic.co/t/how-to-get-kubernetes-node-labels-with-metricbeat/220667/6
The proposed solution is to addkubernetes.labels.*
in all resources (node
,namespace
etc) so as to cover cases likenode
metricset. Also whennode
,namespace
, are part of other resources likepod
then their labels are part of the sub-resource and not the main resource.The proposed solution is to add
kubernetes.labels.*
innode
resources so as to cover cases likenode
metricset. Also whennode
, is part of other resources likepod
then their labels are part of the sub-resource and not the main resource.Example with
node
as main resource :Example with sub-resources:
Why is it important?
Currently the metadata are not populated properly.
Checklist
How to test this PR locally
TBA
Related issues