gpt4 book ai didi

Azure Kubernetes 保持事件 TCP 套接字

转载 作者:行者123 更新时间:2023-12-03 00:20:34 27 4
gpt4 key购买 nike

我想要连接一个打开 TCP 连接的移动设备到我的一个 kubernetes 服务。问题是在心跳间隔10分钟之前连接就被杀死了。

下面是我的部署

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

我尝试在 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"

此外,公共(public)IP中的“空闲超时”设置为30分钟。 LoadBalancer 规则也是如此。

我像这样安装了入口 Controller :

helm install nginx-ingress ingress-nginx/ingress-nginx \
--set tcp.8485="default/device-gateway:8485" \
--set [more irrelevant settings here]

我猜这与配置有关,那么如何将超时设置为 30 分钟?

最佳答案

我已经发布了社区 wiki 答案来总结该主题。

OP 找到了解决方法。他在评论中提到了这一点:

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.

我找到了关于Configure TCP reset and idle timeout for Azure Load Balancer的文章。它可以帮助set tcp reset and idle timeout来自Azure portal .

关于Azure Kubernetes 保持事件 TCP 套接字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69974041/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com