# Better graceful restart with Kubernetes

**URL:** <https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979>\
**Category:** Traefik\
**Tags:** kubernetes-ingress\
**Created:** [July 24, 2026, 5:09pm UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979 "2026-07-24T17:09:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![adk-swisstopo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/adk-swisstopo/32/11291_2.png) [@adk-swisstopo](https://community.traefik.io/u/adk-swisstopo)\
**Post date:** [July 24, 2026, 5:09pm UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/1 "2026-07-24T17:09:01Z")

</div>

The [current recommendation](https://github.com/traefik/traefik/issues/4452#issuecomment-459931923) 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](https://github.com/kubernetes/kubernetes/issues/106476#issuecomment-5055055101) 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

Would that proposal make sense? Is anything similar in the works already? I couldn't find anything relevant in the bug tracker but I might be searching it wrong. Or maybe this is already possible currently but I didn't find how?

---

<div class="post-metadata">

**Author:** ![Morgan.Foster16](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Morgan.Foster16](https://community.traefik.io/u/Morgan.Foster16)\
**Post date:** [August 20, 2026, 2:40pm UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/2 "2026-08-20T14:40:22Z")

</div>

The two-timer idea fits the problem better than a fixed preSleep delay, especially with node termination. The key detail is stopping new connections before waiting on existing ones.

---

<div class="post-metadata">

**Author:** ![adk-swisstopo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/adk-swisstopo/32/11291_2.png) [@adk-swisstopo](https://community.traefik.io/u/adk-swisstopo)\
**Post date:** [August 26, 2026, 7:12am UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/3 "2026-08-26T07:12:06Z")

</div>

Right. How do we move forward with this proposal? Does it make sense to just file a feature request in the bug tracker with the text of my first message?

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [September 9, 2026, 4:01pm UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/4 "2026-09-09T16:01:51Z")

</div>

The devs are usually working with Github, make sure to reference your post here.

---

<div class="post-metadata">

**Author:** ![adk-swisstopo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/adk-swisstopo/32/11291_2.png) [@adk-swisstopo](https://community.traefik.io/u/adk-swisstopo)\
**Post date:** [September 15, 2026, 8:09am UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/5 "2026-09-15T08:09:51Z")

</div>

This is now [better graceful restart with Kubernetes taking into account interval between incoming requests · Issue #13907 · traefik/traefik · GitHub](https://github.com/traefik/traefik/issues/13907)

---

<div class="post-metadata">

**Author:** ![warmlantern379](https://avatars.discourse-cdn.com/v4/letter/w/e36b37/32.png) [@warmlantern379](https://community.traefik.io/u/warmlantern379)\
**Post date:** [November 5, 2026, 12:16am UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/6 "2026-11-05T00:16:46Z")

</div>

This post was flagged by the community and is temporarily hidden.

---

<div class="post-metadata">

**Author:** ![mildspline381](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@mildspline381](https://community.traefik.io/u/mildspline381)\
**Post date:** [November 13, 2026, 7:18am UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/7 "2026-11-13T07:18:03Z")

</div>

Glad someone brought up _Better graceful restart with Kubernetes_. I spent a couple of evenings comparing different approaches to `better and graceful` before settling on a solid routine for `better`.

Passing along the link I have been active on lately: [config-memo-ref.pages.dev/r/community\_traefik\_io](https://config-memo-ref.pages.dev/r/community_traefik_io)

---

<div class="post-metadata">

**Author:** ![steadypillar280](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@steadypillar280](https://community.traefik.io/u/steadypillar280)\
**Post date:** [November 13, 2026, 7:26am UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/8 "2026-11-13T07:26:12Z")

</div>

This post was flagged by the community and is temporarily hidden.

---

<div class="post-metadata">

**Author:** ![solidcanyon728](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@solidcanyon728](https://community.traefik.io/u/solidcanyon728)\
**Post date:** [November 13, 2026, 9:40am UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/9 "2026-11-13T09:40:41Z")

</div>

This post was flagged by the community and is temporarily hidden.

---

<div class="post-metadata">

**Author:** ![warmanchor185](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@warmanchor185](https://community.traefik.io/u/warmanchor185)\
**Post date:** [November 13, 2026, 9:48am UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/10 "2026-11-13T09:48:56Z")

</div>

This post was flagged by the community and is temporarily hidden.

---

<div class="post-metadata">

**Author:** ![clearcobalt652](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@clearcobalt652](https://community.traefik.io/u/clearcobalt652)\
**Post date:** [November 13, 2026, 3:20pm UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/11 "2026-11-13T15:20:25Z")

</div>

This post was flagged by the community and is temporarily hidden.

---

<div class="post-metadata">

**Author:** ![solidcobalt312](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@solidcobalt312](https://community.traefik.io/u/solidcobalt312)\
**Post date:** [November 13, 2026, 3:26pm UTC](https://community.traefik.io/t/better-graceful-restart-with-kubernetes/29979/12 "2026-11-13T15:26:13Z")

</div>

This post was flagged by the community and is temporarily hidden.
