Reputation: 731
I have two simple Springboot microservice which connect with each other using Spring Eureka.
Steps -
I want to achieve the same in Openshift v3. I know Openshift uses Kubernates Service for achieving load-balancing & pod-discovery. But can I use Eureka server in Openshift?
In Openshift I have 3 pods..
But in Eureka, it is registering as microservice's pod IP:PORT.
So when discovering the microservice tries to make the call to POD IP & fails.
Generally, to access POD IP we need to invoke service layer in Openshift. So how can I make eureka server register server layer IP:PORT instead of POD's IP:PORT
Upvotes: 2
Views: 6160
Reputation: 1194
for Spring Cloud Eureka Server project:application.yml
server:
port: 8761
eureka:
instance:
hostname: server.eureka.svc # it should be service url in openshift cluster.
client:
fetch-registry: false
register-with-eureka: false
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
For Spring Cloud Eureka Client project: application.yml
eureka.client.serviceUrl.defaultZone=http://server.eureka.svc8761/eureka/
eureka.instance.preferIpAddress=false
Upvotes: 2