worker node只需要拷贝master上的/run/flannel/subnet.env,和/etc/cni/net.d 到worker节点,即可。
Flannel默认起2个pod,会被调度到master和work node1:
kube-system coredns-59d64cd4d4-kkk2k 1/1 Running 10 31d 10.244.0.20 master <none> <none>
kube-system coredns-59d64cd4d4-xr5rs 1/1 Running 10 31d 10.244.1.59 node1
查看flannel的pod,它其实挂载了这2个文件:
Volumes:
run:
Type: HostPath (bare host directory volume)
Path: /run/flannel
HostPathType:
cni:
Type: HostPath (bare host directory volume)
Path: /etc/cni/net.d
HostPathType:
此时只需要node1上这写配置文件即可,这样node1的上flannle pod会用到这个配置文件。