Kubernetes removes the pod from Service endpoints and sends SIGTERM, waits terminationGracePeriodSeconds (30 s default), then sends SIGKILL. The .NET host cancels the stopping token and waits up to HostOptions.ShutdownTimeout for hosted services to finish.
Size the timeouts from your work: ShutdownTimeout must cover the longest unit of work (or the time to checkpoint it), and the pod's grace period must be longer than ShutdownTimeout plus any preStop delay, otherwise SIGKILL arrives first. Stop taking new work (stop pulling from the queue), finish or checkpoint the current item, and make processing idempotent so a killed item is safely retried. A preStop hook (e.g. sleep 5) delays SIGTERM so load balancers stop routing to the pod first; that matters for HTTP workloads more than queue workers. Log shutdown start, items abandoned and duration so lost work is visible.
Checks practical knowledge of host shutdown and orchestrator grace periods
Last updated 23 Nov 2026.