Skip to content
KEP Brain

KEP-3960keps/sig-node/3960-pod-lifecycle-sleep-action

Pod lifecycle sleep action

implementedstablesig-nodelatest v1.34
This KEP proposes the addition of a new sleep action for the PreStop lifecycle hook in Kubernetes, allowing containers to pause for a specified duration before termination. This enhancement aims to provide a more straightforward way to manage graceful shutdowns and improve the overall lifecycle management of containers, and to handle new connections from cli… Full summary

This KEP proposes the addition of a new sleep action for the PreStop lifecycle hook in Kubernetes, allowing containers to pause for a specified duration before termination. This enhancement aims to provide a more straightforward way to manage graceful shutdowns and improve the overall lifecycle management of containers, and to handle new connections from clients that have not yet finished endpoint termination during the pod termination. An example: To use this feature to achieve zero downtime for nginx, we need to deploy a deployment with sleep prestop hook and a service. yaml apiVersion: apps/v1 kind: Deployment metadata: name: nginx spec: selector: matchLabels: app: nginx replicas: 3 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.16.1 lifecycle: preStop: sleep: seconds: 5 readinessProbe: httpGet: path: / port: 80 --- apiVersion: v1 kind: Service metadata: name: nginx spec: selector: app: nginx ports: - port: 80 targetPort: 80 - Restart/Update this deployment - A delete pod event is sent to notify the kubelet and the Endpoint Controller (which manages the Service endpoints) simultaneously. - PreStop hook starts, which will delay the shutdown sequence by 5 seconds. During this time, the Endpoint Controller will remove the terminating pod, and the traffic will be sent to other running pods. - When the timeout of 5 seconds ended, the old pod is killed, and new pods will be created. There is no traffic sent to the terminating pod during the update.

Facts

Authors
@axezhan
PRR approvers
@wojtek-talpha@wojtek-tbeta@wojtek-tstable
Tracking issue
#3960(opens GitHub in a new tab) closedcompletedclosed 2025-09-19 20:50 UTCmilestone v1.34sig/nodestage/stable
Milestones
alpha v1.29beta v1.30stable v1.34
Participating SIGs
none
Feature gates
PodLifecycleSleepAction
Created / last updated
2023-04-22 / none
Loading decisions and status history

Keyboard shortcuts

Everywhere

?
Show or hide this list
/
Focus the question box on Ask, otherwise the page search
Ctrl Kor⌘ K
Focus the KEP search in the top bar
t
Switch the theme (system, light, dark)
Esc
Close a dialog, a search list or a menu

Go to a page

Press g, then the letter

g h
Home
g a
Ask
g e
Explore
g u
Audit
g m
Memory
g b
About

Ask

Enter
Send the question
Shift Enter
New line in the question
Esc
Cancel the running question

Search lists

KEP search and Explore search

↓or↑
Move through the results
HomeorEnd
First or last result (Explore)
Enter
Open the highlighted result, or KEP-n when the query is a number

KEP page

o
Open the KEP on GitHub
y
Open kep.yaml on GitHub
a
Ask about this KEP
←or→
Previous or next tab, when a tab is focused

Findings table

With a finding row focused (Tab into the table or click a row)

jork
Next or previous finding
EnterorSpace
Expand or collapse the finding
o
Open the finding's KEP page
d
Draft the fix as an issue text (nothing is posted)
]or[
Next or previous page of findings

Shortcuts pause while you type in a field. Press ? or Esc to close.