Node nodes need to install flannel Network plug-in to ensure that all pods in a LAN communication, directly using Yum installation, version is 0.7.1.
1, install flannel plug-in:
Note that all 2 node nodes need to be installed, and both service files and configuration files need to be modified.
Yum Install Flannel-y
2, modify the service file/usr/lib/systemd/system/flanneld.service its content is:
[Unit]description=Flanneld Overlay Address Etcd agentafter=Network.targetafter=network-online.targetwants=network-Online.targetafter=Etcd.servicebefore=Docker.service[service]type=Notifyenvironmentfile=/etc/sysconfig/Flanneldenvironmentfile=-/etc/sysconfig/docker-Networkexecstart=/usr/bin/flanneld-Start-etcd-endpoints=${flannel_etcd_endpoints}-etcd-prefix=${flannel_etcd_prefix} $FLANNEL _optionsexecstartpost=/usr/libexec/flannel/mk-docker-opts.SH-K docker_network_options-d/run/flannel/Dockerrestart=on-Failure[install]wantedby=multi-User.targetrequiredby=docker.service
Tip: All variable parameters in the service file are read in the corresponding configuration file, all to ensure that the corresponding.
Modify its configuration file/etc/sysconfig/flanneld content as follows:
# Flanneld configuration options # ETCD URL location. Point the server where Etcd runsflannel_etcd_endpoints="https://10.10.90.105:2379,https://10.10.90.106:2379,https://10.10.90.107:2379"# ETCD config key. This is the configuration key, which flannel queries# for address range Assignment#flannel_etcd_prefix="/atomic.io/network"Flannel_etcd_prefix="/kube-centos/network"# Any additional options and want to pass#flannel_options=""flannel_options="-etcd-cafile=/etc/kubernetes/ssl/ca.pem-etcd-certfile=/etc/kubernetes/ssl/kubernetes.pem-etcd-keyfile=/etc /kubernetes/ssl/kubernetes-key.pem"
The above 2 steps are required by all 2 node nodes.
3. Common network configuration information in ETCD
Etcdctl--endpoints=https://10.10.90.105:2379,https://10.10.90.106: 2379,https://10.10.90.107: 2379 \--ca-file=/etc/kubernetes/ssl/Ca.pem--cert-file=/etc/kubernetes/ssl/Kubernetes.pem--key-file=/etc/kubernetes/ssl/kubernetes-Key.pemmkdir/kube-centos/The network#上下是2条命令, created on any node, because ETCD is clustered. Etcdctl--endpoints=https://10.10.90.105:2379,https://10.10.90.106: 2379,https://10.10.90.107: 2379 \--ca-file=/etc/kubernetes/ssl/Ca.pem--cert-file=/etc/kubernetes/ssl/Kubernetes.pem--key-file=/etc/kubernetes/ssl/kubernetes-Key.pem Mk/kube-centos/network/config'{"Network": "172.30.0.0/16", "Subnetlen": "Backend": {"Type": "HOST-GW"}}'
4. Start Flannel Service
Systemctl daemon-reloadsystemctl enable flanneldsystemctl start Flanneldsystemctl status Flanneld
5, check the relevant configuration information:
[Email protected]_node1 ~]# etcdctl--endpoints=${etcd_endpoints}>--ca-file=/etc/kubernetes/ssl/Ca.pem>--cert-file=/etc/kubernetes/ssl/Kubernetes.pem>--key-file=/etc/kubernetes/ssl/kubernetes-Key.pem>ls/kube-centos/network/Subnets
#输出/kube-centos/network/subnets/172.30.87.0- -/kube-centos/network/subnets/172.30.92.0- -#说明, there are several subnets in a few node, there are several records, I am 2 node, respectively installed flannel plugin
[Email protected]_node1 ~]# etcdctl--endpoints=${etcd_endpoints} \
>--CA-FILE=/ETC/KUBERNETES/SSL/CA.PEM \
>--CERT-FILE=/ETC/KUBERNETES/SSL/KUBERNETES.PEM \
>--KEY-FILE=/ETC/KUBERNETES/SSL/KUBERNETES-KEY.PEM \
> Get/kube-centos/network/config
#输出
{"Network": "172.30.0.0/16", "Subnetlen": "Backend": {"Type": "HOST-GW"}}
#此处是查看主网络配置
Etcdctl--endpoints=${etcd_endpoints}--ca-file=/etc/kubernetes/ssl/ca.pem--cert-file=/etc/kubernetes/ssl/ Kubernetes.pem--key-file=/etc/kubernete S/ssl/kubernetes-key.pem get/kube-centos/network/subnets/172.30.92.0-24
#输出
{"Publicip": "10.10.90.106", "Backendtype": "Vxlan", "Backenddata": {"Vtepmac": "26:af:ac:26:47:ad"}}
Etcdctl--endpoints=${etcd_endpoints}--ca-file=/etc/kubernetes/ssl/ca.pem--cert-file=/etc/kubernetes/ssl/ Kubernetes.pem--key-file=/etc/kubernete S/ssl/kubernetes-key.pem get/kube-centos/network/subnets/172.30.87.0-24
#输出
{"Publicip": "10.10.90.107", "Backendtype": "Vxlan", "Backenddata": {"Vtepmac": "82:6f:58:94:9f:59"}}
If the above output represents the flannel plug-in installation configuration is successful, the next article begins to install node node.
Kubernetes (k8s) Installation deployment process (v)--Install flannel network plug-in