flannel集群安装方法
这篇文章主要讲解了"flannel集群安装方法",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"flannel集群安装方法"吧!
1、下载部署flannel
创建目录(三台操作)
mkdir -p /app/kubernetes/{cfg,bin,ssl}
tar zxvf flannel-v0.10.0-linux-amd64.tar.gz
cp flanneld mk-docker-opts.sh /app/kubernetes/bin/
scp /app/kubernetes/bin/* k8s-node01:/app/kubernetes/bin/
scp /app/kubernetes/bin/* k8s-node02:/app/kubernetes/bin/
k8s-master-01上执行执行
cd /app/etcd/ssl
/app/etcd/bin/etcdctl --ca-file=ca.pem --cert-file=server.pem --key-file=server-key.pem --endpoints="https://192.168.159.121:2379,https://192.168.159.122:2379,https://192.168.159.123:2379" set /coreos.com/network/config '{"Network": "172.18.0.0/16","Backend":{"Type":"vxlan"}}'
2、三台部署flannel服务
配置flannel
vi /app/kubernetes/cfg/flanneld
FLANNEL_OPTIONS="--etcd-endpoints=https://192.168.159.121:2379,https://192.168.159.122:2379,https://192.168.159.123:2379 -etcd-cafile=/app/etcd/ssl/ca.pem -etcd-certfile=/app/etcd/ssl/server.pem -etcd-keyfile=/app/etcd/ssl/server-key.pem"
配置flannel自动启动脚本
vi /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=/app/kubernetes/cfg/flanneld
ExecStart=/app/kubernetes/bin/flanneld --ip-masq $FLANNEL_OPTIONS
ExecStartPost=/app/kubernetes/bin/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/subnet.env
Restart=on-failure
[Install]
WantedBy=multi-user.target
配置docker采用flannel网络
vi /usr/lib/systemd/system/docker.service
EnvironmentFile=/run/flannel/subnet.env
ExecStart=/usr/bin/dockerd \$DOCKER_NETWORK_OPTIONS
启动服务
systemctl daemon-reload
systemctl restart flanneld
systemctl enable flanneld
systemctl status flanneld
systemctl restart docker
systemctl status docker
感谢各位的阅读,以上就是"flannel集群安装方法"的内容了,经过本文的学习后,相信大家对flannel集群安装方法这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!