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

flannel安装

时间:2018-05-24 15:17:12      阅读:401      评论:0      收藏:0      [点我收藏+]

标签:flannel docker

环境
10.130.0.252 etcd flannel
10.130.0.251 flannel

yum install etcd -y
vi /etc/default/etcd
ETCD_DATA_DIR="/var/lib/etcd/default"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379
sed -i ‘s/localhost/0.0.0.0/g‘ /etc/etcd/etcd.conf
systemctl start etcd

tar xf flannel-v0.10.0-linux-amd64.tar.gz
cp flanneld mk-docker-opts.sh /usr/bin/
etcdctl set /coreos.com/network/config ‘{ "Network": "10.1.0.0/16" }‘

cat /usr/lib/systemd/system/flanneld.service
[Unit]
Description=Flanneld overlay address etcd agent
After=network.target
Before=docker.service
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/flanneld
ExecStart=/usr/bin/flanneld -etcd-endpoints=${FLANNEL_ETCD} $FLANNEL_OPTIONS
[Install]
RequiredBy=docker.service
WantedBy=multi-user.target

cat /etc/sysconfig/flanneld
FLANNEL_ETCD="http://10.130.0.252:2379"
FLANNEL_ETCD_KEY="/coreos.com/network"

cat /etc/init.d/start_flannel.sh
#!/bin/bash
systemctl stop docker
systemctl restart flanneld
mk-docker-opts.sh -i
source /run/flannel/subnet.env
ifconfig docker0 ${FLANNEL_SUBNET}
systemctl start docker

vi /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --bip=10.1.78.1/24 --mtu=1472
systemctl daemon-reload
docker run -itd --name bbox1 busybox
docker run -itd --name bbox2 busybox
docker exec bbox1 ip r
docker exec bbox2 ip r
docker exec bbox1 ping
docker exec bbox2 ping

flannel安装

标签:flannel docker

原文地址:http://blog.51cto.com/13606492/2119822

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