'Is there a limitation on 'concurrent tcp connections number' of google container engine's pod?

I would like to have 100k tcp connections with single pod on google container engine.

Below is my test.

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

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.

Is there any way to get 100k tcp connections with single pod at google container engine?



Solution 1:[1]

As mentioned by Alex in this article ,

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.

Instead of using the service as a LoadBalancer type, try to setup Ingress to integrate your service with Google Cloud LB which will add the header to incoming requests.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1