Skip to content

How to configure proxy_connect_timeout for TCP services in ingress-nginx v1.12.1?

Hi team,

I'm using ingress-nginx v1.12.1 and have both HTTP and TCP services configured.

For HTTP ingress, we can easily control the connection timeout via the ConfigMap key:

proxy-connect-timeout: "5s"

However, for TCP services (configured through the flag --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services), I cannot find a documented way to set the equivalent stream-level directive proxy_connect_timeout .

For example, the generated stream configuration looks like this:

server { listen 25001; proxy_timeout 600s; proxy_next_upstream on; proxy_next_upstream_timeout 600s; proxy_next_upstream_tries 3; proxy_pass upstream_balancer; }

But there’s no proxy_connect_timeout applied by default, which causes long connection stalls when the upstream pod is down (resulting in errors like (111: Connection refused) or (110: Operation timed out)).

I tried setting values like this in the main nginx-configuration ConfigMap:

proxy-connect-timeout: "5s"

…but it only affects the HTTP layer, not the stream (TCP) layer.

My question:

Is there an officially supported way to configure proxy_connect_timeout for TCP/stream services when using --tcp-services-configmap? If not, is the recommended approach to use the global stream-snippet field in the ConfigMap, or will there be future support for per-service stream configuration?

Thanks!