<p><strong>I would like to have 100k tcp connections with single pod on google container engine.</strong></p>

<p><strong>Below is my test.</strong>  </p>

<blockquote>
  <ol>
  <li>create 2 cluster : cluster-1( at asia-east1-c ), cluster-2( at us-central1-b )  </li>
  <li>cluster-1 : service, rc with replicas 1, so one pod which is tcp server  </li>
  <li>cluster-2 : just rc with replicas 2, so two pods which is tcp client  </li>
  <li>kubectl exec -it 'cluster-1 pod' -- /bin/bash<br>
  within that pod<br>
  ifconfig => ip address : 10.121.0.7<br>
  ss -tanp => remote peer : 10.121.0.1</li>
  </ol>
</blockquote>

<p>Upper result means that single pod cannot have more than 64K tcp connection because remote peer ip address is fixed at 10.121.0.1 regardless of real clients' ip addresses.</p>

<p><strong>Is there any way to get 100k tcp connections with single pod at google container engine?</strong></p>

<p>As mentioned by Alex in this <a href="https://stackoverflow.com/questions/36464890/how-to-access-client-ip-of-an-http-request-from-google-container-engine">article</a> ,</p>
<p>As per your requirement, I assume you set up your service by setting the service's type to LoadBalancer? It's an unfortunate limitation of the way incoming network-load-balanced packets are routed through Kubernetes right now that the client IP gets lost. That makes tcp connections number limitation.</p>
<p>Instead of using the service as a LoadBalancer type, try to setup <a href="https://stackoverflow.com/questions/36464890/how-to-access-client-ip-of-an-http-request-from-google-container-engine">Ingress</a> to integrate your service with <a href="https://cloud.google.com/load-balancing/docs/https" rel="nofollow noreferrer">Google Cloud LB</a> which will add the header to incoming requests.</p>
