Conjure-up Kubernetes 安装失败,因为“/proc/sys/net/core/somaxconn”不存在,

Conjure-up Kubernetes 安装失败,因为“/proc/sys/net/core/somaxconn”不存在,

当我在工作站通过 conjure-up 安装 Kubernetes 时,结果出现 somaxconn 不存在以及一些 mongo 错误。

VM 配置 2 vCPU、8 GB vRAM 和 100 GB vDisk,全新安装。

dee@juju:~$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              393M  1.5M  391M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  3.9G  2.2G  1.6G  58% /
tmpfs                              2.0G     0  2.0G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda2                          976M  140M  770M  16% /boot
/dev/mapper/ubuntu--vg-lv--0        40G   49M   38G   1% /home
/dev/loop0                          87M   87M     0 100% /snap/core/4917
tmpfs                              393M     0  393M   0% /run/user/1000
/dev/loop1                          55M   55M     0 100% /snap/lxd/8393
tmpfs                              1.0M     0  1.0M   0% /var/snap/lxd/common/ns
/dev/loop2                         105M  105M     0 100% /snap/conjure-up/1019
dee@juju:~$

我按照以下博客的步骤在本地主机上安装了 kubernetes 和 lxd

dee@juju:~/.cache/conjure-up$ which juju
/snap/bin/juju
dee@juju:~/.cache/conjure-up$ juju version
2.4.1-bionic-amd64
dee@juju:~/.cache/conjure-up$  which conjure-up
/snap/bin/conjure-up
dee@juju:~/.cache/conjure-up$  conjure-up --version
]2;conjure-upconjure-up 2.6.1
dee@juju:~/.cache/conjure-up$ which lxc
/snap/bin/lxc
dee@juju:~/.cache/conjure-up$  /snap/bin/lxc config show
config:
  core.https_address: '[::]'
  core.trust_password: true
dee@juju:~/.cache/conjure-up$  /snap/bin/lxc version
Client version: 3.4
Server version: 3.4
dee@juju:~/.cache/conjure-up$  cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

dee@juju:~/.cache/conjure-up$sosreport 

sosreport (version 3.5)

no valid plugins were enabled

.cache/conjure-up/pwd 中发现的一些错误代码

 ERROR juju.mongo mongo.go:567 could not set the value of "/proc/sys/net/core/somaxconn" to "16384" because of:   will not set "16384"', '2018-08-18 05:11:14 ERROR juju.mongo mongo.go:567 could not set the value of "/proc/sys/net/core/netdev_max_backlog" to "1000" because of: "/proc/sys/net/core/netdev_max_backlog" does not exist, will not set "1000"', '2018-08-18 05:11:14 ERROR juju.mongo mongo.go:567 could not set the value of "/sys/kernel/mm/transparent_hugepage/enabled" to "never" because of: open /sys/kernel/mm/transparent_hugepage/enabled: permission denied', '2018-08-18 05:11:14 ERROR juju.mongo mongo.go:567 could not set the value of "/sys/kernel/mm/transparent_hugepage/defrag" to "never" because of: open /sys/kernel/mm/transparent_hugepage/defrag: permission denied', '2018-08-18 05:11:14 INFO juju.mongo mongo.go:439 Ensuring mongo server is running; data directory /var/lib/juju; port 37017', '2018-08-18 05:11:14 INFO juju.mongo mongo.go:640 installing [juju-mongodb3.2 juju-mongo-tools3.2]', '2018-08-18 05:11:14 INFO juju.packaging.manager utils.go:64 Running: apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install juju-mongodb3.2', '2018-08-18 05:12:25 INFO juju.packaging.manager utils.go:64 Running: apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install juju-mongo-tools3.2', 'ERROR failed to start mongo: error creating oplog files: failed to write to mongo prealloc file "/var/lib/juju/db/local.0": write /var/lib/juju/db/local.0: no space left on device', 'ERROR failed to bootstrap model: subprocess encountered error code 1']
2018-08-18 05:13:05,968 [DEBUG] conjure-up/kubernetes-core - events.py:52 - Setting Error at conjureup/events.py:149
2018-08-18 05:13:05,968 [ERROR] conjure-up/kubernetes-core - events.py:161 - Unhandled exception in <Task finished coro=<BaseBootstrapController.run() done, defined at /snap/conjure-up/1019/lib/python3.6/site-packages/conjureup/controllers/juju/bootstrap/common.py:15> exception=BootstrapError('Unable to bootstrap (cloud type: localhost)',)>

答案1

我也遇到了同样的情况,但最终解决了权限问题。

使用这一页,我实际上用 snapd 版本替换了我的 lxd 服务。不过,我很确定你只需要执行以下步骤即可解决权限错误:

sudo usermod -a -G lxd $USER
newgrp lxd

注销并重新登录后,运行以下命令进行测试:

/snap/bin/lxc query --wait -X GET /1.0

如果您得到了良好的响应并且不再出现连接到 unix.sock 的错误,那么它就成功了。

答案2

与您的问题没有直接关系,但请考虑 Canonical Kubernetes 团队的 microk8s(https://microk8s.io/) 当您想要在笔记本电脑上部署 Kubernetes 时。

快速安装 - 在 60 秒内即可运行完整的上游 Kubernetes 系统

安全可靠 - 采用最先进的隔离技术,在您的笔记本电脑上安全运行。

纯上游 - 直接来自源头的二进制文件,传送到您的笔记本电脑并在几秒钟内完成配置!

相关内容