麒麟v10系统通过sealos安装k8s集群错误

1)k8s初始化报错如下:
[root@master ~]# kubeadm init --config init.yaml
W0609 03:56:38.026430 11360 validation.go:28] Cannot validate kube-proxy config - no validator is available
W0609 03:56:38.026511 11360 validation.go:28] Cannot validate kubelet config - no validator is available
[init] Using Kubernetes version: v1.17.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 FileContent–proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1
[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
解决方法:
这个是因为安装master节点时环境准备没有做好:按照下列操作
cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.ip_forward=1
net.ipv4.tcp_tw_recycle=0
vm.swappiness=0
vm.overcommit_memory=1
vm.panic_on_oom=0
fs.inotify.max_user_instances=8192
fs.inotify.max_user_watches=1048576
fs.file-max=52706963
fs.nr_open=52706963
net.ipv6.conf.all.disable_ipv6=1
net.netfilter.nf_conntrack_max=2310720
EOF
sysctl --system
2)执行kubeadm init集群初始化时遇到:
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd".
[警告IsDockerSystemdCheck]:检测到“cgroupfs”作为Docker cgroup驱动程序。 推荐的驱动程序是“systemd”。
解决方法:
在/etc/docker下创建daemon.json并编辑:
vim /etc/docker/daemon.json
加入以下内容:
{
"exec-opts":["native.cgroupdriver=systemd"]
}
3)执行kubeadm init集群初始化时遇到:
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1

解决方法:

在集群安装过程中不断的批量执行以下命令,直到安装成功(安装过程中会自动将这个值改为0,为0就无法安装成功,必须为1)
echo "1" > /proc/sys/net/ipv4/ip_forward
nmcli c reload

 

posted @ 2022-06-16 15:43  亲爱滴hh  阅读(645)  评论(0)    收藏  举报