Can Kubernetes scale down but avoid disconnecting users?

8/14/2020

I want to be able to scale down without disconnecting any users.

This would be especially useful for a stateful application like mine where users connect and stay connected over websockets.

One idea: perhaps it could not allow any new users to a particular pod, then once that pod is empty of users it then shuts that pod down? That way it would wait for users to disconnect on their own time.

Another idea: kubernetes could tell my pod that it wants to shut the pod down, but the pod could respond with a 'snooze' until it's ready to be shut down? In my use case that would mean checking that all of the users in the pod have disconnected.

How would I go about implementing one of these, or another solution to solve the problem?

I’m using Node.js and Kubernetes on Google Cloud Platform.

-- BrettYeager
google-kubernetes-engine
kubernetes

0 Answers