Linkerd ECS Hello World Example Question


#1

Hello. I am attempting to setup the ECS hello world example and have a few questions about the task definition. Here

There are a few lines that I am struggling to understand. Mostly:

"command": [
    "LOCAL_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) http_proxy=$LOCAL_IP:4140 
        POD_IP=$LOCAL_IP helloworld -addr=:1234 -text=Hello -target=world"
 ],

Is there explanation of this command anywhere? I’m also wondering what POD_IP is doing?

I would like to understand the setup in the task definitions as well the necessary dtabs config to get this working. I am attempting to setup in a env with linkerd / namerd / consul. Currently consul can see the services running ( hello, world, world_v2 ) but I am unable to connect to them via:

http_proxy=$SERVER_IP:4140 curl hello
Unknown destination: Request("GET /", from /x.x.x.x:50340) / not enough segments in path

From this error message I know i need to edit my internal dtabs config which is currently:
namerd/dtabs/internal

# Do not modify these!
/consul => /#/io.l5d.consul/.local;

/env => /consul/myTestEnv;
/namerd-admin => /$/inet/127.0.0.1/9991;
# These are for specific deployment types
/blue => /consul/blue;
/green => /consul/green;

# These are the services that are deployed

Does anyone have any insight on how to set this up? Have been looking for an article to give some insight but so far nothing is sticking. Any insight or reference to helpful articles would be greatly appreciated. Thanks.


#2

Hi @carlislk,

"command": [
    "LOCAL_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) http_proxy=$LOCAL_IP:4140 
        POD_IP=$LOCAL_IP helloworld -addr=:1234 -text=Hello -target=world"
 ],

Is there explanation of this command anywhere?

LOCAL_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4) is an EC2-specific method of retrieving the host system’s IP address. For more information, have a look at the EC2 docs:
https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/using-instance-addressing.html

We use LOCAL_IP to set the http_proxy environment variable (http_proxy=$LOCAL_IP:4140). This directs the helloworld sample app to proxy all HTTP requests through $LOCAL_IP:4140, which in this case will be the Linkerd instance running on that same host. This enables Linkerd as a service mesh for the helloworld application. For more info on Linkerd’s HTTP proxy functionality, have a look at:

I’m also wondering what POD_IP is doing?

In this case POD_IP is used by the helloworld application to display additional IP address information on responses. For more detail on that, have a look at:

Regarding the linkerd / namerd / consul setup you are describing, it’s difficult to debug without full access to all the details of your particular configuration. I’d recommend following the instructions laid out in https://linkerd.io/getting-started/ecs/, validate that this configuration works first, then start making adjustments based on your particular requirements.


#3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.