0

I have a question with kubernetes when deploying a new version.

My yaml configuration of Kubernetes has the RollingUpdate strategy. The problem comes when it comes to changing versions this way. If I have a php-fpm that is performing an action, does that action get lost? In case it is just changing that pod to the new version.

My main question is if kubernetes with this strategy takes into consideration if the pod is being used and if so, if it waits until he finishes what it has to do and changes it.

Thanks!

  • As per this K8s document about how generally pods are terminated, you can use PreStop container hooks as indicated in this document with a desired grace period. – Fady Oct 6 '18 at 2:03
  • What does php-fpm do when it gets a SIGTERM? There is your answer. – Michael Hampton Oct 6 '18 at 12:37
  • @MichaelHampton It's what the container does before it kills the pod. – Sermanes Oct 6 '18 at 15:53
0

To expand on what @Fady said above, for those that still may be curious.

By calling the PreStop container hook you can close all loose ends before the container is terminated. From the documentation "PreStop: This hook is called immediately before a container is terminated." [1]

The PreStop hook can execute a specific command(s) or executes an HTTP request against an endpoint on the container. Additionally, the standard grace period is 30 seconds. You can, however, pass a custom time by appending --grace-period=<seconds>. [2]

[1] https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks

[2] https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.