Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature server registers the wrong IP address when running inside a AWS ECS fargate container. #876

Open
zscgeek opened this issue Aug 22, 2024 · 1 comment

Comments

@zscgeek
Copy link
Contributor

zscgeek commented Aug 22, 2024

We were running into a problem where if the feature server was running on AWS fargate ECS it would get the wrong ip address returned. The issue is the first network card in a fargate container is amazon's metadata network. The result is that the node ip.address() function would return that IP, instead of the IP that is on the VPC. We need a way to override the IP that gets registered and published.

See #875 for the fix.

@zscgeek
Copy link
Contributor Author

zscgeek commented Aug 22, 2024

FYI this is the networking config inside the container

eth0      Link encap:Ethernet  HWaddr 0A:58:A9:FE:AC:02
          inet addr:169.254.172.2  Bcast:0.0.0.0  Mask:255.255.252.0
          inet6 addr: fe80::84ba:a9ff:fece:e4bc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:136 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:104206 (101.7 KiB)  TX bytes:13576 (13.2 KiB)

eth1      Link encap:Ethernet  HWaddr 02:ED:BD:8A:60:07
          inet addr:10.0.193.0  Bcast:0.0.0.0  Mask:255.255.192.0
          inet6 addr: fe80::ed:bdff:fe8a:6007/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:9001  Metric:1
          RX packets:607402 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48312 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:985259937 (939.6 MiB)  TX bytes:17929481 (17.0 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:75090 errors:0 dropped:0 overruns:0 frame:0
          TX packets:75090 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8727188 (8.3 MiB)  TX bytes:8727188 (8.3 MiB)

/opt/app # 

What the PR in place we then can correctly configure things upon startup using the AWS API's (snippet below). This also allows on-premise advanced networking configurations where auto detection fails.

metadata=$(wget -qO- $ECS_CONTAINER_METADATA_URI_V4)

# Parse the JSON and extract IP addresses using jq
export HTTP_IP=$(echo $metadata | jq -r '.Networks[].IPv4Addresses[]' | tail -1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant