Skip to content

smpio/kube-delayed-term-pod-admission

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kube-delayed-term-pod-admission

After marking container as terminating and before sending SIGTERM wait some amount of time until all cluster loadbalancers and proxies stop sending traffic to this pod. See kubernetes/kubernetes#43576 (comment) and https://blog.gruntwork.io/delaying-shutdown-to-wait-for-pod-deletion-propagation-445f779a8304 for details.

Delay depends on size of the cluster. Use the following command from different pod to test traffic failures during rolling update: while true; do curl -sSO SERVICE_IP/healthz; echo -n '*'; done.

This Admission Webhook adds Pod preStop hook with some delay:

lifecycle:
  preStop:
    httpGet:
      host: <service-ip>
      path: delay
      port: 80
terminationGracePeriodSeconds: 40  # default 30 + delay 10

It also increases terminationGracePeriodSeconds with that delay.

Installation

See Kubernetes docs.

Usage

Add pod template annotation k8s.smp.io/delayed-termination=true to your workloads and new pods will modified.

About

Admission Webhook that adds Pod preStop hook with some delay

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages