These are chat archives for spring-cloud/spring-cloud

25th
Oct 2018
Patrick Gotthard
@PatrickGotthard
Oct 25 2018 08:48
hi. can somebody tell me how the com.netflix.discovery.DiscoveryClient discovers the hostname? org.springframework.cloud.commons.util.InetUtils is finding the correct hostname and ip address, but the instance id uses a wrong hostname from a network interface that should be ignored
IamZeek
@ziaur25
Oct 25 2018 08:53
You can set hostname via eureka.instance.hostname property
Patrick Gotthard
@PatrickGotthard
Oct 25 2018 08:54
@ziaur25 I know, but I don't want to set the hostname per instance
In the eureka dashboard there is an entry like "app-dev1:test:8085" pointing to "app-d11:8085/actuator/info"
app-dev1 is a loadbalancer address that can be discovered from the lo interface (which should be excluded)
the correct hostname is app-d11 which is correctly linked
i wonder why the address is correctly linked but the instance id uses another hostname
Marcos Barbero
@marcosbarbero
Oct 25 2018 08:57
@PatrickGotthard have you ignored network interfaces that shouldn't be picked up? https://cloud.spring.io/spring-cloud-static/spring-cloud.html#ignore-network-interfaces
Patrick Gotthard
@PatrickGotthard
Oct 25 2018 08:57
yes
spring.cloud.inetutils.ignored-interfaces: lo
even when i'm setting a preferred ip address in bootstrap.yml the instance id will be constructed from the hostname of another ip
Marcos Barbero
@marcosbarbero
Oct 25 2018 08:59
do you have a sample app so I can try to run it here?
Patrick Gotthard
@PatrickGotthard
Oct 25 2018 09:00
that would only work on our machines
the lo interface has some additional loadbalancer ips
afk for a whil --> daily standup ;)
Patrick Gotthard
@PatrickGotthard
Oct 25 2018 09:10

ip a l

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
inet 10.196.57.143/32 scope global lo
inet 10.196.57.195/32 scope global lo
inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UNKNOWN qlen 1000
link/ether 00:50:56:96:24:ce brd ff:ff:ff:ff:ff:ff
inet 10.196.68.2/25 brd 10.196.68.127 scope global eth0
inet6 fe80::250:56ff:fe96:24ce/64 scope link
valid_lft forever preferred_lft forever

InetUtils finds the correct ip (10.196.68.2) and hostname from eth0
but the instance id uses the hostname of an ip address from the lo interface (10.196.57.143)
seems like ${spring.cloud.client.hostname} contains the wrong hostname
Patrick Gotthard
@PatrickGotthard
Oct 25 2018 09:40
moving the ignored-interfaces to bootstrap.yml solved my problem :)
Fabricio
@ofabricio
Oct 25 2018 16:59
does anyone know What's the difference between zuul.ignoredHeaders and zuul.sensitiveHeaders properties in zuul?