How to restart multiple spring boot app instances of a kubernetes service

Bilal Issa :

I have a load balanced deployment of spring boot service A, say on a 3 node kubernetes cluster.

I also have a requirement to enable quick configuration management without needing to rebuild+deploy a full blown rebaked image.

For that I put together a spring boot config-server, as well as implemented the Actuator restart on service A which when calling its /restart endpoint on a local single instance deployment it refreshes and loads with the properties fetched from the config-server.

So far so good, but...

How can the above be achieved when service A is deployed on a larger scale k8s deployment with 3, 30 or 300 instances of service A?

Calling /refresh endpoint must be handled by the load balancer as any other REST call on the cluster, meaning it is routed to one of the service instances.

Is there a standard way in springboot-on-k8s I can call each service instance ignoring the LB?

Bal Chua :

We don't really use the actuator's restart, instead what we do is, utilize the rollingUpdate strategy of deployment. When we want to "restart" the pods, we issue a kubectl patch.

kubectl patch deployment web -p  "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"`date +'%s'`\"}}}}}"

A good documentation of the upgrade strategy.

https://www.google.com/url?sa=t&source=web&rct=j&url=https://medium.com/platformer-blog/enable-rolling-updates-in-kubernetes-with-zero-downtime-31d7ec388c81&ved=2ahUKEwjIqtbW_bvfAhUKRY8KHas6DEkQjjgwAnoECAkQAQ&usg=AOvVaw3HjD4CUoG4ma3HWxquaYjp&cshid=1545776336374

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=98062&siteId=1