Migrating Spring Cloud Microservices to Isito
Scenario
This section describes how to migrate microservices developed using Spring Cloud to Kubernetes and Istio during container-based reconstruction to leverage the service governance capabilities provided by the infrastructure.
Migration Scheme
- Adapt the Spring Cloud microservice.
Modify the Spring Cloud microservice configurations to divert the traffic of these microservices to the Istio proxy.
You only need to modify the application.yml configuration file in the \client\src\main\resources and \server\src\main\resources directories in the microservice package. There is no need to modify service code.

Specifically:
- 1. Delete the Eureka connection configuration. The Eureka registration center is no longer connected.
- 2. Configure information about the microservices to be called.
- 3. Disable Eureka service registration, service discovery, and Hystrix.
Modifications 1 and 3 disable the original microservice governance function in Spring Cloud, and only modification 2 is used to configure the service to be accessed.
- Replace SpringCloud microservice capabilities with Istio
Based on the service governance capabilities provided by Spring Cloud, perform the corresponding operations as described in Table 1.
For some Spring Cloud capabilities, such as service discovery and load balancing, they can be discarded. For other capabilities, such as circuit breakers, they can be disabled and replaced by corresponding Istio capabilities.
Table 1 Operations after migration to Istio Spring Cloud Capability
Introduction
Configuration Example
After Migration to Istio
Service Discovery: Eureka Clients
Service registration and discovery by SDKs
eureka: client: serviceUrl: defaultZone: http://localhost:8761/eureka/
Discarded. Istio-based service discovery does not require service registration.
Service Discovery: Eureka Server
Eureka service registration center
server: port: 8761 eureka: client: registerWithEureka: false fetchRegistry: false server: waitTimeInMsWhenSyncEmpty: 0Discarded. Kubernetes-based service discovery requires no service registration center.
Circuit Breaker: Hystrix Dashboard
Metrics of HystrixCommand
hystrix.command.default.metrics.rolling Stats.timeInMilliseconds hystrix.command.default.metrics.rolling Stats.numBuckets hystrix.command.default.metrics.rolling Percentile.enabled
Istio telemetry provides more metrics and access log tracing.
HystrixTimeoutsAndRibbonClients
Hystrix timeout and other configurations
hystrix.command.default.circuitBreaker. enabled hystrix.command.default.circuitBreaker. requestVolumeThreshold hystrix.command.default.circuitBreaker. sleepWindowInMilliseconds hystrix.command.default.circuitBreaker. errorThresholdPercentage
Istio's outlier detection and circuit breakers can be used to provide the similar functions. Hystrix timeout and other configurations can be reserved if they are being used in customer-specific scenarios.
Client SideLoadBalancer:Ribbon
Load balancing on the client side
users: ribbon: NFLoadBalancerRuleClassName: com.netflix.loadbalancer.WeightedResponseTim eRuleDiscarded.
Router andFilter: Zuul
Service gateway
zuul: routes: users: path: /myusers/** serviceId: users_serviceReplaced by Istio Gateway.
PolyglotsupportwithSidecar
Sidecar
-
Discarded.
RetryingFailedRequests
Retry
clientName: ribbon: retryableStatusCodes: 404,502Istio supports fine-grained retry configuration.
Last Article: Upgrading Data Plane Sidecars Without Service Interruption
Next Article: Permission
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.