estafette / estafette-gke-preemptible-killer

Kubernetes controller to spread preemption for preemtible VMs in GKE to avoid mass deletion after 24 hours

Home Page:https://helm.estafette.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] how does drain-timeout work?

williamli opened this issue · comments

How does drain-timeout work? Does it affect the time between the sending of SIGTERM to pods and actual node deletion?

Hi @williamli, it depends on both the --drain-timeout flag and the value defined via in the deployment configuration pod.spec.terminationGracePeriodSeconds. By default, both values are set to 300seconds. If you send a SIGTERM to the estafette-gke-preemptible-killer pod while draining a node, then Kubernetes will wait a maximum of 300seconds before force killing the pod. If the draining process finish before that, then the pod is gracefully shut down.

The logic is defined in the following file:
https://github.com/estafette/estafette-gke-preemptible-killer/blob/master/kubernetes.go#L160-L245

Thanks