手把手-安装-flannel

操作系统

Centos 7.6 , Ubuntu-19.10

硬件配置(推荐)

 CPU / 内存 : 2核 / 4GB

安装版本

flannel 0.12.0

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

开始安装

首先下载安装包

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

解压安装包

tar -xzvf flannel-v0.12.0-linux-amd64.tar.gz

移动文件flanneld到/usr/bin目录

mv flanneld /usr/bin

移动文件mk-docker-opts.sh到/usr/libexec/flannel

mv mk-docker-opts.sh /usr/libexec/flannel

配置服务

创建service文件

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

[Service]
Type=notify
EnvironmentFile=/etc/flannel/flanneld.conf
EnvironmentFile=/etc/docker/docker-network
ExecStart=/usr/bin/flanneld-start $FLANNEL_OPTIONS
ExecStartPost=/usr/libexec/flannel/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/docker
Restart=on-failure

[Install]
WantedBy=multi-user.target
WantedBy=docker.service

创建flannel启动配置文件

vi /etc/flannel/flanneld.conf
# Flanneld configuration options

# etcd url location.  Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://127.0.0.1:2379"

# etcd config key.  This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/atomic.io/network"

# Any additional options that you want to pass
#FLANNEL_OPTIONS=""

启动服务

systemctl start flanneld

设置开机启动

systemctl enable flanneld
posted @ 2020-03-15 11:12  光速狼  阅读(2163)  评论(1编辑  收藏  举报