Skip to content

Add a delay to the shutdown-manager before failing healthchecks #9210

Description

@mwain

Description

We run Envoy Gateway v1.7.0 on GKE behind the external passthrough L4 load balancer (with externalTrafficPolicy: Local).
Envoy pod terminations can produce a few seconds where new connections are reset or hang until they time out.

Seems that the cause is two timers racing. When a pod terminates, the shutdown-manager immediately calls healthcheck/fail, the readiness probe fails within ~5s, and kube-proxy stops routing to the pod.
But the load balancer deregisters nodes via its own health check, which on GKE runs every 3 seconds and needs 2 failures (not configurable), so it takes ~6-12s.
In between, the LB keeps sending connections that the node can no longer route.

Kubernetes handles this window via KEP-1669.
When no other ready endpoints remain, kube-proxy keeps routing to terminating pods that still pass their readiness probe.
Failing readiness at the start of shutdown defeats this.

We use distroless images, so patching the preStop hook with a sleep is not an option.

Proposal

Add a drainDelay field to ShutdownConfig that delays the healthcheck/fail call.
During the delay the pod stays ready and keeps serving, so the load balancer has time to deregister it.
Defaults to 0s, which keeps the current behavior.

Impl

Proposal has been implemented in #9211

Relevant Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions