Fix kubernetes.memory.limits on kind clusters #11914
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.
What does this PR do?
When the
cadvisor
endpoint of the kubelet exposes twice thecontainer_spec_memory_limit_bytes
metric, do not sum them.Motivation
On
kind
clusters, thekubernetes.memory.limits
metric reported by the agent is currently twice the real pod memory limit.The
kubernetes.cpu.limits
,kubernetes.cpu.requests
andkubernetes.memory.requests
are all correct.The root cause of this bad value is that the
cadvisor
endpoint of kind kubelet is reporting the memory limit twice for a given container.Ex. with the following manifest (from DataDog/datadog-agent#10508):
On
kind
, the kubelet cadvisor endpoint returns:Whereas, for the same pod definition, a GKE kubelet cadvisor kubelet returns:
As shown above, on
kind
, the same value is reported twice for the samenamespace
,pod
,container
triplet.Those two identical values are currently summed at
integrations-core/kubelet/datadog_checks/kubelet/prometheus.py
Line 393 in 5858c86
This sum results in the agent sending twice the expected value.
Additional Notes
Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached