Sorry it took so long to get back to this. I don't think this has much to do with public vs. private ip addresses. It is more of an issue of using hostnames vs. IP's.
This is what I found (using all defaults for Ribbon and Eureka not specifying a specific datacenter type):
Eureka -
PropertiesInstanceConfig and AbstractInstanceConfig
- Captures service instance data via AbstractInfoConfig.getHostInfo() - hostname via InetAddress.getLocalHost().getHostName(), ip address via InetAddress.getLocalHost().getHostAddress()
- stores host address in InstanceInfo.ipAddr, stores host name in InstanceInfo.hostName, also defaults the various urls (homepage, statuspage, healthcheck) based on the host name (via ${eureka.hostname} replacement in InstanceInfo$Builder
- So by default a majority of the service instance information (except for ipAddr) in Eureka is based on host name
Ribbon (ribbon-eureka specifically) -
DiscoveryEnabledNIWSServerList.obtainServersViaDiscovery
- Queries Eureka based on vipAddress, gets a list of InstanceInfo objects, and creates a DiscoveryEnabledServer (extends Ribbon's Server class) list
- When DiscoveryEnabledServer is constructed it calls the constructor with the InstanceInfo host name and port (and secure port) discovered out of Eureka
- This means when Ribbon load balances by default it does hostname1:port, hostname2, port (vs. ip1:port, ip2:port) based routing
This means that by default all Eureka enabled Ribbon routing is dependent on DNS names gathered on service instances being resolvable on all callers. I don't think the AmazonInfo class really helps this as while it provides more information (as does our DataCenter extension for SoftLayer), it doesn't change how Ribbon interacts with the returned Eureka information.
Can you confirm that your Netflix specific Ribbon plugins route based on something other than InstanceInfo.hostname or AmazonInfo.publicHostName? I'd have to imagine based on the issues I've seen with DNS in Amazon that you'd want to route more on AmazonInfo.local-ipv4.
Also, this applies for the URL's as well. For Asgard and Eureka console to work with the URL's specified (statuspage, homepage, healthcheck url), you'd think you'd use IP's as well. Can you clarify if there are additional changes to Asgard and Eureka console to somehow pay attention to ip addresses vs. hostnames?
In general after researching I'm confused why Eureka as a discovery service for micro services would encourage use of DNS hostnames as it then adds that as a dependency that is outside of the service discovery contract between the service query client and the service implementation registration. I think Ribbon is purely a user of the data and not really the issue. If I understand this right, I'd suggest (as we've done in our changes for SoftLayer) that:
All connectivity information in Eureka should be ip address based with metadata about service instance locally known hostnames. Likely this metadata about hostname would never be used unless services were somehow DNS load balanced. All Eureka based routing would be based on the ip addresses stored in place of the hostnames.