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

Envoy config doesn't like 0.0.0.1 #2

Closed
Heraclitus opened this issue Apr 13, 2020 · 3 comments · Fixed by #4
Closed

Envoy config doesn't like 0.0.0.1 #2

Heraclitus opened this issue Apr 13, 2020 · 3 comments · Fixed by #4

Comments

@Heraclitus
Copy link

Results found on both envoy image versions I tried (1.11.1 and 1.14.1)

docker-compose up --remove-orphans --build --force-recreate
...
envoy_1    | [2020-04-13 13:59:48.274][1][info][main] [source/server/server.cc:340] admin address: 0.0.0.1:9000
envoy_1    | [2020-04-13 13:59:48.275][1][critical][main] [source/server/server.cc:95] error initializing configuration '/etc/envoy/envoy.yaml': cannot bind '0.0.0.1:9000': Cannot assign requested address
envoy_1    | [2020-04-13 13:59:48.275][1][info][main] [source/server/server.cc:606] exiting
envoy_1    | cannot bind '0.0.0.1:9000': Cannot assign requested address
test_envoy_1 exited with code 1

When I changed your envoy config to use 0.0.0.0 and it seems to work fine

admin:
  access_log_path: /dev/null
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 9000

and I run compose

envoy_1    | [2020-04-13 14:03:39.636][1][info][main] [source/server/server.cc:322] admin address: 0.0.0.0:9000
envoy_1    | [2020-04-13 14:03:39.639][1][info][main] [source/server/server.cc:432] runtime: layers:
envoy_1    |   - name: base
envoy_1    |     static_layer:
envoy_1    |       {}
envoy_1    |   - name: admin
envoy_1    |     admin_layer:
envoy_1    |       {}
@UmutComlekci UmutComlekci added bug Something isn't working investigating and removed bug Something isn't working labels Apr 13, 2020
@UmutComlekci
Copy link
Owner

Is there any application using port 9000? It's work both configuration in my computer

@Heraclitus
Copy link
Author

@UmutComlekci Here is a recent repro with result from lsof

Error from recent run of compose w/envoy config having 0.0.0.1

envoy_1    | [2020-04-18 14:51:29.243][1][critical][main] [source/server/server.cc:93] error initializing configuration '/etc/envoy/envoy.yaml': cannot bind '0.0.0.1:9000': Cannot assign requested address
envoy_1    | [2020-04-18 14:51:29.243][1][info][main] [source/server/server.cc:560] exiting

Immediately after that error I issued the lsof command below

sudo lsof -i -P -n | grep LISTEN
[sudo] password for alfreds: 
systemd-r  680 systemd-resolve   13u  IPv4  33851      0t0  TCP 127.0.0.53:53 (LISTEN)
cupsd      715            root    6u  IPv6  33759      0t0  TCP [::1]:631 (LISTEN)
cupsd      715            root    7u  IPv4  33760      0t0  TCP 127.0.0.1:631 (LISTEN)
container  810            root    8u  IPv4  41095      0t0  TCP 127.0.0.1:39811 (LISTEN)
java      2581         alfreds   50u  IPv4  46032      0t0  TCP 127.0.0.1:6942 (LISTEN)
java      2581         alfreds  378u  IPv4  50961      0t0  TCP 127.0.0.1:63342 (LISTEN)
docker-pr 4884            root    4u  IPv6  73252      0t0  TCP *:4000 (LISTEN)
docker-pr 4932            root    4u  IPv6  75956      0t0  TCP *:8123 (LISTEN)

I don't see anything else on 9000. Now maybe you meant 9000 inside the docker compose network? If so I'm not sure how to check that.

Just to confirm my previous workaround, I changed the address for envoy conf from 0.0.0.1 to 0.0.0.0

  access_log_path: /dev/null
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 9000

and success

envoy_1    | [2020-04-18 14:58:31.303][1][info][main] [source/server/server.cc:322] admin address: 0.0.0.0:9000
envoy_1    | [2020-04-18 14:58:31.304][1][info][main] [source/server/server.cc:432] runtime: layers:

I can curl with your example curl

updated lsof after using 0.0.0.0 for envoy.

sudo lsof -i -P -n | grep LISTEN
systemd-r  680 systemd-resolve   13u  IPv4  33851      0t0  TCP 127.0.0.53:53 (LISTEN)
cupsd      715            root    6u  IPv6  33759      0t0  TCP [::1]:631 (LISTEN)
cupsd      715            root    7u  IPv4  33760      0t0  TCP 127.0.0.1:631 (LISTEN)
container  810            root    8u  IPv4  41095      0t0  TCP 127.0.0.1:39811 (LISTEN)
java      2581         alfreds   50u  IPv4  46032      0t0  TCP 127.0.0.1:6942 (LISTEN)
java      2581         alfreds  378u  IPv4  50961      0t0  TCP 127.0.0.1:63342 (LISTEN)
docker-pr 5600            root    4u  IPv6  81689      0t0  TCP *:8080 (LISTEN)
docker-pr 5617            root    4u  IPv6  84019      0t0  TCP *:8001 (LISTEN)
docker-pr 5646            root    4u  IPv6  81778      0t0  TCP *:8123 (LISTEN)
docker-pr 5692            root    4u  IPv6  84482      0t0  TCP *:4000 (LISTEN)

curl command

curl -vv -w "\n"  http://localhost:8080/
*   Trying ::1:8080...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.65.3
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< content-length: 46
< content-type: text/plain
< x-custom-header-from-lua: bar
< date: Sat, 18 Apr 2020 15:00:02 GMT
< server: envoy
< 
* Connection #0 to host localhost left intact
Authorization Header malformed or not provided

UmutComlekci added a commit that referenced this issue Apr 26, 2020
@UmutComlekci UmutComlekci linked a pull request Apr 26, 2020 that will close this issue
@UmutComlekci
Copy link
Owner

I couldn't understand the cause of the error but I think, I fix it. Thank you very much

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

Successfully merging a pull request may close this issue.

2 participants