kubernetes: kube-apiserver: High pod churn causes APIServer OOM
What happened?
The kube-apiserver memory usage is too high. The node has 512GB of memory, but the kube-apiserver is using as much as 326GB. Profiling with Go revealed that StreamWatcher accounts for 84.49% of the memory usage.
memory usage:
flame graph:
golang profliing heap: kube-apiserver.heap.zip
golang profliing cpu:
cluster nodes: 4.6K
What did you expect to happen?
kube-apiserver memory remains at a low memory watermark.
How can we reproduce it (as minimally and precisely as possible)?
None
Anything else we need to know?
None
Kubernetes version
commit ID: 8885823091bd6419bb2b0b83617a0a6fe0aed8cd
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (22 by maintainers)
That proto stack has been in use for ~8 years, essentially unchanged. High memory use alone does not indicate a leak, it could just mean you have a large number of retained objects held in the watch cache. That memory is just attributed to whatever decoded the object received from the API, it doesn’t necessarily mean there is a leak in that code.
Do you see memory use increasing constantly or merely holding steady at a high level?
Have you tried to reproduce on a current version?
/remove-kind bug /kind support
Please try to reproduce on a currently supported version (1.28+). Significant changes and improvements have been made to memory management and watch memory usage since 1.17.