栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

基于docker-Kubernetes的web集群项目|Master节点初始化时报错

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

基于docker-Kubernetes的web集群项目|Master节点初始化时报错

一、报错信息如下
[root@master ~]# kubeadm init 
> --apiserver-advertise-address=192.168.153.144 
> --image-repository registry.aliyuncs.com/google_containers 
> --service-cidr=10.1.0.0/16 
> --pod-network-cidr=10.244.0.0/16

W0512 19:52:12.388569 8202 version.go:103] could not fetch a Kubernetes version from the internet: unable to get URL “https://dl.k8s.io/release/stable-1.txt”: Get “https://dl.k8s.io/release/stable-1.txt”: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
W0512 19:52:12.388656 8202 version.go:104] falling back to the local client version: v1.24.0
[init] Using Kubernetes version: v1.24.0
[preflight] Running pre-flight checks
[WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service’kubelet未开启
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: time=“2022-05-12T19:52:12+08:00” level=fatal msg=“getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService”
, error: exit status 1
[ERROR FileContent–proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables 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

二、查看报错信息可知安装完K8s组件时,kubelet未设置开机自启
#设置开机自启,kubelet是K8s在node节点上的代理,必须开机运行
systemctl enable  kubelet.service
三、还是报错,信息如下
[root@master ~]# kubeadm init --apiserver-advertise-address=192.168.153.144 --image-repository registry.aliyuncs.com/google_containers --service-cidr=10.1.0.0/16 --pod-network-cidr=10.244.0.0/16

W0512 19:56:08.781216 8244 version.go:103] could not fetch a Kubernetes version from the internet: unable to get URL “https://dl.k8s.io/release/stable-1.txt”: Get “https://dl.k8s.io/release/stable-1.txt”: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
W0512 19:56:08.781296 8244 version.go:104] falling back to the local client version: v1.24.0
[init] Using Kubernetes version: v1.24.0
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: time=“2022-05-12T19:56:08+08:00” level=fatal msg=“getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService”
, error: exit status 1
[ERROR FileContent–proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables 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

无法从互联网获取Kubernetes版本:无法获取URL“https://dl.k8s.io/release/stable-1.txt”:获取“https://dl.k8s.io/release/stable-1.txt”:上下文截止日期超过(客户端。等待报头时超时)

四、解决方法
#提前准备coredns:1.8.4的镜像,后面需要使用,需要在每台机器上下载镜像
#不提前拉取的话,初始化的时候会报错!!!
#默认在谷歌上拉取,我们改为国内地址
[root@master ~]# docker pull  coredns/coredns:1.8.4
[root@master ~]# docker tag coredns/coredns:1.8.4 registry.aliyuncs.com/google_containers/coredns:v1.8.4
五、还是报错,不急这次一定能解决
[root@master ~]# kubeadm init 
> --apiserver-advertise-address=192.168.153.144 
> --image-repository registry.aliyuncs.com/google_containers 
> --service-cidr=10.1.0.0/16 
> --pod-network-cidr=10.244.0.0/16

[init] Using Kubernetes version: v1.24.0
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: time=“2022-05-12T20:18:23+08:00” level=fatal msg=“getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService”
, error: exit status 1
[ERROR FileContent–proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables 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

六、最后一次,一定解决
echo 1 >/proc/sys/net/bridge/bridge-nf-call-iptables

终于初始化成功!!!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/880693.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号