编程语言
首页 > 编程语言> > 215, node 节点的 docker-ce 的安装和 flanneld 搭建 (day215)

215, node 节点的 docker-ce 的安装和 flanneld 搭建 (day215)

作者:互联网

1, 安装node 节点flanneld 网络。
1)    安装好dockers。
2)    # step 1: 安装必要的一些系统工具
3)    sudo yum install -y yum-utils device-mapper-persistent-data lvm2
4)    # Step 2: 添加软件源信息
5)    sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
6)    # Step 3: 更新并安装 Docker-CE
7)    sudo yum makecache fast
8)    sudo yum -y install docker-ce

2)写入分配的子网段到etcd,供flanneld使用。(这句在master端 操作一次就可以了)
#/opt/kubernetes/bin/etcdctl \
--ca-file=/opt/kubernetes/ssl/ca.pem --cert-file=/opt/kubernetes/ssl/server.pem --key-file=/opt/kubernetes/ssl/server-key.pem \
--endpoints="https://192.168.1.101:2379,https://192.168.1.102:2379,https://192.168.1.103:2379" \
set /coreos.com/network/config '{ "Network": "172.17.0.0/16", "Backend": {"Type": "vxlan"}}'

// etcd 的集群地址为:https://192.168.0.211:2379,https://192.168.0.212:2379,https://192.168.0.213:2379
3)
tar xf flanner.tar.gz
cd flanner
mv flanneld mk-docker-opts.sh  /opt/kubernetes/cfg/ 

4)先拷贝证书到ssl目录,创建flanneld文件。
[root@localhost cfg]# 
[root@localhost cfg]# vim  flanneld 
FLANNEL_OPTIONS="--etcd-endpoints=https://192.168.132.157:2379,https://192.168.132.158:2379,https://192.168.132.159:2379 -etcd-cafile=/opt/kubernetes/ssl/ca.pem -etcd-certfile=/opt/kubernetes/ssl/server.pem -etcd-keyfile=/opt/kubernetes/ssl/server-key.pem"
[root@localhost cfg]# pwd
/opt/kubernetes/cfg
[root@localhost cfg]#

5)
[root@localhost cfg]# 
[root@localhost cfg]# cat /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_OPTIONS
ExecStartPost=/opt/kubernetes/bin/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/subnet.env
Restart=on-failure

[Install]
WantedBy=multi-user.target

[root@localhost cfg]#

systemctl start flanneld

6, 修改docker.service 使用flanner,添加箭头的行。

 

 

systemctl restart docker

标签:node,opt,215,flanneld,kubernetes,cfg,192.168,2379
来源: https://www.cnblogs.com/liuqiqi123/p/9867033.html