Closed nfedyk closed 6 years ago
Why did you set eureka.instance.prefer-ip-address: false
(seems inconsistent with spring.cloud.inetutils.preferredNetworks
)?
I got it from old issues in this project. This property is being enforced as expected, I will try it in camel cased version as well. I have issue only with spring.cloud.inetutils.preferredNetworks
.
We get the same behavior regardless of eureka.instance.prefer-ip-address: false|true
. Some services pick up the ingress network IP, others the 10.0.x.x
ip (which is expected). So some services can connect and others can't. It seems wildly inconsistent. Per the example above.
in eureka discovery (eureka/apps) some nodes list like this
INGRESS ip....<instanceId>10.255.0.6:my-service:8080</instanceId>
while yet others like this
HOSTNAME....<instanceId>63c567e1f4ff:my-service:8080</instanceId>
All of these nodes boot w/
spring.profiles: docker-network-stage
eureka.instance.prefer-ip-address: true
spring.cloud.inetutils.preferredNetworks:
- 10.0
They are all on the same overlay network, as a swarm service...
And some instances subsequently with
<hostName>10.255.0.16</hostName>
while others instances for same service with
<hostName>10.0.0.14</hostName> *EXPECTED
We even tried the below ( where eth0 is the ingress swarm network 10.255.x that discovery SHOULD not report)
spring.profiles: docker-network-stage
eureka.instance.prefer-ip-address: true
spring.cloud.inetutils.preferredNetworks:
- 10.0
spring.cloud.inetutils.ignoredInterfaces:
- eth0
We effectively cannot run this app on a swarm service across more than a one node swarm cluster because of this. Ideas? Are there other options we are missing here?
The only way we can get this to work is via system properties
-Deureka.instance.prefer-ip-address=true
-Dspring.cloud.inetutils.preferredNetworks=10.0
-Dspring.cloud.inetutils.ignoredInterfaces=eth0
So are these bootstrap properties only? Perhaps we missed this in the docs or its not there. I didn't see it.
The configs above are in the YML file served from the config server
When are you registering with eureka? Is that happening during bootstrap? E.g. do you need eureka to locate the configserver?
The config server comes up w/out eureka but does eventually register once the eureka server is up.
2 eureka nodes are started and they register w/ themselves, and get their configs from the config server.
N other application services, register w/ eureka and then discover their config server via eureka, so yes I would assume maybe the issue is that since that config above was previously in an application.yml file (served from config server) it was not taking effect until AFTER discovery registration which would make sense as to why we were seeing that odd random selection of the IP's to pick
It appears that specifying via system props (or I guess it could be hardwired in a bootstrap config w/ the container) then that is avoided and the correct ips are chosen prior to talking to discovery.
Perhaps something more clear in docs could mention this scenario/requirement (i.e. the settings above as boostrap props). Or it is already there and we missed it.
Config gathered via config server is to late if you are using eureka to find config server.
Yeah, it's obvious when you think about it. Where do you think the right place is to add documentation?
I'm might add a short note here http://cloud.spring.io/spring-cloud-static/spring-cloud.html#ignore-network-interfaces as docker containers are already mentioned. Just a short reminder of setting as a boostrap property vs one fetched via config server (esp if using discovery to find the config server)
Closing this due to inactivity. Please re-open if there's more to discuss.
I'm using Spring Cloud Camden.SR2 with Spring Boot 1.4.2.RELEASE running in docker 1.12 with swarm mode enabled. I have
ingress
network created within swarm.When inside application container network looks this way:
Spring Clioud application is being started with following configuration:
I run 6 services with 2 replicas per service. When I look at
/eureka/apps
endpoint to check services configuration I see mix of container ids and ip addresses eventhou my config directly states to use names only withprefer-ip-address: false
setting.Sample output
I wonder why do some services identify using
10.255.0
subnet and improperly register themselve with eureka services. Is there any way to enforce all sevice to abide thepreferredNetworks
setting?