Websockets and kubernetes?

Hello I have just seen the k8s integration kit.
I’m wondering if vaadin push via websockets works in this scenario or what the supported server push options are

The kit doesn’t provide anything for websockets

Websockets in K8S may have issues with the Ingress and would requires session affinity

But I’m not a K8S expert

Thanks. It’s my impression too that k8s isn’t a solution for this, and when we do session affinity (sticky sessions) then we loose the transparent failover

If you really need the failover and if loosing the session is really a problem

For example if you use token based security then loosing the session may not be a huge problem

The newly added Kubernetes supports scaling down and failover, without impacting the experience of end users.

That is, under most cases, end users will not even notice that a node has failed or that it has been scaled down. Users will continue to work normally, even if server push is configured.

The Kubernetes Kit uses a combination of sticky sessions and session replication to enable scaling up/down and high availability. Under normal circumstances, sticky sessions is used to always route the same user to the same node/pod. A node/pod will keep the sessions of the users currently connected to it in memory, and it will also asynchronously replicate the session to the distributed cached (Hazelcast or Redis). Under normal circumstances, thus, the user experience shouldn’t be negatively affected as the session is retrieved from the internal memory of each node/pod.
However, when there is a scaling down event, or if there is an unexpected node/pod/network failure in the server the user is currently being connected to, then the user will be connected to a new healthy node/pod that will retrieve the session from the distributed cache. So for the end user, the experience will be seamless (they will not notice that anything has happened, except perhaps for a very slight delay when scaling down or a node failure event occurs).

(That of course can only work if you make sure that all data you have in your views / session are serializable or correctly added transient like e.g. Services)


The Kubernetes Kit also offers “Serialization helpers” to make it easier to make the Vaadin Session serializable:



@practical-rat thanks for the clarification. It goes further than I expected. As for many years session replication was not recommended.

:+1: session replication was not recommended because it was quite tricky to make the process work in a way that is both (a) reliable, and (b) performant. The new Kubernetes Kit (and the Azure Cloud Kit, which is currently also K8s-based) solve this by combining sticky sessions with the asynchronous backup of the sessions to a distributed cache (e.g., Hazelcast) with several other architectural tweaks to ensure that the session replication while reliable, is not negatively affecting the performance of the app (and hence, not negatively affecting the experience of end users).