gpt4 book ai didi

kubernetes - 同一节点上的 Pod 如何相互通信?

转载 作者:行者123 更新时间:2023-12-01 13:29:48 25 4
gpt4 key购买 nike

如果我在 2 个 Pod 中运行进程,这些进程通过 tcp 相互通信(通过 Kubernetes 服务相互寻址)并且 Pod 被安排到同一个节点,通信将通过网络进行还是 Kubernetes 知道使用环回设备?

最佳答案

community/contributors/design-proposals/network/networking”中没有提到环回

Because every pod gets a "real" (not machine-private) IP address, pods can communicate without proxies or translations. The pod can use well-known port numbers and can avoid the use of higher-level service discovery systems like DNS-SD, Consul, or Etcd.

When any container calls ioctl(SIOCGIFADDR) (get the address of an interface), it sees the same IP that any peer container would see them coming from — each pod has its own IP address that other pods can know.
By making IP addresses and ports the same both inside and outside the pods, we create a NAT-less, flat address space. Running "ip addr show" should work as expected. This would enable all existing naming/discovery mechanisms to work out of the box, including self-registration mechanisms and applications that distribute IP addresses.
We should be optimizing for inter-pod network communication.


去年在“ Kubernetes - container communication within a pod using names instead of ' localhost '?”中已经提到了使用IP

关于kubernetes - 同一节点上的 Pod 如何相互通信?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46535057/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com