1. 程式人生 > >flanneld v0.10.0 版本部署

flanneld v0.10.0 版本部署

address 說明 ssl nproc get asq backend 當前 wall

flanneld v0.10.0 版本部署

部署

可先參考 http://blog.51cto.com/hequan/2327820 部署etcd
cd /data/ssl/etcd/

/opt/etcd/bin/etcdctl --ca-file=ca.pem --cert-file=server.pem --key-file=server-key.pem --endpoints="https://192.168.100.100:2379,https://192.168.100.101:2379,https://192.168.100.102:2379" set /coreos.com/network/config  ‘{ "Network": "172.17.0.0/16", "Backend": {"Type": "vxlan"}}‘
  • node01
  • node02
cd /data/src/

wget https://github.com/coreos/flannel/releases/download/v0.10.0/flannel-v0.10.0-linux-amd64.tar.gz

mkdir /opt/kubernetes/bin -p
tar xf flannel-v0.10.0-linux-amd64.tar.gz
mv flanneld mk-docker-opts.sh  /opt/kubernetes/bin/

mkdir  /opt/kubernetes/cfg 

vim /opt/kubernetes/cfg/flanneld
FLANNEL_OPTIONS="--etcd-endpoints=https://192.168.100.100:2379,https://192.168.100.101:2379,https://192.168.100.102:2379 -etcd-cafile=/opt/etcd/ssl/ca.pem -etcd-certfile=/opt/etcd/ssl/server.pem -etcd-keyfile=/opt/etcd/ssl/server-key.pem"

vim /usr/lib/systemd/system/flanneld.service
[Unit]
Description=Flanneld overlay address etcd agent
After=network-online.target network.target
Before=docker.service

[Service]
Type=notify
EnvironmentFile=/opt/kubernetes/cfg/flanneld
ExecStart=/opt/kubernetes/bin/flanneld --ip-masq $FLANNEL_OPTIONSExecStartPost=/opt/kubernetes/bin/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/subnet.env
Restart=on-failure

[Install]
WantedBy=multi-user.target

vim  /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=notify
EnvironmentFile=/run/flannel/subnet.env
ExecStart=/usr/bin/dockerd $DOCKER_NETWORK_OPTIONSExecReload=/bin/kill -s HUP $MAINPIDLimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0Delegate=yesKillMode=process
Restart=on-failure
StartLimitBurst=3StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl start flanneld
systemctl enable flanneld
systemctl restart docker

檢查

ps -ef |grep docker
ip addr

確保docker0與flannel.1在同一網段。
測試不同節點互通,在當前節點訪問另一個Node節點docker0 IP
如果能通說明Flannel部署成功。如果不通檢查下日誌:journalctl -u flannel

flanneld v0.10.0 版本部署