#13907·traefik

better graceful restart with Kubernetes taking into account interval between incoming requests

Author: adk-swisstopoCreated Sep 15, 2026Updated Sep 17, 2026
Labelskind/proposalarea/provider/k8s
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any. I created one.

The current recommendation to gracefully handle Kubernetes-initiated restarts is to add a preSleep hook. This generally works but is subject to race conditions and delays the restart for longer than strictly necessary (sometimes to the point of exceeding the actual grace time e.g. during node termination).

An alternative proposal is to update the Traefik signal handler to behave thus: (a) define two new configuration directives graceful_shutdown_new_connection_max_interval and graceful_shutdown_max_delay (b) when receiving the signal, start two timers time_since_shutdown_request, time_since_new_inbound_request (c) actually shutdown once time_since_new_inbound_request >= graceful_shutdown_new_connection_max_interval or time_since_shutdown_request >= graceful_shutdown_max_delay

This is not specific to Kubernetes and requires no explicit synchronisation mechanism besides the shutdown signal.

This was proposed in https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979