Search code examples
kubernetescontainershpahorizontalpodautoscaler

How does the scale function in Kubernetes ensure that the current task or request is completed when scaling down?


Will unfinished tasks in the container be terminated when scaling down in Kubernetes?


Solution

  • Will unfinished tasks in the container be terminated when scaling down in Kubernetes?

    Yes, to manage it you have a few options or best practices to follow.

    You can check for termination with grace

    Default value is 30 seconds so if it's taking longer than 30 seconds make sure you are setting it.

    Add and manage the terminationGracePeriodSecond into the YAML config

    https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-terminating-with-grace