Kubernetes部署-flannel 报错(Couldn't fetch network config)--已解决

ETCD和Flannel安装完成后.

将网络配置信息写入了ETCD中,启动flanneld测试时一直报错如下.

E0108 10:44:42.533021    8815 main.go:382] Couldn't fetch network config: 100: Key not found (/coreos.com) [46]
timed out

配置检查如下:

[root@umsk8s-master ~]# ETCDCTL_API=3 /umsapp/etcd/etcdctl    --endpoints https://172.30.251.200:20079,https://172.30.251.201:20179,https://172.30.251.202:20279,https://172.30.251.203:20379,https://172.30.251.204:20479  --cacert /umsapp/certs/etcd-root-ca.pem   --cert /umsapp/certs/umsk8s-master.pem   --key /umsapp/certs/umsk8s-master-key.pem  get  /coreos.com/network/config
/coreos.com/network/config
{"Network":"192.170.0.0/16", "SubnetLen": 24, "SubnetMin": "192.170.0.1", "SubnetMax": "192.170.254.253", "Backend": {"Type": "vxlan"}}
[root@umsk8s-master ~]#
[root@umsk8s-master ~]# /usr/bin/flanneld  --etcd-endpoints=https://172.30.251.200:20079,https://172.30.251.201:20179,https://172.30.251.202:20279,https://172.30.251.203:20379,https://172.30.251.204:20479 -etcd-cafile=/umsapp/certs/etcd-root-ca.pem -etcd-certfile=/umsapp/certs/umsk8s-master.pem -etcd-keyfile=/umsapp/certs/umsk8s-master-key.pem -etcd-prefix=/coreos.com/network
I0108 10:44:40.505507    8815 main.go:514] Determining IP address of default interface
I0108 10:44:40.505757    8815 main.go:527] Using interface with name ens32 and address 172.30.251.200
I0108 10:44:40.505773    8815 main.go:544] Defaulting external address to interface address (172.30.251.200)
2020-01-08 10:44:40.506391 I | warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
I0108 10:44:40.506453    8815 main.go:244] Created subnet manager: Etcd Local Manager with Previous Subnet: None
I0108 10:44:40.506461    8815 main.go:247] Installing signal handlers
E0108 10:44:40.529390    8815 main.go:382] Couldn't fetch network config: 100: Key not found (/coreos.com) [46]
timed out
E0108 10:44:41.531100    8815 main.go:382] Couldn't fetch network config: 100: Key not found (/coreos.com) [46]
timed out
E0108 10:44:42.533021    8815 main.go:382] Couldn't fetch network config: 100: Key not found (/coreos.com) [46]
timed out
E0108 10:44:43.535099    8815 main.go:382] Couldn't fetch network config: 100: Key not found (/coreos.com) [46]
^CI0108 10:44:44.396074    8815 main.go:370] shutdownHandler sent cancel signal...
[root@umsk8s-master ~]#

 

ETCD和flanneld版本分别如下:

[root@umsk8s-master ~]# /umsapp/etcd/etcd --version
etcd Version: 3.3.8
Git SHA: 33245c6b5
Go Version: go1.9.7
Go OS/Arch: linux/amd64
[root@umsk8s-master ~]# /usr/bin/flanneld -version
v0.11.0
[root@umsk8s-master ~]#

网络上的方案均与本案实际情况不一致。

Google之后发现如下github连接.

https://github.com/coreos/flannel/issues/1191

https://github.com/coreos/flannel/issues/554

https://github.com/coreos/flannel/issues/755

https://bugzilla.redhat.com/show_bug.cgi?id=1498096

flannel目前确实不能与etcdV3直接交互.

作如下调整后,flanneld服务正常启动。

1 开启etcd 支持V2api功能,在etcd启动参数中加入 --enable-v2参数,并重启etcd2

2  向etcd写入flanneld网络配置时,使用如下指令指定V2版本.

ETCDCTL_API=2 /umsapp/etcd/etcdctl    --endpoints https://172.30.251.200:20079,https://172.30.251.201:20179,https://172.30.251.202:20279,https://172.30.251.203:20379,https://172.30.251.204:20479  --ca-file /umsapp/certs/etcd-root-ca.pem   --cert-file /umsapp/certs/umsk8s-master.pem   --key-file /umsapp/certs/umsk8s-master-key.pem   mk  /coreos.com/network/config

ETCDCTL_API=2 /umsapp/etcd/etcdctl    --endpoints https://172.30.251.200:20079,https://172.30.251.201:20179,https://172.30.251.202:20279,https://172.30.251.203:20379,https://172.30.251.204:20479  --ca-file /umsapp/certs/etcd-root-ca.pem   --cert-file /umsapp/certs/umsk8s-master.pem   --key-file /umsapp/certs/umsk8s-master-key.pem   set  /coreos.com/network/config '{"Network":"172.18.0.0/16", "Backend": {"Type": "vxlan"}}'

3 重启flanneld网络即可.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>