【发布时间】:2020-06-10 00:14:13
【问题描述】:
我正在尝试了解 Kubernetes 网络,并在 GKE 网络文档中遇到了以下 sn-p...GKE - Networking。这说...
Kubernetes manages connectivity among Pods and Services using the kube-proxy component, which runs on each node. kube-proxy, which is not an in-line proxy, but an egress-based load-balancing controller, watches the Kubernetes API server and continually maps the ClusterIP to healthy Pods by adding and removing destination NAT (DNAT) rules to the node's iptables subsystem. When a container running in a Pod sends traffic to a Service's ClusterIP, the node selects a Pod at random and routes the traffic to that Pod.
我对此有两个问题...
- 假设有 5 个节点,其中 3 个节点是服务的一部分。现在,其中一个 pod(来自不属于服务的节点)想要与服务通信......它通过服务的 FQDN 找到服务..这个节点中的 kube-proxy 是否将流量发送到其中一个 pod服务的一部分?
- 另外,它说 kube-proxy 负载平衡整个 Pod 集的流量......这是怎么做到的?如果有一个节点进行流量路由,它会知道哪个节点是下一个获取流量的节点/pod。但是服务会随机选择节点(在服务中),对吗?
有人可以澄清一下吗?
提前致谢。
【问题讨论】:
-
能否请您以不同的方式解释这两个问题?抱歉,我没完全理解