Kubernetes: how best to autoscale nodes containing websocket connections?

4/14/2020

Is there support for autoscaling nodes where the pods only contain websockets used for push notifications back to the client? I suspect we would likely be hitting connection constraints before either CPU or memory limits are hit. Please correct me if others have different experiences here.

The main issue I see is the persistent nature of the connections - pods that contain active websockets must remain intact when down-scaling and tenancy is not relocatable.

So my questions here are these:

  1. is this support available? Would we want to make these statefulsets? I am not even sure what model works best here.
  2. would we want to use Kubernetes services to route incoming websocketconnections to the worker nodes? If so, how would we set the kube-proxy to respect and ignore those worker nodes whose connections limits have been reached and thus should not get new connection requests?
  3. how do we autoscale based upon a configurable limits on the number of connections maintained by a pod? How do we scale down without destroying any nodes that have > 1 active connections?

Thanks in advance for all tips/pointers, especially any advice on how to best ask these questions.

-- Fraser Hutchinson
autoscaling
kubernetes
websocket

0 Answers