Home:ALL Converter>Graceful scaledown of stateful apps in Kubernetes

Graceful scaledown of stateful apps in Kubernetes

Ask Time:2020-07-07T12:58:43         Author:Balu R

Json Formatter

I have a stateful application deployed in Kubernetes cluster. Now the challenge is how do I scale down the cluster in a graceful way so that each pod while terminating (during scale down) completes it’s pending tasks and then gracefully shuts-down. The scenario is similar to what is explained below but in my case the pods terminating will have few inflight tasks to be processed.

https://medium.com/@marko.luksa/graceful-scaledown-of-stateful-apps-in-kubernetes-2205fc556ba9 1

Do we have an official feature support for this from kubernetes api.

Kubernetes version: v1.11.0

Host OS: linux/amd64

CRI version: Docker 1.13.1

UPDATE :

Possible Solution - While performing a statefulset scale-down the preStop hook for the terminating pod(s) will send a message notification to a queue with the meta-data details of the resp. task(s) to be completed. Afterwards use a K8 Job to complete the tasks. Please do comment if the same is a recommended approach from K8 perspective.

Thanks In Advance!

Regards, Balu

Author:Balu R,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/62768397/graceful-scaledown-of-stateful-apps-in-kubernetes
yy