运行kubeadm init时出现以下错误:
[init] Using Kubernetes version: v1.16.2
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR Swap]: running with swap on is not supported. Please disable swap
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
sudo swapoff -aswapoff: /swapfile: swapoff failed: Cannot allocate memory
我在并行桌面中使用Ubuntu VM
free -m command output below:$ free -m total used free shared buff/cache availableMem: 979 455 87 1 436 377Swap: 2047 695 1352
最佳答案
您没有足够的RAM。您的机器得以幸存,是因为您使用了交换文件(即使用硬盘驱动器获取了额外的伪RAM),但Kubernetes不支持该文件,因此它试图将其关闭,但由于没有足够的RAM而失败了。
关于linux - swapoff:/swapfile:swapoff失败:无法分配内存,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58756014/