Flannel网络部署

一、Flannel网络部署

为Flannel生成证书

[[email protected] ssl]# vim flanneld-csr.json
{
  "CN": "flanneld",
  "hosts": [],
  "key": {
    "algo": "rsa",
    "size": 2048
  },
  "names": [
    {
      "C": "CN",
      "ST": "BeiJing",
      "L": "BeiJing",
      "O": "k8s",
      "OU": "System"
    }
  ]
}

生成证书

[[email protected] ssl]# cfssl gencert -ca=/opt/kubernetes/ssl/ca.pem     -ca-key=/opt/kubernetes/ssl/ca-key.pem     -config=/opt/kubernetes/ssl/ca-config.json     -profile=kubernetes flanneld-csr.json | cfssljson -bare flanneld
2018/05/31 16:19:46 [INFO] generate received request
2018/05/31 16:19:46 [INFO] received CSR
2018/05/31 16:19:46 [INFO] generating key: rsa-2048
2018/05/31 16:19:46 [INFO] encoded CSR
2018/05/31 16:19:46 [INFO] signed certificate with serial number 655739903410343916627289078414999108781865584022
2018/05/31 16:19:46 [WARNING] This certificate lacks a "hosts" field. This makes it unsuitable for
websites. For more information see the Baseline Requirements for the Issuance and Management
of Publicly-Trusted Certificates, v.1.1.6, from the CA/Browser Forum (https://cabforum.org);
specifically, section 10.2.3 ("Information Requirements").

[[email protected]-node1 ssl]# ll flanneld*
-rw-r--r-- 1 root root  997 May 31 16:19 flanneld.csr
-rw-r--r-- 1 root root  221 May 31 16:18 flanneld-csr.json
-rw------- 1 root root 1679 May 31 16:19 flanneld-key.pem
-rw-r--r-- 1 root root 1391 May 31 16:19 flanneld.pem

分发证书

[[email protected] ssl]# scp flanneld*.pem 192.168.56.12:/opt/kubernetes/ssl/
[[email protected]-node1 ssl]# scp flanneld*.pem 192.168.56.13:/opt/kubernetes/ssl/

下载Flannel软件包

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

[[email protected]-node1 ssl]# cd /usr/local/src/
[[email protected]-node1 src]# pwd
/usr/local/src
[[email protected]-node1 src]# tar zxf flannel-v0.10.0-linux-amd64.tar.gz
[[email protected]-node1 src]# cp flanneld mk-docker-opts.sh /opt/kubernetes/bin/
#复制到linux-node2、linux-node3节点上
[[email protected]-node1 src]# scp flanneld mk-docker-opts.sh 192.168.56.12:/opt/kubernetes/bin/
[[email protected]-node1 src]# scp flanneld mk-docker-opts.sh 192.168.56.13:/opt/kubernetes/bin/

复制对应脚本到/opt/kubernetes/bin目录下。
[[email protected]-node1 src]# cd /usr/local/src/kubernetes/cluster/centos/node/bin/
[[email protected]-node1 bin]# ll
total 8
-rwxr-xr-x 1 root root 2590 Apr 12 23:24 mk-docker-opts.sh
-rwxr-xr-x 1 root root  850 Apr 12 23:24 remove-docker0.sh
[[email protected]-node1 bin]# cp remove-docker0.sh /opt/kubernetes/bin/
[[email protected]-node1 bin]# scp remove-docker0.sh 192.168.56.12:/opt/kubernetes/bin/
[[email protected]-node1 bin]# scp remove-docker0.sh 192.168.56.13:/opt/kubernetes/bin/
   

配置Flannel

[[email protected] bin]# vim /opt/kubernetes/cfg/flannel
FLANNEL_ETCD="-etcd-endpoints=https://192.168.56.11:2379,https://192.168.56.12:2379,https://192.168.56.13:2379"
FLANNEL_ETCD_KEY="-etcd-prefix=/kubernetes/network"
FLANNEL_ETCD_CAFILE="--etcd-cafile=/opt/kubernetes/ssl/ca.pem"
FLANNEL_ETCD_CERTFILE="--etcd-certfile=/opt/kubernetes/ssl/flanneld.pem"
FLANNEL_ETCD_KEYFILE="--etcd-keyfile=/opt/kubernetes/ssl/flanneld-key.pem"

复制配置到其它节点上
[[email protected]-node1 bin]# scp /opt/kubernetes/cfg/flannel 192.168.56.12:/opt/kubernetes/cfg/
[[email protected]-node1 bin]# scp /opt/kubernetes/cfg/flannel 192.168.56.13:/opt/kubernetes/cfg/

设置Flannel系统服务

[[email protected] bin]# vim /usr/lib/systemd/system/flannel.service
[[email protected]-node1 bin]# cat /usr/lib/systemd/system/flannel.service
[Unit]
Description=Flanneld overlay address etcd agent
After=network.target
Before=docker.service

[Service]
EnvironmentFile=-/opt/kubernetes/cfg/flannel
ExecStartPre=/opt/kubernetes/bin/remove-docker0.sh
ExecStart=/opt/kubernetes/bin/flanneld ${FLANNEL_ETCD} ${FLANNEL_ETCD_KEY} ${FLANNEL_ETCD_CAFILE} ${FLANNEL_ETCD_CERTFILE} ${FLANNEL_ETCD_KEYFILE}
ExecStartPost=/opt/kubernetes/bin/mk-docker-opts.sh -d /run/flannel/docker

Type=notify

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

复制系统服务脚本到其它节点上
[[email protected]-node1 bin]# scp /usr/lib/systemd/system/flannel.service 192.168.56.12:/usr/lib/systemd/system/
[[email protected]-node1 bin]# scp /usr/lib/systemd/system/flannel.service 192.168.56.13:/usr/lib/systemd/system/

二、Flannel CNI集成

下载CNI插件

#下载CNI插件
https://github.com/containernetworking/plugins/releases
wget https://github.com/containernetworking/plugins/releases/download/v0.7.1/cni-plugins-amd64-v0.7.1.tgz
[[email protected] bin]# mkdir /opt/kubernetes/bin/cni[[email protected] ssl]# mkdir /opt/kubernetes/bin/cni[[email protected] ssl]# mkdir /opt/kubernetes/bin/cni[[email protected]-node1 bin]# cd /usr/local/src/
[[email protected]-node1 src]# tar zxf cni-plugins-amd64-v0.7.1.tgz -C /opt/kubernetes/bin/cni
[[email protected]-node1 src]# scp -r /opt/kubernetes/bin/cni/* 192.168.56.12:/opt/kubernetes/bin/cni/
[email protected] src]# scp -r /opt/kubernetes/bin/cni/* 192.168.56.13:/opt/kubernetes/bin/cni/

创建Etcd的key

[email protected] src]# /opt/kubernetes/bin/etcdctl --ca-file /opt/kubernetes/ssl/ca.pem --cert-file /opt/kubernetes/ssl/flanneld.pem --key-file /opt/kubernetes/ssl/flanneld-key.pem        --no-sync -C https://192.168.56.11:2379,https://192.168.56.12:2379,https://192.168.56.13:2379 \
 mk /kubernetes/network/config ‘{ "Network": "10.2.0.0/16", "Backend": { "Type": "vxlan", "VNI": 1 }}‘ >/dev/null 2>&1

启动flannel

######################linux-node1启动#############################
[[email protected]-node1 src]# systemctl daemon-reload
[[email protected]-node1 src]# systemctl enable flannel
Created symlink from /etc/systemd/system/multi-user.target.wants/flannel.service to /usr/lib/systemd/system/flannel.service.
Created symlink from /etc/systemd/system/docker.service.requires/flannel.service to /usr/lib/systemd/system/flannel.service.
[[email protected]-node1 src]# chmod +x /opt/kubernetes/bin/*
[[email protected] src]# systemctl start flannel

######################linux-node2启动#############################
[[email protected] src]# systemctl daemon-reload
[[email protected] src]# systemctl enable flannel
Created symlink from /etc/systemd/system/multi-user.target.wants/flannel.service to /usr/lib/systemd/system/flannel.service.
Created symlink from /etc/systemd/system/docker.service.requires/flannel.service to /usr/lib/systemd/system/flannel.service.
[[email protected] src]# chmod +x /opt/kubernetes/bin/*
[[email protected] src]# systemctl start flannel

######################linux-node3启动#############################
[[email protected] ssl]# systemctl daemon-reload
[[email protected] ssl]# systemctl enable flannel
Created symlink from /etc/systemd/system/multi-user.target.wants/flannel.service to /usr/lib/systemd/system/flannel.service.
Created symlink from /etc/systemd/system/docker.service.requires/flannel.service to /usr/lib/systemd/system/flannel.service.
[[email protected] ssl]# chmod +x /opt/kubernetes/bin/*
[[email protected] ssl]# systemctl start flannel

查看服务状态

[[email protected] src]# systemctl status flannel[[email protected] src]# systemctl status flannel[[email protected] ssl]# systemctl status flannel

[[email protected]node1 src]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.11  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::20c:29ff:fea0:10ca  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:a0:10:ca  txqueuelen 1000  (Ethernet)
        RX packets 386026  bytes 62831393 (59.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 768980  bytes 1204891659 (1.1 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

flannel.1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.2.9.0  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::2404:bbff:fee0:41a6  prefixlen 64  scopeid 0x20<link>
        ether 26:04:bb:e0:41:a6  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 8 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 232562  bytes 59255512 (56.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 232562  bytes 59255512 (56.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

linux-node1上查看网卡ifconfig

[[email protected]node2 src]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.12  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::20c:29ff:fef9:ca25  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:f9:ca:25  txqueuelen 1000  (Ethernet)
        RX packets 669708  bytes 372005370 (354.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 470811  bytes 63787801 (60.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

flannel.1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.2.13.0  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::4031:7ff:fe2d:9c2f  prefixlen 64  scopeid 0x20<link>
        ether 42:31:07:2d:9c:2f  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 8 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 960  bytes 72576 (70.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 960  bytes 72576 (70.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

linux-node2上查看网卡ifconfig

[[email protected]node3 ssl]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.13  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::20c:29ff:feca:800d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:ca:80:0d  txqueuelen 1000  (Ethernet)
        RX packets 548452  bytes 359854149 (343.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 353542  bytes 51778767 (49.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

flannel.1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.2.17.0  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::c86c:3ff:fe2e:d4ca  prefixlen 64  scopeid 0x20<link>
        ether ca:6c:03:2e:d4:ca  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 8 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 804  bytes 48598 (47.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 804  bytes 48598 (47.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

linux-node3上查看网卡ifconfig

[[email protected] ssl]# cat /run/flannel/docker
DOCKER_OPT_BIP="--bip=10.2.17.1/24"
DOCKER_OPT_IPMASQ="--ip-masq=true"
DOCKER_OPT_MTU="--mtu=1450"
DOCKER_OPTS=" --bip=10.2.17.1/24 --ip-masq=true --mtu=1450"

三、配置Docker使用Flannel

[email protected] ~]# vim /usr/lib/systemd/system/docker.service
[Unit] #在Unit下面修改After和增加Requires
After=network-online.target firewalld.service flannel.service
Wants=network-online.target
Requires=flannel.service

[Service] #增加EnvironmentFile=-/run/flannel/docker
Type=notify
EnvironmentFile=-/run/flannel/docker
ExecStart=/usr/bin/dockerd $DOCKER_OPTS

将配置复制到另外两个节点

[[email protected] src]# scp /usr/lib/systemd/system/docker.service 192.168.56.12:/usr/lib/systemd/system/
[[email protected]-node1 src]# scp /usr/lib/systemd/system/docker.service 192.168.56.13:/usr/lib/systemd/system/

重启Docker

#####################linux-node1重启Docker服务########################
[[email protected]-node1 src]# systemctl daemon-reload
[[email protected]-node1 src]# systemctl restart docker

#####################linux-node3重启Docker服务########################
[[email protected]-node2 src]# systemctl daemon-reload
[[email protected]-node2 src]# systemctl restart docker

#####################linux-node3重启Docker服务########################
[[email protected]-node3 ssl]# systemctl daemon-reload
[[email protected]-node3 ssl]# systemctl restart docker

[[email protected]node1 src]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 10.2.9.1  netmask 255.255.255.0  broadcast 10.2.9.255
        ether 02:42:18:d5:e0:d1  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.11  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::20c:29ff:fea0:10ca  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:a0:10:ca  txqueuelen 1000  (Ethernet)
        RX packets 426666  bytes 68740555 (65.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 809174  bytes 1211522272 (1.1 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

flannel.1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.2.9.0  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::2404:bbff:fee0:41a6  prefixlen 64  scopeid 0x20<link>
        ether 26:04:bb:e0:41:a6  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 8 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 254544  bytes 65389446 (62.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 254544  bytes 65389446 (62.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

linux-node1上查看网卡ifconfig

[[email protected]node2 src]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 10.2.13.1  netmask 255.255.255.0  broadcast 10.2.13.255
        ether 02:42:6a:cf:66:9f  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.12  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::20c:29ff:fef9:ca25  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:f9:ca:25  txqueuelen 1000  (Ethernet)
        RX packets 724138  bytes 379110250 (361.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 524129  bytes 71071850 (67.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

flannel.1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.2.13.0  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::4031:7ff:fe2d:9c2f  prefixlen 64  scopeid 0x20<link>
        ether 42:31:07:2d:9c:2f  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 8 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 1264  bytes 88416 (86.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1264  bytes 88416 (86.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

linux-node2上查看网卡ifconfig

[[email protected]node3 ssl]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 10.2.17.1  netmask 255.255.255.0  broadcast 10.2.17.255
        ether 02:42:e3:78:53:2d  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.13  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::20c:29ff:feca:800d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:ca:80:0d  txqueuelen 1000  (Ethernet)
        RX packets 584443  bytes 365047002 (348.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 390601  bytes 57109546 (54.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

flannel.1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet 10.2.17.0  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::c86c:3ff:fe2e:d4ca  prefixlen 64  scopeid 0x20<link>
        ether ca:6c:03:2e:d4:ca  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 8 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 880  bytes 52582 (51.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 880  bytes 52582 (51.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

linux-node3上查看网卡ifconfig

原文地址:https://www.cnblogs.com/hwlong/p/9119044.html

时间: 2024-11-08 23:42:06

Flannel网络部署的相关文章

Kubernetes Flannel网络部署

之前的博客已经介绍了部署一个简单的Kubernetes集群,但是这个集群环境没有一个合理的网络配置.在实际生产中要实现集群中各个组件的通信,就需要使用第三方提供的网络插件. Flannel 二进制安装 1.下载fannel组件 wget https://github.com/coreos/flannel/releases/download/v0.10.0/flannel-v0.10.0-linux-amd64.tar.gz 2.安装Flannel 网络组件 tar xf flannel-v0.1

docker flannel网络部署和路由走向分析

1.flannel介绍 flannel是coreos开发的容器网络解决方案.flannel为每个host分配一个subnet,容器从此subnet中分配ip.这些ip可以在host间路由,容器间无需nat和port mapping就可以跨主机通讯. 每个subnet都是从一个更大的ip池中划分的,flannel会在每个主机上运行一个叫flanneld得agent,其职责是从ip池中分配subnet.为了在各个主机间共享信息,flannel用etcd存放网络配置,已分配的subnet,host的i

部署Flannel网络

部署Flannel网络 部署flannel网络需要执行以下步骤: 1)写入分配的子网段到etcd,供flanneld使用 2)下载二进制包 3)配置Flannel 4)systemd管理Flannel 5)配置Docker启动指定子网段 6)启动 第一步:下载flannel二进制包 wget https://github.com/coreos/flannel/releases/download/v0.9.1/flannel-v0.9.1-linux-amd64.tar.gz 第二步:解压flan

Flannel网络组件部署

在部署K8S之前,需要在集群服务器上部署CNI容器网络组件,从而实现集群的网络互联互通.目前可选的组件比较多,例如flannel.calico.weave等,各容器网络组件对比可参考文档:http://dockone.io/article/2599 本文介绍flannel网络组件的部署,配置环境在完成前文etcd集群和tls认证配置后.一.生成flannel证书文件 # mkdir flanneld # cd flanneld # cat flanneld-csr.json { "CN"

kubernetes之Flannel网络插件部署

Kubernetes系统上Pod网络的实现依赖于第三方插件,而Flannel是由CoreOS主推的目前比较主流的容器网络解决方案,CNI插件有两种功能:网络配置和网络策略,由于flannel比较简单,并不支持网络策略,flannel项目自身只是一个框架,真正提供网络功能的是它的后端实现,目前,Flannel支持三种不同后端实现,分别是: UDP VXLAN host-gw UDP是Flannel项目最早支持的一种方式,是性能最差的方式,目前已被废弃. 用的最多的是VXLAN和host-gw模式的

kubernetes容器集群部署Flannel网络

Overlay Network:覆盖网络,在基础网络上叠加的一种虚拟网络技术模式,该网络中的主机通过虚拟链路连接起来. VXLAN:将源数据包封装到UDP中,并使用基础网络的IP/MAC作为外层报文头进行封装,然后在以太网上传输,到达目的地后由隧道端点解封并将数据发送给目的地址. Fannel:Overlay网络的一种,也是将源数据包封装在另一种网络包里面进行路由转发和通信,目前已经支持UDP.VXLAN.AWS VPC和GCE路由等数据转发方式. 多主机容器网络通信其他主流方案:隧道方案(We

k8s部署flannel网络

1 yum安装flannel包: yum install flannel -y 2 编辑配置文件 vim /etc/sysconfig/flanneld FLANNEL_ETCD_ENDPOINTS="http://192.168.233.130:2379" FLANNEL_ETCD_PREFIX="/coreos.com/network" #FLANNEL_OPTIONS="" 3 flannel网络依赖etcd存储,启动flanneld服务前

二进制搭建kubernetes多master集群【二、配置flannel网络】

上一篇我们已经搭建etcd高可用集群,参考:二进制搭建kubernetes多master集群[一.使用TLS证书搭建etcd集群] 此文将搭建flannel网络,目的使跨主机的docker能够互相通信,也是保障kubernetes集群的网络基础和保障,下面正式开始配置. 一.部署 Flannel 在所有集群节点都安装Flannel,下面的操作以etcd集群的三个节点为例都执行一遍 1.下载安装Flannel wget https://github.com/coreos/flannel/relea

k8s的flannel网络插件配置

flannel的网络插件配置 Kubernetes网络通信需要解决以下问题:            (1)容器间通信:同一个Pod内的多个容器间的通信,lo            (2)Pod通信:Pod IP  <-直达->  Pod IP            (3)Pod与Service通信:Pod IP  <-->  Cluster IP            (4)Service与集群外部客户端的通信:(ingress.nodeport.loadbalancer)   k