k8s 安装pod网络插件(flannel)报错
Posted 水木,年華
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了k8s 安装pod网络插件(flannel)报错相关的知识,希望对你有一定的参考价值。
问题描述:我在用kubeadm方式部署k8s,安装pod网络插件的时候出现以下报错
[root@master k8s]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml
The connection to the server raw.githubusercontent.com was refused - did you specify the right host or port?
问题分析:基本上是因为连不上外网导致,所以我们添加映射
[root@master k8s]# echo "199.232.68.133 raw.githubusercontent.com" >> /etc/hosts
下载还是报错
[root@master k8s]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml
The connection to the server raw.githubusercontent.com was refused - did you specify the right host or port?
改用wget下载方式成功
[root@master k8s]# wget https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml
--2021-09-29 20:09:59-- https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml
正在解析主机 raw.githubusercontent.com (raw.githubusercontent.com)... 199.232.68.133
正在连接 raw.githubusercontent.com (raw.githubusercontent.com)|199.232.68.133|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:10599 (10K) [text/plain]
正在保存至: “kube-flannel.yml”
100%[=================================================================================================================================>] 10,599 --.-K/s 用时 0.01s
2021-09-29 20:10:00 (917 KB/s) - 已保存 “kube-flannel.yml” [10599/10599])
[root@master k8s]# ls
kube-flannel.yml
[root@master k8s]# kubectl apply -f kube-flannel.yml
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.extensions/kube-flannel-ds-amd64 created
daemonset.extensions/kube-flannel-ds-arm64 created
daemonset.extensions/kube-flannel-ds-arm created
daemonset.extensions/kube-flannel-ds-ppc64le created
daemonset.extensions/kube-flannel-ds-s390x created
以上是关于k8s 安装pod网络插件(flannel)报错的主要内容,如果未能解决你的问题,请参考以下文章
k8s安装flannel报错“node "master" pod cidr not assigned”