foriequal0 / pod-graceful-drain

You don't need `lifecycle: { preStop: { exec: { command: ["sleep", "30"] } } }`
Apache License 2.0
246 stars 16 forks source link

Does we need to tweak any other variable to make this work #39

Closed jyotibhanot closed 2 years ago

jyotibhanot commented 2 years ago

Do we need to adjust terminationGracePeriodSeconds or any other value? I am trying to achieve zero downtime deployment using IP as targets as mentioned in the posts

https://easoncao.com/zero-downtime-deployment-when-using-alb-ingress-controller-on-amazon-eks-and-prevent-502-error/ Do I need to adjust any variable in target group like deregistration delay to make this work?

foriequal0 commented 2 years ago

I've created this package to avoid adjusting terminationGracePeriodSeconds. You can adjust it if you want to.

jyotibhanot commented 2 years ago

It is 100 seconds, I will see if I have to adjust it. What is it doing behind the scenes, can you tell me a bit? thanks for the prompt response.

foriequal0 commented 2 years ago

It does what is written in README.

pod-graceful-drain solves this by abusing admission webhooks. It intercepts the deletion/eviction of a pod deletion/eviction process to prevent the pod from getting terminated for a period. It'll take appropriate methods to delay the pod deletion: deny the admission, response the admission very slowly, mutate the eviction request to dry-run, etc. Then the pod will be eventually terminated by the controller after designated timeouts. With this delay, traffics are drained safely since the pod is still alive and can serve misdirected new traffics.

https://github.com/foriequal0/pod-graceful-drain/blob/main/README.md#what-is-this