k8s记录-2
4.3.5 Flannel在所有服务器节点下作如下配置:
mkdir /root/k8s-net
docker run -d --net=host --privileged \
--restart always --name flannel \
-v /root/k8s-net:/run/flannel \
quay.io/coreos/flannel:v0.8.0-amd64
修改Docker的EnvironmentFile
# ubuntu: /lib/systemd/system/docker.service
# centos: /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
EnvironmentFile=-/root/k8s-net/subnet.env
systemctl daemon-reload
systemctl restart docker
ip -4 a|grep inet
输出结果:
inet 127.0.0.1/8 scope host lo
inet 172.18.24.201/24 brd 172.18.24.255 scope global ens160
inet 10.1.4.1/24 scope global docker0
inet 10.1.4.0/21 scope global flannel0
docker0与flannel0的第三位数字一样,则说明配置生效。
页:
[1]