1

I've tried to change the default proxy_timeout(600s) to 3600s for tcp services in k8s maintained nginx-ingress.But its not working.

I have exec the nginx-controller pods and got the following in nginx.conf.

# TCP services

server {
        preread_by_lua_block {
                ngx.var.proxy_upstream_name="tcp-test-test-db-test-lb-dev-7687";
        }

        listen                  7687;

        proxy_timeout           600s;
        proxy_pass              upstream_balancer;

}

i have used following configmap and found not working.I'm getting still 600s timeout.

apiVersion: v1
kind: ConfigMap
metadata:
  name: tcp-services
  namespace: ingress-nginx
  annotations:
    ingress.kubernetes.io/proxyTimeout: 3600s
    ingress.kubernetes.io/proxy-stream-timeout: 3600s
    ingress.kubernetes.io/proxy-connect-timeout: 3600s
    ingress.kubernetes.io/proxy-read-timeout: 3600s
    ingress.kubernetes.io/proxy-send-timeout: 3600s
    ingress.kubernetes.io/proxy_timeout: 3600s
data:
   7687: "test-test-db/test-lb-dev:7687"
   8687: "test-test-db/test-lb-test:8687"

Anyone please help me to short this issue out.

3 Answers 3

2

Annotations does not work in tcp-services for updating proxy_timeout parameter in nginx. You need to update the configmap ingress-nginx-controller and add the proxy-stream-timeout: "3600s" under data. (A sample below)

apiVersion: v1
kind: ConfigMap
metadata:
  name: ingress-nginx-controller
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
data:
  proxy-connect-timeout: "10"
  proxy-read-timeout: "120"
  proxy-send-timeout: "120"
  proxy-stream-timeout: "3600s"
Sign up to request clarification or add additional context in comments.

Comments

1

When using these annotations you have to set them to number (integer) values. For example:

 ingress.kubernetes.io/proxy-stream-timeout: "3600"

instead of:

ingress.kubernetes.io/proxy-stream-timeout: 3600s

If you need more details regarding the timeout options than please check the official docs.

1 Comment

thanks for the answer then i think ingress.kubernetes.io/proxy-stream-timeout: "3600s" as it takes string as per document you mentioned
0

Its not correct. Not in the tcp-cm and not as annotation. Add as Data --> proxy-stream-timeout: 3600 to the other configmap.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.