I want to connect a mobile device that opens a TCP connection to one of my kubernetes services. The problem is that the connection is killed before the heartbeat interval of 10 minutes.
Below is my deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: device-gateway
labels:
app: device-gateway
spec:
replicas: 1
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels:
app: device-gateway
template:
metadata:
labels:
app: device-gateway
spec:
containers:
- name: device-gateway
image: [IMAGE]
imagePullPolicy: Always
imagePullSecrets:
- name: myregistrykey
---
apiVersion: v1
kind: Service
metadata:
name: device-gateway
spec:
type: ClusterIP
ports:
- name: my-device-port
port: 8485
protocol: TCP
selector:
app: device-gateway
I have tried setting the following annotations in my Ingress
nginx.ingress.kubernetes.io/proxy-socket-keepalive: "on"
nginx.ingress.kubernetes.io/proxy-send-timeout: "1800s"
nginx.ingress.kubernetes.io/proxy-stream-timeout: "1800s"
nginx.org/proxy-send-timeout: "1800s"
service.beta.kubernetes.io/azure-load-balancer-tcp-idle-timeout: "30"
Also, the "idle timeout" in the public IP is set to 30 minutes. Same goes for the LoadBalancer rule.
I installed the ingress controller like this:
helm install nginx-ingress ingress-nginx/ingress-nginx \
--set tcp.8485="default/device-gateway:8485" \
--set [more irrelevant settings here]
I'm guessing it has something to do with configuration, so how do I get the timeout to be 30 minutes?
I have posted community wiki answer to summarize the topic.
OP has found a workaround. He has mentioned about it in the comment:
I did not find the solution to the problem, but I did remove the problem by send a heartbeat the other way every 5 minutes to keep the line open.
I have found article about Configure TCP reset and idle timeout for Azure Load Balancer. It could help set tcp reset and idle timeout from the Azure portal.