Flannel安装
部署環境說明
| 主機名 | IP | 操作系統 |
| node201 ? ? ? | 10.0.0.201 ? ? ? ? ? | centos 7.3 64位 ? ? ? |
| node202 | 10.0.0.202 | centos 7.3 64位 |
| node203 | 10.0.0.203 | centos 7.3 64位 |
前提條件:已安裝etcd
配置etcd
etcdctl mkdir /kube-centos/network etcdctl mk /kube-centos/network/config "{ \"Network\": \"172.30.0.0/16\", \"SubnetLen\": 24, \"Backend\": { \"Type\": \"vxlan\" } }"以下操作需要在3個節點都執行。
安裝flannel
yum install flannel
編輯配置文件
vim /etc/sysconfig/flanneld
# Flanneld configuration options# etcd url location. Point this to the server where etcd runs FLANNEL_ETCD_ENDPOINTS="http://10.0.0.201:2379,http://10.0.0.202:2379,http://10.0.0.203:2379"# etcd config key. This is the configuration key that flannel queries # For address range assignment FLANNEL_ETCD_PREFIX="/kube-centos/network"# Any additional options that you want to pass #FLANNEL_OPTIONS=""
運行flannel
systemctl enable flanneld
systemctl start flanneld
flanneld服務會通過執行腳本mk-docker-opts.sh在目錄/run/flannel下面生成兩個文件。
node201節點/run/flannel/docker
node201節點/run/flannel/subnet.env
/usr/lib/systemd/system/docker.service.d/flannel.conf指向/run/flannel/docker
最終結果
在節點node202做同樣的操作,最終結果如下
在節點node203做同樣的操作,最終結果如下
查看etcd
--結束--
總結
- 上一篇: Serverless,后端小程序的未来
- 下一篇: 从分布式到云端服务:Google Spa