Reddy_73
Reddy_73

Reputation: 134

Does prestop hook wait for command execution in all the replicas?

we have a deployment with hpa(horizontal pod autoscaling) of maxReplicas set to 3. And in our deployment.yaml we have a preStop hook defined, which calls an API exposed in the container and a terminationGracePeriodInSeconds defined to 60 seconds(the calls are internal to the cluster and should be sufficient). Is it guaranteed that the preStop hook waits for the execution of the request from all three pods?

     lifecycle:
       preStop:
         exec:
           command: [ "curl", "-XPOST", http://$SERVICE_NAME:$PORT_NUMBER/exit-gracefully ]
   terminationGracePeriodSeconds: 60  ```

Upvotes: 0

Views: 520

Answers (1)

gohm'c
gohm'c

Reputation: 15500

No guaranteed as the official document stated:

The Pod's termination grace period countdown begins before the PreStop hook is executed, so regardless of the outcome of the handler, the container will eventually terminate within the Pod's termination grace period.

Upvotes: 2

Related Questions