kubernetes - 通过注释增加 traefik 入口超时设置

标签 kubernetes kubernetes-helm traefik traefik-ingress

我需要增加我的 traefik 入口超时,因为现在我收到 499 错误。

当我使用 Nginx 作为我的入口代理时能够使用这些注释:

appVersion: ..
kind: Ingress
...
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "123"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "456"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "789"

但现在我正在努力寻找在 Traefik 中做的替代方案。

那么增加我的入口读取、写入、连接值的注释是什么?

最佳答案

如果我没记错的话,您正在寻找当前不存在的功能,但我找到了一个合适的功能请求:Feature: Timeout override per backend #3027 .

自2018年3月15日起处于开放状态。

但是在同一主题中,我发现了对您来说很有趣的新信息:

it is now possible to configure timeouts for each entrypoint in v2

https://docs.traefik.io/routing/entrypoints/#transport

所以请引用Transport部分以获取最新信息并不时查看上述功能请求。

respondingTimeouts¶ respondingTimeouts are timeouts for incoming requests to the Traefik instance. Setting them has no effect for UDP entryPoints.

1) transport.respondingTimeouts.readTimeout

可选,默认=0s

readTimeout 是读取整个请求(包括正文)的最长持续时间。

如果为零,则不存在超时。 可以以 time.ParseDuration 支持的格式或作为原始值(数字)提供。如果未提供任何单位,则假定以秒为单位解析该值。

## Static configuration
entryPoints:
  name:
    address: ":8888"
    transport:
      respondingTimeouts:
        readTimeout: 42

2) transport.respondingTimeouts.writeTimeout

可选,默认=0s

writeTimeout 是响应写入超时之前的最长持续时间。

涵盖从请求头读取结束到响应写入结束的时间。如果为零,则不存在超时。 可以以 time.ParseDuration 支持的格式或作为原始值(数字)提供。如果未提供任何单位,则假定以秒为单位解析该值。

## Static configuration
entryPoints:
  name:
    address: ":8888"
    transport:
      respondingTimeouts:
        writeTimeout: 42

3) transport.respondingTimeouts.idleTimeout

可选,默认=180s

idleTimeout 是空闲(保持事件)连接在关闭自身之前保持空闲的最长时间。

如果为零,则不存在超时。 可以以 time.ParseDuration 支持的格式或作为原始值(数字)提供。如果未提供任何单位,则假定以秒为单位解析该值。

## Static configuration
entryPoints:
  name:
    address: ":8888"
    transport:
      respondingTimeouts:
        idleTimeout: 42

希望对你有帮助

关于kubernetes - 通过注释增加 traefik 入口超时设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62449250/

相关文章:

docker - 为什么 Traefik 在使用 Docker 运行时不读取我的 traefik.toml 文件?

kubernetes - SCP没有提供此类文件或目录

kubernetes - 在 GKE 集群中安装 Velero 时无法拉取镜像 "velero/velero-plugin-for-gcp:v1.1.0"

kubernetes - 更新 kubernetes helm 值

kubernetes - 新 Helm !是否可以进入从稳定 repo 中提取的图表?

spring-boot - 设置 GOOGLE_APPLICATION_CREDENTIALS 后,Google 云存储为部署在 GKE 上的 Spring 应用程序返回 401

http - 限制Traefik路线上允许的方法

Azure Service Fabric 与 Træfik - 与 Azure LB?

Kubernetes - 同一命名空间中两个不同 pod 之间的 HTTP 通信

amazon-web-services - 在 AWS 上运行多个 Kubernetes 集群