pythondockernetflix-eureka

Could not connect to dockerized service which registered in eureka server


Here is eureka_client.init:

eureka_client.init(
    eureka_server="http://<EUREKA_SERVER_IP>:8070/eureka",
    app_name="<EUREKA_APPNAME>",
    instance_port="<API_PORT",
    instance_ip="<MACHINE_IP>",
)

At the first my fastapi application registered with docker range ip address (172.19...) in eureka. Then tried to set instance_ip parameter to my machine ip address. But still could not call service from gateway. (Docker exposed port works correctly)

Note: Unfortunatly i have not access to eureka server machine to check gateway logs.

py-eureka-client 0.11.10
python 3.10

Any help is appriciated


Solution

  • Solved with bellow eureka client config:

    Eureka client configuration

    eureka_client.init(
        eureka_server=envs["EUREKA_URL"],
        app_name=envs["EUREKA_APPNAME"],
        instance_port=int(envs["API_PORT"]),
        instance_ip=envs["HOST_IP_ADDRESS"],
        instance_host=envs["HOST_IP_ADDRESS"],
        renewal_interval_in_secs=5
    )