本文共 1372 字,大约阅读时间需要 4 分钟。
环境
10.130.0.252 etcd flannel10.130.0.251 flannelyum install etcd -y
vi /etc/default/etcdETCD_DATA_DIR="/var/lib/etcd/default"ETCD_LISTEN_CLIENT_URLS=""ETCD_ADVERTISE_CLIENT_URLS=sed -i 's/localhost/0.0.0.0/g' /etc/etcd/etcd.confsystemctl start etcdtar 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 agentAfter=network.targetBefore=docker.service[Service]Type=notifyEnvironmentFile=/etc/sysconfig/flanneldExecStart=/usr/bin/flanneld -etcd-endpoints=${FLANNEL_ETCD} $FLANNEL_OPTIONS[Install]RequiredBy=docker.serviceWantedBy=multi-user.targetcat /etc/sysconfig/flanneld
FLANNEL_ETCD=""FLANNEL_ETCD_KEY="/coreos.com/network"cat /etc/init.d/start_flannel.sh
#!/bin/bashsystemctl stop dockersystemctl restart flanneldmk-docker-opts.sh -isource /run/flannel/subnet.envifconfig docker0 ${FLANNEL_SUBNET}systemctl start dockervi /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --bip=10.1.78.1/24 --mtu=1472systemctl daemon-reloaddocker run -itd --name bbox1 busyboxdocker run -itd --name bbox2 busyboxdocker exec bbox1 ip rdocker exec bbox2 ip rdocker exec bbox1 pingdocker exec bbox2 ping转载于:https://blog.51cto.com/13606492/2119822