-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kubeadm init 1700MB limit bug #2365
Comments
at least you can skip the check, which is good.
i cannot reproduce this problem on:
our code uses the Golang standard library to detect memory, which is calling the Linux note this is the first report we get about this problem, and we do have a number of RPI / kubeadm users. if you install Go for your architecture locally you can test this small snippet. call the file package main
import (
"fmt"
"syscall"
)
func main() {
info := syscall.Sysinfo_t{}
err := syscall.Sysinfo(&info)
if err != nil {
fmt.Printf("failed to get system info: %v\n", err)
return
}
fmt.Printf("actual MB: %v, bytes: %v\n", uint64(info.Totalram) / 1024 / 1024, info.Totalram)
} A) what output do you get if you run this locally on that machine? also if you install #include <sys/sysinfo.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main(void) {
struct sysinfo info = {};
if (sysinfo(&info) != 0) {
printf("errno %d: %s\n", errno, strerror(errno));
return 1;
}
printf("mem_unit (bytes): %d, totalram: %lu\n", info.mem_unit, info.totalram);
return 0;
} B) what output do you get if you run this locally on that machine? please share the output of A) and B). |
Happy to help debug! Output of A) actual MB: 1, bytes: 2016237 Output of B) totalram (bytes): 2016237 |
thanks for running the apps.
this is not great as the Linux kernel is reporting that you only have 2 million bytes of RAM or around 2 MB. i don't know what you can also check with other Raspbian users for feedback. i'm going to close this as this is not a kubeadm bug, but feel free to get back to us with a response (once you find more about it). /close |
@neolit123: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
i've also shared this issue in the kubernetes slack channel #arm64 to see if someone has see this. |
@neolit123 , I'll go ahead and share w/ raspbian etc -- thanks for the help. |
According to https://man7.org/linux/man-pages/man2/sysinfo.2.html "In the above structure, sizes of the memory and swap fields are given as multiples of mem_unit bytes." So it seems to get the total memory in bytes, you need to multiply totalram by mem_unit. |
What units do you get in your case? Please see the updated C code above,
recompile it with gcc and show the output.
|
Just done some testing to confirm this. On a 4GB Pi4 I get mem_unit (bytes): 1, totalram: 3982721024 But on an 8GB Pi4 I get mem_unit (bytes): 4096, totalram: 2000948 So it looks to me like Linux switches memory units when it needs to do so to avoid overflow, i.e. on 32-bit systems with more than 4GB of ram. |
Thanks for the details. I actually found about this field after my initial
tests above, but it was 1 and i did not think about overflow.
Looks like we need to multiply by mem units regardless and hopefully the
golang field Unit is populated correctly.
If anyone wishes to send a pr for that in kubeadm please go ahead.
/reopen
|
@neolit123: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
It looks like the offending code is in https://github.com/kubernetes/kubernetes/blob/cea1d4e20b4a7886d8ff65f34c6d4f95efcb4742/cmd/kubeadm/app/preflight/checks_linux.go "actual := uint64(info.Totalram) / 1024 / 1024" I believe should be changed to "actual := uint64(info.Totalram) * info.Unit / 1024 / 1024" I'm not a kubernates user or developer though (I was just alerted to this issue through the filing of a raspbian bug), so I can't easilly test this myself. |
@plugwash , @neolit123 -- thanks. I follow. Let me try to test and put a PR in today :) |
…ght 15/03/2021 complained for too old firmware - updated kubernetes version to latest stable (1.20.4) - updated flannel to latest stable (0.13.0) - fixed haproxy.cfg bug where haproxy complained about equal backend and frontend names - fixed kubeadm init error wrongly reporting insufficient memory on pi 4B 8GiB (known bug #kubernetes/kubeadm/issues/2365)
Is this a BUG REPORT or FEATURE REQUEST?
BUG REPORT
Versions
kubeadm version (use
kubeadm version
):kubeadm version: &version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:57:36Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/arm"}
Environment:
kubectl version
):Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:59:43Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/arm"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:51:19Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/arm"}
Raspberry Pi 4 Model B 8GB
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
uname -a
):Linux k8s-master 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l GNU/Linux
N/A
What happened?
I tried to run sudo kubeadm init --pod-network-cidr=10.244.0.0/16 on the master node which had 6.9GB available of free memory as per the below:
pi@k8s-master:~ $ free -h
total used free shared buff/cache available
Mem: 7.7Gi 112Mi 6.9Gi 8.0Mi 679Mi 7.3Gi
Swap: 0B 0B 0B
And it threw the following error:
[ERROR Mem]: the system RAM (1 MB) is less than the minimum 1700 MB
Which is obviously incorrect. There is 6.9 GB of memory available not < 1MB
What you expected to happen?
kubeadm init runs with no issues and no errors minus small pre-flight checks that are warnings.
How to reproduce it (as minimally and precisely as possible)?
Run sudo kubeadm init --pod-network-cidr=10.244.0.0/16 on a Raspberry Pi 4 Model B with swap disabled/uninstalled and 8GBs of total memory 6.9 of which are available.
Anything else we need to know?
Installation succeeds if I add "--ignore-preflight-errors=Mem"
The text was updated successfully, but these errors were encountered: