简体   繁体   English

pod 是否通过服务来处理出站流量?

[英]Does a pod pass through service for outbound traffic?

Inbound traffic is pass through the service before going to pods.入站流量在进入 Pod 之前通过服务。 How about the outbound traffic such as a pod accessing pod访问等出站流量怎么样

  • pods outside the service in the same node同一节点中服务外的 pod
  • pods outside the service in different node不同节点中服务外的 pod
  • outside the cluster集群外

does it pass through the service first?它首先通过服务吗? If yes, the only reason i can see now if for monitoring and logging or there is anything else?如果是的话,我现在能看到的唯一原因是用于监控和记录还是有其他什么?

I think you can distinguish two cases here:我认为您可以在这里区分两种情况:

1. Responses from Pod behind a Service 1. 来自服务背后的 Pod 的响应

If a client makes a request to a Service, the request is routed to one of the Pods behind the Service.如果客户端向 Service 发出请求,请求将被路由到 Service 后面的 Pod 之一。 The response from this Pod to the client "passes through the Service" again.从这个 Pod 到客户端的响应再次“通过服务”。

The reason is that the source IP address of the IP datagram has to be changed from the Pod's IP address to the Service's IP address.原因是IP数据报的源IP地址必须从Pod的IP地址改为Service的IP地址。 This is to make the actual Pods that implement a Service transparent to the client.这是为了使实现 Service 的实际 Pod 对客户端透明。 For the client it looks as if the Service IP address and port is a single server and it communicates directly with it.对于客户端,它看起来好像服务 IP 地址和端口是单个服务器,并且直接与其通信。

2. A Pod making an independent request 2. Pod 发出独立请求

If a Pod makes an independent request, this request doesn't pass through the Service but directly goes to whatever IP address the Pod is requesting.如果一个 Pod 发出一个独立的请求,这个请求不会通过 Service,而是直接到达 Pod 请求的任何 IP 地址。

For example, if a Pod makes a direct request to another Pod in the cluster, the destination IP address of the request is this Pod's IP address.例如,如果一个 Pod 直接向集群中的另一个 Pod 发出请求,那么请求的目的 IP 地址就是这个 Pod 的 IP 地址。 If a Pod makes a request to a Service in the cluster, the destination IP address of the request is this Service's IP address.如果 Pod 向集群中的某个 Service 发出请求,则请求的目的 IP 地址就是该 Service 的 IP 地址。 If a Pod makes a request to a destination outside the cluster, the destination IP address of the request is the IP address of this external destination.如果 Pod 向集群外部的目的地发出请求,则请求的目的地 IP 地址就是该外部目的地的 IP 地址。

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

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