fix: Metrics Controllers Memory Leak #246
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.
Fixes #3209
Description
New Karpenter pod memory profile is shown bellow. Below is the top 10 blocks of memory for the karpenter controller.
After running karpenter for 10 hours, we see a sharpe increase in the memory used by the karpenter controller. Below is the top 10 blocks of memory for the karpenter controller pod.
We can see that there is lots of data being stored in both metrics provisioner/pod controllers ware there should not be 37.51 MB and 25.51 MB of memory being used by the controllers. This suggest a memory leak at these location.
github.com/aws/karpenter-core/pkg/controllers/metrics/provisioner.(*Controller).makeLabels
github.com/aws/karpenter-core/pkg/controllers/metrics/pod.(*Controller).makeLabels
How was this change tested?
In a 10 hour period, we see with node/pod churn the memory usage of Karpenter grows as a factor of time.
The memory usage of the karpenter will look as such in a 10 hour period with the implemented fix:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.