kubernetes的CNI网络插件-Flannel
程序员文章站
2022-09-03 23:50:41
[TOC] 1.集群架构 | 主机名 | 角色 | IP地址 | | : : | : : | : : | | hdss7 21.host.com | flannel | 10.4.7.21 | | hdss7 22.host.com | flannel | 10.4.7.22 | 部署方法以hdss ......
1.集群架构
主机名 | 角色 | ip地址 |
---|---|---|
hdss7-21.host.com | flannel | 10.4.7.21 |
hdss7-22.host.com | flannel | 10.4.7.22 |
部署方法以hdss7-21.host.com为例
1.1.下载软件,解压,做软链接
[root@hdss7-21 ~]# cd /opt/src/ [root@hdss7-21 src]# wget https://github.com/coreos/flannel/releases/download/v0.11.0/flannel-v0.11.0-linux-amd64.tar.gz [root@hdss7-21 src]# mkdir /opt/flannel-v0.11.0 [root@hdss7-21 src]# tar xf flannel-v0.11.0-linux-amd64.tar.gz -c /opt/flannel-v0.11.0/ [root@hdss7-21 src]# ln -s /opt/flannel-v0.11.0/ /opt/flannel
1.2.创建目录
[root@hdss7-21 src]# /opt/flannel [root@hdss7-21 flannel]# mkdir /opt/flannel/cert
1.3.拷贝证书文件
[root@hdss7-21 flannel]# cd cert [root@hdss7-21 cert]# scp hdss7-200:/opt/certs/ca.pem . [root@hdss7-21 cert]# scp hdss7-200:/opt/certs/client.pem . [root@hdss7-21 cert]# scp hdss7-200:/opt/certs/client-key.pem .
1.4.创建配置
[root@hdss7-21 cert]# cd .. [root@hdss7-21 flannel]# vi subnet.env flannel_network=172.7.0.0/16 flannel_subnet=172.7.21.1/24 flannel_mtu=1500 flannel_ipmasq=false
1.5.创建启动脚本
[root@hdss7-21 flannel]# vi flanneld.sh #!/bin/sh ./flanneld \ --public-ip=10.4.7.21 \ --etcd-endpoints=https://10.4.7.12:2379,https://10.4.7.21:2379,https://10.4.7.22:2379 \ --etcd-keyfile=./cert/client-key.pem \ --etcd-certfile=./cert/client.pem \ --etcd-cafile=./cert/ca.pem \ --iface=eth0 \ --subnet-file=./subnet.env \ --healthz-port=2401
1.6.授权和创建日志目录
[root@hdss7-21 flannel]# chmod +x flanneld.sh [root@hdss7-21 flannel]# mkdir -p /data/logs/flanneld
1.7.创建supervisor配置
[root@hdss7-21 flannel]# vi /etc/supervisord.d/flannel.ini [program:flanneld-7-21] command=/opt/flannel/flanneld.sh ; the program (relative uses path, can take args) numprocs=1 ; number of processes copies to start (def 1) directory=/opt/flannel ; directory to cwd to before exec (def no cwd) autostart=true ; start at supervisord start (default: true) autorestart=true ; retstart at unexpected quit (default: true) startsecs=30 ; number of secs prog must stay running (def. 1) startretries=3 ; max # of serial start failures (default 3) exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) stopsignal=quit ; signal used to kill process (default term) stopwaitsecs=10 ; max num secs to wait b4 sigkill (default 10) user=root ; setuid to this unix account to run the program redirect_stderr=true ; redirect proc stderr to stdout (default false) stdout_logfile=/data/logs/flanneld/flanneld.stdout.log ; stderr log path, none for none; default auto stdout_logfile_maxbytes=64mb ; max # logfile bytes b4 rotation (default 50mb) stdout_logfile_backups=4 ; # of stdout logfile backups (default 10) stdout_capture_maxbytes=1mb ; number of bytes in 'capturemode' (default 0) stdout_events_enabled=false ; emit events on stdout writes (default false)
2.flannel host-gw模型(三选一)
[root@hdss7-21 etcd]# ./etcdctl set /coreos.com/network/config '{"network": "172.7.0.0/16", "backend": {"type": "host-gw"}}' {"network": "172.7.0.0/16", "backend": {"type": "host-gw"}} 验证: [root@hdss7-21 etcd]# ./etcdctl get /coreos.com/network/config {"network": "172.7.0.0/16", "backend": {"type": "host-gw"}}
2.1.启动服务并检查
[root@hdss7-21 flannel]# supervisorctl update [root@hdss7-21 flannel]# supervisorctl status
3.flannel vxlan模型(三选一)
1.supervisor stop flanneld-7-[21.22] 2.删除host-gw模型创建的路由 route del -net 172.7.21.0/24 gw 10.4.7.21 hdss7-22.host.com上 route del -net 172.7.22.0/24 gw 10.4.7.22 hdss7-21.host.com上 3.在etcd修改 ./etcdctl get /coreos.com/network/config ./etcdctl rm /coreos.com/network/config ./etcdctl set /coreos.com/network/config '{"network": "172.7.0.0/16", "backend": {"type": "vxlan"}}' 4.supervisor start flanneld-7-[21.22]
4.flannel 直接路由模型(三选一)
'{"network": "172.7.0.0/16", "backend": {"type": "vxlan","directrouting": true}}'
(运维技术交流群:926402931,欢迎大家一起来交流。)
上一篇: Flask路由与蓝图Blueprint
下一篇: redis 入门一
推荐阅读
-
kubernetes的服务发现插件-CoreDNS
-
使用kubeadm安装kuberneters/部署前准备/flannel网络插件/镜像下载/
-
kubernetes的CNI网络插件-Flannel
-
5.kubernetes的GUI资源管理插件-仪表盘
-
4.kubernetes的服务暴露插件-Traefik
-
Onvif/RTSP网络安防摄像机网页无插件直播方案EasyNVR如何判断前端设备的类型?
-
RTSP协议网络摄像头接入视频平台EasyNVR实现网页无插件直播后台导出用户信息是如何实现的?
-
RTSP协议网络摄像头网页无插件直播平台EasyNVR的云端综合管理平台EasyNVS提交基础配置报错原因分析
-
《Docker容器:利用Kubernetes、Flannel、Cockpit和Atomic构建和部署》——2.2 容器式Linux系统的Docker配置...
-
java 实现的画网络拓扑插件 开源