第一次执行 kubeadm init 报错了,具体看看怎么处理。
# kubeadm init [init] Using Kubernetes version: v1.22.3 [preflight] Running pre-flight checks [WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service' 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
docker 的 service 没有置为 enable,设置好就行了。另外关于 ipv4 通过 echo 1 > /proc/sys/net/ipv4/ip_forward 就可以了,这里的意思是是否打开 ip 转发。
[root@VM-23-61-centos ~]# echo "1" > /proc/sys/net/ipv4/ip_forward [root@VM-23-61-centos ~]# service network restart Restarting network (via systemctl): [ OK ]
通过 ps -ef|grep -i docker 可以看到下面的进程。
docker pull k8s.gcr.io/kube-apiserver:v1.22.3
意思就是 kubeadm init 调用 docker 在拉取镜像。
但是你以为在拉,但实际 docker images 都找不到镜像啊,查看 docker.service 的日志发现还有些报错。
没办法,还是基本都超时,想想办法替换一下配置文件的仓库源看看。
从日志看,需要拉取下面几个镜像。
I1030 15:05:58.040211 181596 checks.go:855] pulling: k8s.gcr.io/kube-apiserver:v1.22.3 I1030 15:07:13.314043 181596 checks.go:855] pulling: k8s.gcr.io/kube-controller-manager:v1.22.3 I1030 15:08:28.598273 181596 checks.go:855] pulling: k8s.gcr.io/kube-scheduler:v1.22.3 I1030 15:09:43.864626 181596 checks.go:855] pulling: k8s.gcr.io/kube-proxy:v1.22.3 I1030 15:10:59.142041 181596 checks.go:855] pulling: k8s.gcr.io/pause:3.5 I1030 15:12:14.433512 181596 checks.go:855] pulling: k8s.gcr.io/etcd:2.5.0-0 I1030 15:13:29.702488 181596 checks.go:855] pulling: k8s.gcr.io/coredns/coredns:v1.8.4
所以执行下面的命令,先拉取镜像,再重新打 tag。
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.22.3 docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.22.3 docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.22.3 docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.22.3 docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.5 docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.5.0-0 docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:v1.8.4 docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.22.3 k8s.gcr.io/kube-apiserver:v1.22.3 docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-controller-manager:v1.22.3 k8s.gcr.io/kube-controller-manager:v1.22.3 docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler:v1.22.3 k8s.gcr.io/kube-scheduler:v1.22.3 docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/kube-proxy:v1.22.3 k8s.gcr.io/kube-proxy:v1.22.3 docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.5 k8s.gcr.io/pause:3.5 docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/etcd:3.5.0-0 k8s.gcr.io/etcd:3.5.0-0 docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/coredns:v1.8.4 k8s.gcr.io/coredns/coredns:v1.8.4
然后再执行 kubeadm init 就会得到镜像已经下载好的提示。
I1030 22:53:56.634982 398832 checks.go:838] using image pull policy: IfNotPresent I1030 22:53:56.662771 398832 checks.go:847] image exists: k8s.gcr.io/kube-apiserver:v1.22.3 I1030 22:53:56.689402 398832 checks.go:847] image exists: k8s.gcr.io/kube-controller-manager:v1.22.3 I1030 22:53:56.717194 398832 checks.go:847] image exists: k8s.gcr.io/kube-scheduler:v1.22.3 I1030 22:53:56.743029 398832 checks.go:847] image exists: k8s.gcr.io/kube-proxy:v1.22.3 I1030 22:53:56.770703 398832 checks.go:847] image exists: k8s.gcr.io/pause:3.5 I1030 22:53:56.798320 398832 checks.go:847] image exists: k8s.gcr.io/etcd:3.5.0-0 I1030 22:53:56.824973 398832 checks.go:847] image exists: k8s.gcr.io/coredns/coredns:v1.8.4
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)