1

We have an application that's receiving calls from other services that use Eureka to discover the different IP addresses of the different application instances/replicas.

When deploying a new version of this app, our deployment system (kubernetes in our case) sends a SIGTERM to one of the instances of the application to shut it down.

But the Eureka client in the services sending requests to the application, keeps a local cache of Eureka's information. Meaning that these applications won't realize that the instance of the app has been shutt down, and they will continue to send requests to an instance that is no longer working.

Is there a way to make a Spring Cloud application to wait for some seconds before shutting down to make sure that all clients have the updated Eureka information (where this app won't be listed anymore)?

Jose Armesto
  • 12,794
  • 8
  • 51
  • 56

1 Answers1

0

If you're using Kubernetes then you could map a Service to each of the apps/services that register with eureka and tell the apps to register using the service name instead of an IP. Then you can manage the blue/green deploy with Kubernetes (provided you've got probes set up). Eureka will then just know about the Service names and whether something is registered for them and Kubernetes will be managing availability during the upgrade. It's a bit of a hybrid model.

If you are removing an app or changing the name rather than upgrading then I think you'll need to set a lease time for the eureka registration data. Eureka never unregisters a service

Ryan Dawson
  • 11,832
  • 5
  • 38
  • 61
  • I have applications running outside kubernetes, so I can't register on Eureka using the kubernetes Service – Jose Armesto May 09 '18 at 14:07
  • Yeah I see. In that case the external service doesn't know its name within kubernetes so it can't register using that. Presumably you could set up a Kub service using externalIPs to give it a service name but the service itself still wouldn't know what that name is. – Ryan Dawson May 10 '18 at 17:41