记一次网络故障——pod间无法通信
2024-08-23 22:38:14
一、背景
- 集群是二进制部署
- 部署完成后一起正常,各种资源对象均可正常创建、
- 部署应用后发现无法跨节点通信,且pod的ip都是172.17.0.0段的
二、排查过程层
- 查看节点路由,发现docker0网卡居然是172.17.0.0段(what?)
- 查找如下资料:基于docker的CNM部署flanel时,需要将/run/flannel/subnet.env作为docker的环境变量,且启动时指定flannel的网段信息
三、解决方案(修改配置文件:/usr/lib/systemd/system/docker.service)
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket [Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
EnvironmentFile=/run/flannel/subnet.env
ExecStart=/usr/bin/dockerd $DOCKER_NETWORK_OPTIONS -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=
RestartSec=
Restart=always # Note that StartLimit* options were moved from "Service" to "Unit" in systemd .
# Both the old, and new location are accepted by systemd and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst= # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd .
# Both the old, and new name are accepted by systemd and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s # Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity # Comment TasksMax if your systemd version does not supports it.
# Only systemd and above support this option.
TasksMax=infinity # set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes # kill only the docker process, not all processes in the cgroup
KillMode=process [Install]
WantedBy=multi-user.target
调用/run/flannel/subnet.env中的DOCKER_NETWORK_OPTIONS指定pod的网段信息
四、补充
- CNI中,docker0的ip与Pod无关,Pod总是生成的时候才去动态的申请自己的IP
- CNM模式下,Pod的网段在docker engine启动时就已经决定
- 推荐使用CNI模式
参考地址:https://jiayi.space/post/kubernetescong-ru-men-dao-fang-qi-3-wang-luo-yuan-li
最新文章
- Linux常用命令学习3---(文件的压缩和解压缩命令zip unzip tar、关机和重启命令shutdown reboot……)
- struts2 数据校验
- 浅谈一下缓存策略以及memcached 、redis区别
- (已解决) 未能加载文件或程序集“Newtonsoft.Json, Version=4.0.0.0, Culture=neutral,
- 5月18日:top10面试算法-LRUcache的实现
- Npoi Web 项目中(XSSFWorkbook) 导出出现无法访问已关闭的流的解决方法
- 团队作业8----第二次项目冲刺(beta阶段)5.25
- Bootstrap+Vue.js 练习入门一
- javaweb项目部署到tomcat服务器
- Just nothing
- centos7.4下的KVM虚拟机安装使用
- 英语口语练习系列-C30-生日-年历的周日和月份-如果白昼落进
- 关于 ubuntu 下 防火墙 ufw的使用
- 产品设计教程:wireframe,prototype,mockup到底有何不同?
- linux安装phpstorm
- spark核心原理
- asp.net控件中的reportview不显示
- jquery实现图片上传前本地预览功能
- linux平台下server运维问题分析与定位
- 【Android】Android动态加载Jar、APK的实现
热门文章
- 03 .NET CORE 2.2 使用OCELOT -- Docker中的Consul
- WPF样式与触发器(3)
- i春秋——“百度杯”CTF比赛 十月场——Not Found(http请求方法,client-ip伪造ip)
- android自定义圆角实线边框,圆角虚线边框,直实线,虚实线,半圆角边框
- 开源一些C#不常用知识(附上DEMO)
- 如何修改被readonly修饰的属性
- leetcode之有效的括号(20)
- Golang循环中调用go func参数异常分析
- Linux 批量查找并替换文件夹下所有文件的内容
- PacMan 03——追踪玩家