搬砖小抄

k3s集群网络通讯问题整理

字数统计: 180阅读时长: 1 min
2020/07/21 Share

表现

  • 在集群网络中ping另外一个Service,网络不通
  • 对另外一个Service进行dns解析,报错

部署一个netshoot服务,测试结果如下:

1
2
3
4
5
bash-5.0# ping my-service
ping: my-service: Try again
bash-5.0# nslookup my-service
;; reply from unexpected source: 10.42.3.60#53, expected 10.43.0.10#53
;; reply from unexpected source: 10.42.3.60#53, expected 10.43.0.10#53

解决办法(CentOS)

开启ip_forward

1
2
3
# 也可以在 /etc/sysctl.conf 中添加参数
sudo sh -c "echo net.ipv4.ip_forward=1 >> /etc/sysconf.d/10-ipv4-forwarding-on.conf"
sudo sysctl -p

开启桥接

1
2
3
# 也可以在 /etc/sysctl.conf 中添加参数
sudo sh -c "echo net.bridge.bridge-nf-call-iptables=1 >> /etc/sysconf.d/10-bridge-nf-call-iptables.conf"
sudo sysctl -p

相关资料

CATALOG
  1. 1. 解决办法(CentOS)
  2. 2. 相关资料