Kubernetes cannot allocate memory error occurs when pods fail in Platform9 Managed Kubernetes.
As part of our Server Management Service, Bobcares responds to all questions—no matter how small—from customers.
Let’s examine more closely how our Support team resolves the error: kubernetes cannot allocate memory.
Kubernetes cannot allocate memory error : How to Solve ?
The simplest memory mistake we can possibly have in a pod is by far this one. One container tries to allocate more memory than is permit by the memory limit we’ve set, and it encounters an error “Kubernetes cannot allocate memory”. This typically results in one pod becoming unhealthy, one container dying, and Kubernetes restarting that pod. When we get the following error:
July 1 12:12:12 kubernetes-worker03-bobcares kubelet: E0404 12:12:12.089268 25745 pod_workers.go:192] Error syncing pod 00d9322c-9a71-843b-k5kb-8d7efgv24643 ("test(00d9322c-9a71-843b-k5kb-8d7efgv24643)"), skipping: failed to ensure that the pod: 00d9322c-9a71-843b-k5kb-8d7efgv24643 cgroups exist and are correctly applied: failed to create container for [kubepods burstable pod00d9322c-9a71-843b-k5kb-8d7efgv24643] : mkdir /sys/fs/cgroup/memory/kubepods/burstable/00d9322c-9a71-843b-k5kb-8d7efgv24643: cannot allocate memory
- Above is the link to the upstream problem that is causing this behaviour.. When this error occurs, Docker is unable to start containers because of cgroup memory allocation.
- Indicates that Kernel Version
3.10.0-1062.4.1 or later
should contain the fix for the problem slab leak causing a crash when using kmem control group. - However, the discussion also mentions that similar problems are reported for and present in Kernel versions higher than
3.10.0-1160.36.2.el7.x86 64.
Solution 1
- Adding the parameter cgroup.memory=nokmem to the GRUB_CMDLINE_LINUX line in the configuration file /etc/default/grub is one of the temporary workarounds.
- Then execute the subsequent commands.
$ grub2-mkconfig -o /boot/grub2/grub.cfg
$ reboot
Solution 2
The most long-term solution is to update the Kernel to the most recent version and see if that fixes the problem OR get in touch with the OS vendor for more help.
[Looking for a solution to another query? We are just a click away.]
Conclusion
To sum up, updating the Kernel to the most recent version allowed our Support team to fix the Kubernetes cannot allocate memory error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments