Configuring Traefik timeout values for large file uploads and downloads

When uploading or downloading large files, the default timeout value for readTimeout, writeTimeout and idleTimeout errors in Traefik proxy might not be sufficient. You can set the Traefik proxy timeout to a new duration instead of the default value.

You can modify the default timeout values and configure them if needed. The following table shows the default values for timeout errors in Traefik proxy:
Table 1. Default timeout values in Traefik
Error Default value Usage
readTimeout 10 minutes For file uploads
writeTimeout 15 minutes For file downloads
idleTimeout 1 minute For keep-alive
  1. Back up the ConfigMap.
    kubectl -n [***NAMESPACE***] get cm traefik-config -o yaml > /tmp/traefik-config.backup.yaml
  2. Edit the Traefik ConfigMap.
    kubectl edit configmap traefik-config -n [***NAMESPACE***]
  3. In the ConfigMap file, find the data.traefik.toml section and add or update the timeout values.
    [entryPoints.web.transport.respondingTimeouts]
      readTimeout = "10m"
      writeTimeout = "15m"
      idleTimeout = "1m"
    
    [entryPoints.websecure.transport.respondingTimeouts]
      readTimeout = "10m"
      writeTimeout = "15m"
      idleTimeout = "1m"
  4. Restart the Traefik proxy to ensure it applies the changes.
    kubectl -n [***NAMESPACE***] rollout restart deployment/ingress-controller
  5. Verify that the changes are implemented.
    kubectl -n [***NAMESPACE***] get cm traefik-config -o jsonpath='{.data.traefik\.toml}' | grep -A3 respondingTimeouts
    
To perform a rollback, use the following commands:
kubectl -n [***NAMESPACE***] apply -f /tmp/traefik-config.backup.yaml
kubectl -n [***NAMESPACE***] rollout restart deployment/ingress-controller