您好,登錄后才能下訂單哦!
Etcd安裝
生產環境建議使用集群方式
wget?https://github.com/etcd-io/etcd/releases/download/v3.3.15/etcd-v3.3.15-linux-amd64.tar.gz tar?-zxvf?etcd-v3.3.15-linux-amd64.tar.gz?&&?cd?etcd-v3.3.15-linux-amd64 mv?etcd*?/usr/local/bin/ mkdir?/var/lib/etcd/
cat?/usr/lib/systemd/system/etcd.service? [Unit] Description=Etcd?Server After=netNork.target After=network-online.target Wants=network-online.target [Service] Type=notify ExecStart=/usr/local/bin/etcd?\ --name=etcd?\ --data-dir=/var/lib/etcd/default.etcd?\ --listen-peer-urls=http://192.168.3.155:2380?\ --listen-client-urls=http://192.168.3.155:2379,http://127.0.0.1:2379?\ --advertise-client-urls=http://192.168.3.155:2379?\ --initial-advertise-peer-urls=http://192.168.3.155:2380?\ --initial-cluster=etcd=http://192.168.3.155:2380?\ --initial-cluster-token=etcd-cluster?\ --initial-cluster-state=new Restart=on-failure LimitNOFILE=65536 [Install] WantedBy=multi-user.target
systemctl start etcd
安裝flannel
yum -y install flannel
cat /etc/sysconfig/flanneld
FLANNEL_ETCD_ENDPOINTS="http://192.168.3.155:2379"
FLANNEL_ETCD_PREFIX="/atomic.io/network"
注冊flannel的網絡配置到etcd
3.3.15版本默認api為V3,flannel支持V2版本
ETCDCTL_API=2 etcdctl --endpoint=http://192.168.3.155:2379 set /atomic.io/network/config '{"Network":"172.17.0.0/16", "SubnetMin": "172.17.1.0", "SubnetMax": "172.17.254.0", "Backend": {"Type": "vxlan"}}'
systemctl start flannel
Flannel啟動后,將從etcd獲取網絡配置信息
劃分子網并在etcd中注冊
將網絡配置寫入/run/flannel/subnet.env,并通過腳本生成/run/flannel/docker文件
查看etcd注冊信息
修改docker啟動參數
cat /usr/lib/systemd/system/docker.service
EnvironmentFile=/var/run/flannel/docker
ExecStart=/usr/bin/dockerd $DOCKER_NETWORK_OPTIONS
systemctl daemon-reload && systemctl restart docker
查看IP
參考:
https://coreos.com/flannel/docs/latest/running.html#docker-integration
https://coreos.com/flannel/docs/latest/flannel-config.html
https://github.com/etcd-io/etcd
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。