简体   繁体   English

Kubernetes kube-proxy机制

[英]Kubernetes kube-proxy mechanism

In Kubernetes, let's say we have three pods, which are physically hosted on Node X, Y and Z. When I expose them as a service using 'kubectl expose', are all nodes in the cluster (in addition to X, Y and Z) configured the same way? 在Kubernetes中,假设我们有三个pod,它们在Node X,Y和Z上物理托管。当我使用'kubectl expose'将它们作为服务公开时,集群中的所有节点(除了X,Y和Z) )配置方式相同? Specifically, kube-proxy in each node within the cluster watches the apiserver, builds a bunch of iptables rules and references the portal IP (chosen by apiserver), and inserts those rules to the node which it lives on? 具体来说,集群中每个节点中的kube-proxy监视apiserver,构建一堆iptables规则并引用门户IP(由apiserver选择),并将这些规则插入到它所在的节点上?

I assume the reason it has to be done on all nodes is that the cluster has no idea from which node the client would come from to hit the portal IP? 我假设必须在所有节点上完成的原因是集群不知道客户端来自哪个节点来访问门户IP?

You are correct. 你是对的。 The portal network (aka service network, cluster network) has no network interface but is a collection of iptables rules managed by kube-proxy. 门户网络(也称为服务网络,集群网络)没有网络接口,但是由kube-proxy管理的iptables规则的集合。 Each node needs to have these rules as a pod on any of them could connect any portal IP (aka service IP, cluster IP). 每个节点都需要将这些规则作为其中任何一个的pod,可以连接任何门户IP(也称为服务IP,群集IP)。

Read more here: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies 在这里阅读更多内容: https//kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM