【问题标题】:Kubernetes pods can't connect between machinesKubernetes pod 无法在机器之间连接
【发布时间】:2016-01-07 01:37:16
【问题描述】:

我在这里使用了 node.yaml 和 master.yaml 文件:http://kubernetes.io/v1.1/docs/getting-started-guides/coreos/coreos_multinode_cluster.html 在 3 台运行 CoreOS 的裸机机器上创建了一个多节点集群。但是,不同节点上的 Pod 不能相互通信。我将不胜感激任何指示或建议。我很茫然。

我有三个运行 rabbitmq 的 pod:

thuey:~ thuey$ kbg pods | grep rabbitmq
rabbitmq-bootstrap     1/1       Running   0          3h
rabbitmq-jz2q7         1/1       Running   0          3h
rabbitmq-mrnfc         1/1       Running   0          3h

两个 pod 在一台机器上:

kbd node jolt-server-3 | grep rabbitmq
thuey               rabbitmq-bootstrap      0 (0%)      0 (0%)      0 (0%)      0 (0%)
thuey               rabbitmq-jz2q7          0 (0%)      0 (0%)      0 (0%)      0 (0%)

另一个 pod 在另一台机器上:

thuey:~ thuey$ kbd node jolt-server-4 | grep rabbitmq
thuey               rabbitmq-mrnfc          0 (0%)      0 (0%)      0 (0%)      0 (0%)

我可以从 rabbitmq-bootstrap 成功 ping 到 rabbitmq-jz2q7:

root@rabbitmq-bootstrap:/# ping 172.17.0.5
PING 172.17.0.5 (172.17.0.5) 56(84) bytes of data.
64 bytes from 172.17.0.5: icmp_seq=1 ttl=64 time=0.058 ms
64 bytes from 172.17.0.5: icmp_seq=2 ttl=64 time=0.035 ms
64 bytes from 172.17.0.5: icmp_seq=3 ttl=64 time=0.064 ms
64 bytes from 172.17.0.5: icmp_seq=4 ttl=64 time=0.055 ms
^C
--- 172.17.0.5 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.035/0.053/0.064/0.010 ms

但我无法 ping rabbitmq-mrnfc:

root@rabbitmq-bootstrap:/# ping 172.17.0.8
PING 172.17.0.8 (172.17.0.8) 56(84) bytes of data.
From 172.17.0.2 icmp_seq=1 Destination Host Unreachable
From 172.17.0.2 icmp_seq=2 Destination Host Unreachable
From 172.17.0.2 icmp_seq=3 Destination Host Unreachable
From 172.17.0.2 icmp_seq=4 Destination Host Unreachable
^C
--- 172.17.0.8 ping statistics ---
5 packets transmitted, 0 received, +4 errors, 100% packet loss, time 4000ms
pipe 4

【问题讨论】:

    标签: kubernetes coreos


    【解决方案1】:

    您使用的指南不包含裸机说明。您需要实现 Kubernetes 的networking model 的网络(例如 flannel、calico)。您可以查看table of solutions 了解不同 IaaS/OS/网络​​组合的入门指南。

    【讨论】:

    • 感谢您的回复。查看这些的 cloud-config,我看到了 flannel 配置,所以我认为这就是所需要的。我会尝试其中一种解决方案。
    【解决方案2】:

    事实证明,问题在于 docker 在 flannel 启动之前就启动了。这导致 docker 的 bip 被设置为默认值 172。同时,法兰绒正在运行一个 10 子网。为了解决这个问题,我刚刚从我的云配置中的 docker.service 添加了对 flannel 的依赖。一些有用的链接:

    https://groups.google.com/forum/#!topic/coreos-user/KKnV1lA-ULs https://github.com/coreos/flannel/issues/246

    【讨论】:

    猜你喜欢
    • 2018-12-20
    • 2018-08-09
    • 2018-09-03
    • 2022-11-05
    • 2019-10-10
    • 2021-11-24
    • 2020-09-01
    • 2021-05-19
    • 2021-03-01
    相关资源
    最近更新 更多