My team (full stack) team develops single-page web applications using react as a client and spring-boot java apps as back-end.
We deploy the applications on kubernetes. However, we have troubles making rolling updates of the kubernetes pods seamless. Here's our packaging / deployment process:
- The CI pipeline builds a docker images packaging the java application as an executable jar file and the compile javascript/css assets that form the react client.
- That image has 2 entry points: one for starting the jar file (java back-end) and one which starts an nginx that serves the client assets (js/css).
- A haproxy cluster routes requests based on URL paths to either nginx or the java back-end.
This approach works fine so far.
However, during a rolling update, there will be a number of pods with an "old" java back-end. This leads to the situation that clients with a newly deployed version of the react client make requests to old java back-ends, because haproxy simply routes api traffic to any available java backend.
As i understand haproxy seems to have support for sticky-backends based on some rules, but this defeats the purpose of having a cluster of backends for load-balancing.
How do others tackle this problem?