【问题标题】:Kubernetes services sometimes unreachableKubernetes 服务有时无法访问
【发布时间】:2017-06-29 09:16:01
【问题描述】:

我有一个集群 kubernetes v1.5.2 安装了 kops 并使用 weave 网络插件。我注意到有时我的 kubernetes 服务无法从集群上的 pod 中访问。

我浏览了有关故障排除服务的整篇文章:https://kubernetes.io/docs/admin/cluster-troubleshooting/ 我可以确认一切都按预期执行,但有时并非如此(这是集群 Pod 中的 curl 尝试使用其 IP 地址访问服务. 该服务由 5 个端点支持,全部启动并运行):

$> curl 100.65.135.200 -vv
* Rebuilt URL to: 100.65.135.200/
*   Trying 100.65.135.200...
* connect to 100.65.135.200 port 80 failed: No route to host
* Failed to connect to 100.65.135.200 port 80: No route to host
* Closing connection 0
curl: (7) Failed to connect to 100.65.135.200 port 80: No route to host

这是我第一次使用kopsweave 设置集群,也是我第一次看到这个。如果有人有调试这个的线索,那就太棒了!!

更新

  • kube 代理正在正确注册我的服务:I0210 23:09:41.070508 6 proxier.go:472] Adding new service "my_app/my_app:http" at 100.65.135.200:80/TCP

  • 我的 pod IP 不与集群的 IP 重叠

我在集群的 2 个节点上的 weave-kube 容器上看到了一些奇怪的日志:

INFO: 2017/02/11 12:14:10.959122 Discovered remote MAC b2:3e:c7:99:16:de at ce:7d:9f:95:66:fb(ip-172-20-55-245)
ERRO: 2017/02/11 12:14:10.959348 Captured frame from MAC (b2:3e:c7:99:16:de) to (ff:ff:ff:ff:ff:ff) associated with another peer ce:7d:9f:95:66:fb(ip-172-20-55-245)
ERRO: 2017/02/11 12:14:39.140186 Captured frame from MAC (06:b7:eb:e7:fa:0e) to (ff:ff:ff:ff:ff:ff) associated with another peer c2:58:a0:4e:b2:ff(ip-172-20-75-108)
ERRO: 2017/02/11 12:15:52.273667 Captured frame from MAC (32:f9:43:24:68:ad) to (ff:ff:ff:ff:ff:ff) associated with another peer c2:58:a0:4e:b2:ff(ip-172-20-75-108)
ERRO: 2017/02/11 12:16:56.686643 Captured frame from MAC (c2:58:a0:4e:b2:ff) to (ff:ff:ff:ff:ff:ff) associated with another peer c2:58:a0:4e:b2:ff(ip-172-20-75-108)
ERRO: 2017/02/11 12:16:56.686969 Captured frame from MAC (ce:7d:9f:95:66:fb) to (ff:ff:ff:ff:ff:ff) associated with another peer ce:7d:9f:95:66:fb(ip-172-20-55-245)
ERRO: 2017/02/11 12:16:56.687002 Captured frame from MAC (72:85:2b:19:65:b9) to (ff:ff:ff:ff:ff:ff) associated with another peer c2:58:a0:4e:b2:ff(ip-172-20-75-108)
ERRO: 2017/02/11 12:16:56.687042 Captured frame from MAC (f2:1a:9e:d8:7f:a3) to (ff:ff:ff:ff:ff:ff) associated with another peer c2:58:a0:4e:b2:ff(ip-172-20-75-108)

调查一下

更新 2

所以这些编织错误是我的问题。显然 ethtool 是 weave 所需要的,我的图像中缺少它。我将 AMI 更新到 1.5,现在一切正常。

【问题讨论】:

  • ethtool 不是 Weave Net 所必需的,但 Kubernetes 是必需的。如果你没有它,Kubernetes 做的事情对 Weave Net 来说绝对是灾难性的。我在github.com/kubernetes/kubernetes/pull/36990 中修复了这个问题

标签: service kubernetes kops


【解决方案1】:

一切都按预期执行,但有时并非如此

最好能获得更多细节来描述这一点 - 是一个 pod 发生故障而其他 pod 工作,还是所有 pod 有时工作有时失败?

但是,还有一些额外的事情需要检查:

  1. 您的虚拟以太网设备是否与网桥断开连接?见https://github.com/weaveworks/weave/issues/2601
  2. 您的 pod IP 地址空间是否与集群 IP 地址空间重叠?
  3. 检查 100.65.135.200 是否由 kube-proxy 映射(该部分在 https://kubernetes.io/docs/admin/cluster-troubleshooting/ 中进行了描述)

最后一步是查看网络数据包——在运行curl 测试的同时运行tcpdump -n -i weave;如果你在那里没有看到任何东西,那么在 pod 的 veth 上运行转储。

【讨论】:

  • 感谢您的回答。我更新了我的问题,我认为我看到了来自 weave 的异常日志
猜你喜欢
  • 2020-03-04
  • 1970-01-01
  • 1970-01-01
  • 2021-10-04
  • 2021-06-27
  • 1970-01-01
相关资源
最近更新 更多