码迷,mamicode.com
首页 > 其他好文 > 详细

k8s部署flannel网络

时间:2018-03-09 12:14:24      阅读:625      评论:0      收藏:0      [点我收藏+]

标签:docker flannel k8s

1 yum安装flannel包: yum install flannel -y

2 编辑配置文件
vim /etc/sysconfig/flanneld

FLANNEL_ETCD_ENDPOINTS="http://192.168.233.130:2379"

FLANNEL_ETCD_PREFIX="/coreos.com/network"

#FLANNEL_OPTIONS=""

3 flannel网络依赖etcd存储,启动flanneld服务前需在etcd存储里添加配置:
etcdctl set /coreos.com/network/config ‘{ "Network": "10.1.0.0/16" }‘

4 启动flanneld服务前必须先关闭docker服务:
systemctl stop docker
systemctl start flanneld

5 flanneld服务会通过执行脚本mk-docker-opts.sh在目录/run/flannel下面生成两个文件。

/run/flannel/docker
/run/flannel/subnet.env
/usr/lib/systemd/system/docker.service.d/flannel.conf指向/run/flannel/docker

6 systemctl start docker:
技术分享图片

7 查看etcd:
[root@master ~]# etcdctl get /coreos.com/network/subnets/10.1.95.0-24
{"PublicIP":"192.168.233.128"}
[root@master ~]# etcdctl get /coreos.com/network/subnets/10.1.39.0-24
{"PublicIP":"192.168.233.129"}
[root@master ~]# etcdctl get /coreos.com/network/config
{ "Network": "10.1.0.0/16" }
[root@master ~]#

k8s部署flannel网络

标签:docker flannel k8s

原文地址:http://blog.51cto.com/as007012/2084519

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!