写在前面
Laf部署还是很简单的,毕竟部署文档和脚本官方都提供了详见。难的是每个人的服务器环境和基础软件是不一样的,本文是我自己搭建Laf环境所踩的坑,希望对大家有帮助。
Centos7下的错误
环境
[root@sealos ~]# cat /proc/version
Linux version 3.10.0-514.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Nov 22 16:42:41 UTC 2016
[root@sealos ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
错误1
[upl-image-preview url=https://cdn.forum.laf.run/2023-05-11/1683808739-835715-img-v2-86b43279-8d59-4a81-9155-8619caf65b2g.png]
机器安装过docker会报错,需要卸载docker!!!
错误2
[upl-image-preview url=https://cdn.forum.laf.run/2023-05-11/1683809188-742966-image.png]
Centos7版本的原因,或者一些配置的问题,导致创建cgroup报错!!
改用Ubuntu下的错误
下载Ubuntu Server 22.04.2 LTS
环境
root@echo-server:/home/echo# uname -a
Linux echo-server 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@echo-server:/home/echo# cat /proc/version
Linux version 5.15.0-60-generic (buildd@lcy02-amd64-054) (gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023
错误1
[upl-image-preview url=https://cdn.forum.laf.run/2023-05-11/1683809897-139912-img-v2-cceeece3-1b93-4f4c-aae9-6440f9b0351g.jpg]
iptables命令没有安装导致报错!!!
错误2
[upl-image-preview url=https://cdn.forum.laf.run/2023-05-11/1683809954-617593-img-v2-291ccba1-7e84-487a-b0a5-54eb2d14f57g.jpg]
host命令没有安装导致报错!!!
解决办法
修改install-on-linux.sh文件,新增iptables、host命令的安装
# if apt installed, use `apt` to install
if [ -x "$(command -v apt)" ]; then
echo "deb [trusted=yes] https://apt.fury.io/labring/ /" | tee /etc/apt/sources.list.d/labring.list
apt update
apt install iptables host -y
apt install sealos -y
# fix /etc/hosts overwrite bug in ubuntu while restarting
sed -i "/update_etc_hosts/c \\ - ['update_etc_hosts', 'once-per-instance']" /etc/cloud/cloud.cfg && touch /var/lib/cloud/instance/sem/config_update_etc_hosts
fi
# if yum installed, use `yum` to install
if [ -x "$(command -v yum)" ]; then
cat > /etc/yum.repos.d/labring.repo << EOF
[fury]
name=labring Yum Repo
baseurl=https://yum.fury.io/labring/
enabled=1
gpgcheck=0
EOF
# yum update
yum clean all
yum install -y bind-utils iptables
yum install sealos -y
fi
上面的修改,已经提PR了。后面小伙伴们使用最新的Ubuntu系统部署laf时,就不用考虑上面的问题了。最终在修改了这个脚本后,重新部署laf成功!
后记
如果虚拟机安装,磁盘空间如果给的小的话,可能会出现sealos部署时一些pod的status会出现非Running状态,describe时会提示磁盘压力大的信息,这个时候需要对磁盘进行扩容了。在Ubuntu系统下我这里给的磁盘空间是70G,部署Laf环境能正常启动
DOMAIN="127.0.0.1.nip.io" 部署这里的127.0.0.1要修改成你自己虚拟机的ip地址
后面遇到了其他错误,会继续在这里进行更新。
一些好用的命令
# 重制sealos
sealos reset --force
# sealos部署时,可以加上debug详细输出
sealos run labring/kubernetes:v1.24.9 labring/flannel:v0.19.0 labring/helm:v3.8.2 --debug
如果小伙伴不想自己折腾这些,我这边可以提供部署好Laf环境的VMware完整文件,可以私我