all nodes in ubuntu:18.04)

问题描述 投票:0回答:1

In root@ansible: when i ran kubespray command to build cluster i encountered with this Error:

|  NAME   |  STATE  |         IPV4  
+---------+---------+-------------------         
| ansible | RUNNING | 10.21.185.23 (eth0)  
| node1   | RUNNING | 10.21.185.158 (eth0)  
| node2   | RUNNING | 10.21.185.186 (eth0)   
| node3   | RUNNING | 10.21.185.65 (eth0)  
| node4   | RUNNING | 10.21.185.106 (eth0)  
| node5   | RUNNING | 10.21.185.14 (eth0) 
lxc containers configuration:(include:node1,node2,node3,node4,node5)


TASK [kubernetes/preinstall : Disable swap] ******************
fatal: [node1]: FAILED! => {"changed": true, "cmd": ["/sbin/swapoff", "-a"], "delta": "0:00:00.020302", "end": "2020-05-13 07:21:24.974910", "msg": "non-zero return code", "rc": 255, "start": "2020-05-13 07:21:24.954608", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
fatal: [node2]: FAILED! => {"changed": true, "cmd": ["/sbin/swapoff", "-a"], "delta": "0:00:00.010084", "end": "2020-05-13 07:21:25.051443", "msg": "non-zero return code", "rc": 255, "start": "2020-05-13 07:21:25.041359", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
fatal: [node3]: FAILED! => {"changed": true, "cmd": ["/sbin/swapoff", "-a"], "delta": "0:00:00.008382", "end": "2020-05-13 07:21:25.126695", "msg": "non-zero return code", "rc": 255, "start": "2020-05-13 07:21:25.118313", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
fatal: [node4]: FAILED! => {"changed": true, "cmd": ["/sbin/swapoff", "-a"], "delta": "0:00:00.006829", "end": "2020-05-13 07:21:25.196145", "msg": "non-zero return code", "rc": 255, "start": "2020-05-13 07:21:25.189316", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
When i try to swapoff manually in nodes i receive nothing.

it will be so helpful if anyone has an idea.

architecture: x86_64
config:
  image.architecture: amd64
  image.description: ubuntu 18.04 LTS amd64 (release) (20200506)
  image.label: release
  image.os: ubuntu
  image.release: bionic
  image.serial: "20200506"
  image.version: "18.04"
  limits.cpu: "2"
  limits.memory: 2GB
  limits.memory.swap: "false"
  linux.kernel_modules: ip_tables,ip6_tables,netlink_diag,nf_nat,overlay
  raw.lxc: "lxc.apparmor.profile=unconfined\nlxc.cap.drop= \nlxc.cgroup.devices.allow=a\nlxc.mount.auto=proc:rw
    sys:rw"
  security.nesting: "true"
  security.privileged: "true"
  volatile.base_image: 93b9eeb85479af2029203b4a56a2f1fdca6a0e1bf23cdc26b567790bf0f3f3bd
  volatile.eth0.hwaddr: 00:16:3e:5a:91:9a
  volatile.idmap.base: "0"
  volatile.idmap.next: '[]'
  volatile.last_state.idmap: '[]'
  volatile.last_state.power: RUNNING
devices: {}
ephemeral: false
profiles:
- default
stateful: false
description: ""

root@node1:~# /sbin/swapoff -a
root@node1:~#

I ran Kubespray in lxc containers with below configuration:(server_ram:8G

kubernetes ansible ubuntu-18.04 ansible-inventory kubespray
1个回答
0
投票

  • Kernel.org.文件:dev-kmsg 文档:dev-kmsgswapoff -a

默认情况下

Kubespray 时,将无法供应集群。swapoff -a 在节点(lxc容器)上不可用。

是不可用的

容器,这将导致

供应。

有一个变通的方法。在每个 容器运行

: limits.memory.swap: "false"

Github.com。Justmeandopensource: lxd-provisioning: bootstrap-kube.sh

  • $ swapoff -a
  • /etc/fstab
  • $ reboot

我尝试了其他的变通方法,比如 添加 $ swapoff -a


-

弃用lxc 运转 kubespray 容器内,然后重新启动,是导致了

以坐100%使用一个核心。kubespray内核模块lxc

  • LXCLXD系统容器不会加载内核模块供自己使用。 你要做的,是让主机它加载内核模块,这个模块可以在容器中使用。
  • kmsg
  • Linuxcontainers.org: 如何将内核模块添加到LXC容器中?
  • conntrack 将检查您的节点中是否有某些内核模块可用。

您需要添加以下模块

在你的主机上

:

您可以通过以下方式添加上述模块 kubespray 或按此链接。

Cyberciti.biz: Linux如何自动加载内核模块

.

Conntrack

您将需要安装

并加载一个名为 : 没有上述命令

会在检查 kubespray. /dev/kmsg有了这个变化的地方,你应该能够运行Kubernetes集群与

/dev/kmsglxc 环境,并得到类似这样的节点输出。kubespray

© www.soinside.com 2019 - 2024. All rights reserved.