如何设置 Kubernetes nodeport 服务超时?

How to setup Kubernetes nodeport service timeout?

如何更改 Kubernetes NodePort 服务超时?

我已经使用 apache2 网络服务器通过 运行 无限循环 php 代码对其进行了测试,但 3 分钟后它以 nginx 的 504 网关超时告终。我猜它是由 NodePort 服务 Kubernetes

处理的

NodePort 只是在节点上公开 pod 的端口,健康检查不是它的功能。

我猜您正在寻找可以为每个容器定义的 livenessProbe。它的目的是检查容器是否健康,如果不是这样,它将杀死它然后重新启动,以便容器返回到它的 original/normal 状态。

每 5 秒通过访问容器的端口 80 和路径 / 检查容器健康状况的 HTTP 活动探测示例。

livenessProbe:
      httpGet:
          port: 80
          path: /
      periodSeconds: 5 

更多配置细节here

Kubernetes 中的大部分服务方面都由 Linux 内核级别的 kube-proxy and/or regular iptables, so there is not a TCP connection timeout per se. If you are looking at lower-level primitives you could look at TCP timeouts 处理 ⏳,但通常那些具有合理的默认值。

您提供的问题细节很少,但假设您使用的是 Nginx 入口控制器,您可以经受住 services/pods 实际服务流量实际上已启动并在您获得的特定时刻接收流量那些超时。您还可以使用 annotations or the configmap

在 Nginx 入口控制器级别调整超时 ⏳

✌️