Direct start:
5.1, Flannel Introduction
Flannel is an overlay networking (overlay network) tool designed by the CoreOS team for Kubernetes to help each kuberentes host with CoreOS have a complete subnet. Kubernetes assigns a separate IP address to each pod, which makes it easier for Containers in the same pod to connect to each other, and flannel to set a subnet for the host by creating an overlay grid network (overlay mesh networks) in the cluster 。
5.2. Etcd setting
5.2.1, setting up Fannel network segment
# Etcdctl Set/coreos.com/network/config ' {"Network": "10.2.0.0/16"} '
5.2.2, modifying configuration files
Change the etcd_listen_client_urls= in the/etc/etcd/etcd.conf "Http://localhost:2379″ in the Locahost to 0.0.0.0
5.3. Flannel installation configuration (all node nodes need to be installed)
5.3.1, wget https://github.com/coreos/flannel/releases/download/v0.5.5/flannel-0.5.5-linux-amd64.tar.gz
5.3.2, TAR-XZVF flannel-0.5.5-linux-amd64.tar.gz
5.3.3, installation
Directly copy the extracted two files to the executable directory can be
#cp Flannel-0.5.5/flanneld/usr/bin
#cp Flannel-0.5.5/mk-docker-opts.sh/usr/bin
5.3.4, configuration
Vi/etc/sysconfig/flanneld
Add to:
# Flanneld configuration options
# ETCD URL Location
Flannel_etcd= "http://centos-master:2379"
# ETCS Config key
flannel_etcd_key= "/coreos.com/network"
# any additonal options
#FLANNEL_OPTIONS =
5.3.5, editing service files/usr/lib/systemd/system/flanneld.service
Add to:
[Unit]
Description=flanneld Overlay Address ETCD Agent
After=network.target
Before=docker.service
[Service]
Type=notify
Environmentfile=-/etc/sysconfig/flanneld
Environmentfile=-/etc/sysconfig/docker-network
Execstart=/usr/bin/flanneld \
-ETCD-ENDPOINTS=${FLANNEL_ETCD} \
$FLANNEL _options
[Install]
Requiredby=docker.service
Wantedby=multi-user.target
or start directly:
flanneld-iface=eno16777736-etcd-endpoints= http://centos-master:2379 & (Bind a working NIC)
5.4. Suspension of Docker service
#systemctl Stop Docker
5.6. Execute script (Modify Docker)
#systemctl Start Flanneld
#mk-docker-opts.sh-i
#source/run/flannel/subnet.env
#ifconfig Docker0 ${flannel_subnet}
#systemctl Start Docker
5.7. Testing
On Centos-minion IP A view can see the FLANNEL0 network card information
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/88/89/wKioL1f7UkWB4IOGAAAaxdvvzpI498.png "title=" C4d9dc46-6133-4242-a374-487df5c4b18b.png "alt=" Wkiol1f7ukwb4iogaaaaxdvvzpi498.png "/>
This article is from the "Linux" blog, so be sure to keep this source http://syklinux.blog.51cto.com/9631548/1860301
Docker Management Artifact-kubernetes-flannel Network chapter