DevOps Asked by pulse00 on August 22, 2021
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:
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?
Modern way to achieve seamless roll-out in this scenario is not on the load balancing (i.e. haproxy) side, but instead via proper deployment planning, backward compatibility and/or feature flags.
The issue with load-balancer tinkering is that in the end of day even if you get sticky sessions right it's not going to solve your problem. The reason for that - imagine a user that opened your app in a browser with old react. Underneath, you deploy new java back-end. If the user doesn't reload her browser - she's still going to use old react app with new back-end no matter what (just because javascript is already loaded to the browser).
Instead, look at following example how you can achieve it using API versioning:
Here is how you can solve it:
As you can see, in the above approach, version conflict is avoided and experience is seamless.
P.s. You might want to consider splitting your docker image in 2 - it's a little odd to have a multi-purpose image with 2 entrypoints. There may be little justification for this design.
Correct answer by taleodor on August 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP