{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/consul/issues/4868","repository_url":"https://api.github.com/repos/hashicorp/consul","labels_url":"https://api.github.com/repos/hashicorp/consul/issues/4868/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/consul/issues/4868/comments","events_url":"https://api.github.com/repos/hashicorp/consul/issues/4868/events","html_url":"https://github.com/hashicorp/consul/issues/4868","id":375087673,"node_id":"MDU6SXNzdWUzNzUwODc2NzM=","number":4868,"title":"Consul Connect: Fails to register routes for Envoy?","user":{"login":"mmisztal1980","id":1357057,"node_id":"MDQ6VXNlcjEzNTcwNTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1357057?v=4","gravatar_id":"","url":"https://api.github.com/users/mmisztal1980","html_url":"https://github.com/mmisztal1980","followers_url":"https://api.github.com/users/mmisztal1980/followers","following_url":"https://api.github.com/users/mmisztal1980/following{/other_user}","gists_url":"https://api.github.com/users/mmisztal1980/gists{/gist_id}","starred_url":"https://api.github.com/users/mmisztal1980/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmisztal1980/subscriptions","organizations_url":"https://api.github.com/users/mmisztal1980/orgs","repos_url":"https://api.github.com/users/mmisztal1980/repos","events_url":"https://api.github.com/users/mmisztal1980/events{/privacy}","received_events_url":"https://api.github.com/users/mmisztal1980/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-10-29T15:55:58Z","updated_at":"2018-10-30T15:54:54Z","closed_at":null,"author_association":"NONE","body":"#### Overview of the Issue\r\n\r\nI've created a PoC environment for 2x .NET Core 2.1 Services communicating via Consul-Connect.\r\nThe entire setup relies on a consul server instance, which uses a **services.json** file to perform the registrations in a 'static' way. If I understand the process correctly, the sidecar proxies should retrieve their configuration from the consul-server after starting up.\r\n\r\nOnce the consul server container is healthy, 2x sidecar-proxies start. At this point the entire setup is healthy:\r\n![image](https://user-images.githubusercontent.com/1357057/47661580-95880a00-db99-11e8-9df8-2ddf09fa3524.png)\r\n\r\n\r\n![image](https://user-images.githubusercontent.com/1357057/47661639-bcded700-db99-11e8-9b64-b4b7796a9af0.png)\r\n\r\nWhen attempting to have **core-demo-api1** call **core-demo-api1** , I'm getting a 404 response.\r\nI've exposed **core-demo-api1-sidecar-proxy** 's port 19000 and obtained a config dump in which I do not see any routes defined to **core-demo-api2**, which I believe is the root cause for the communication issue between the 2 services. I believe I've followed the available documentation to the letter, so my situation can be a potential bug.\r\n\r\n```json\r\n{\r\n    \"configs\": [\r\n        {\r\n            \"@type\": \"type.googleapis.com/envoy.admin.v2alpha.BootstrapConfigDump\",\r\n            \"bootstrap\": {\r\n                \"node\": {\r\n                    \"id\": \"core-demo-api1-sidecar-proxy\",\r\n                    \"cluster\": \"core-demo-api1-sidecar-proxy\",\r\n                    \"build_version\": \"5d25f466c3410c0dfa735d7d4358beb76b2da507/1.8.0/Clean/RELEASE\"\r\n                },\r\n                \"static_resources\": {\r\n                    \"clusters\": [\r\n                        {\r\n                            \"name\": \"local_agent\",\r\n                            \"connect_timeout\": \"1s\",\r\n                            \"hosts\": [\r\n                                {\r\n                                    \"socket_address\": {\r\n                                        \"address\": \"127.0.0.1\",\r\n                                        \"port_value\": 8502\r\n                                    }\r\n                                }\r\n                            ],\r\n                            \"http2_protocol_options\": {}\r\n                        }\r\n                    ]\r\n                },\r\n                \"dynamic_resources\": {\r\n                    \"lds_config\": {\r\n                        \"ads\": {}\r\n                    },\r\n                    \"cds_config\": {\r\n                        \"ads\": {}\r\n                    },\r\n                    \"ads_config\": {\r\n                        \"api_type\": \"GRPC\",\r\n                        \"grpc_services\": [\r\n                            {\r\n                                \"envoy_grpc\": {\r\n                                    \"cluster_name\": \"local_agent\"\r\n                                },\r\n                                \"initial_metadata\": [\r\n                                    {\r\n                                        \"key\": \"x-consul-token\"\r\n                                    }\r\n                                ]\r\n                            }\r\n                        ]\r\n                    }\r\n                },\r\n                \"admin\": {\r\n                    \"access_log_path\": \"/dev/null\",\r\n                    \"address\": {\r\n                        \"socket_address\": {\r\n                            \"address\": \"0.0.0.0\",\r\n                            \"port_value\": 19000\r\n                        }\r\n                    }\r\n                }\r\n            },\r\n            \"last_updated\": \"2018-10-29T09:22:19.322Z\"\r\n        },\r\n        {\r\n            \"@type\": \"type.googleapis.com/envoy.admin.v2alpha.ClustersConfigDump\",\r\n            \"static_clusters\": [\r\n                {\r\n                    \"cluster\": {\r\n                        \"name\": \"local_agent\",\r\n                        \"connect_timeout\": \"1s\",\r\n                        \"hosts\": [\r\n                            {\r\n                                \"socket_address\": {\r\n                                    \"address\": \"127.0.0.1\",\r\n                                    \"port_value\": 8502\r\n                                }\r\n                            }\r\n                        ],\r\n                        \"http2_protocol_options\": {}\r\n                    },\r\n                    \"last_updated\": \"2018-10-29T09:22:19.329Z\"\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"@type\": \"type.googleapis.com/envoy.admin.v2alpha.ListenersConfigDump\"\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\n#### Reproduction Steps\r\n\r\n**consul-envoy/Dockerfile**\r\n```Dockerfile\r\nFROM consul:1.3.0\r\nFROM envoyproxy/envoy:v1.8.0\r\nCOPY --from=0 /bin/consul /bin/consul\r\nENTRYPOINT [\"dumb-init\", \"consul\", \"connect\", \"envoy\"]\r\n```\r\n\r\n**services.json**\r\n```json\r\n{\r\n    \"connect\": {\r\n        \"enabled\": true\r\n    },\r\n    \"services\": [\r\n        {\r\n            \"name\": \"core-demo-api1\",\r\n            \"port\": 80,\r\n            \"connect\": {\r\n                \"sidecar_service\": {\r\n                    \"port\": 19000,\r\n                    \"proxy\": {                        \r\n                        \"upstreams\": [\r\n                            {\r\n                                \"destination_name\": \"code-demo-api2\",\r\n                                \"local_bind_port\": 80\r\n                            }\r\n                        ]\r\n                    },\r\n                    \"checks\": [\r\n                        {\r\n                            \"name\": \"Connect Sidecar Listening\",\r\n                            \"tcp\": \"core-demo-api1-sidecar-proxy:19000\",\r\n                            \"interval\": \"10s\"\r\n                        },\r\n                        {\r\n                            \"name\": \"Connect Sidecar Aliasing core-demo-api1\",\r\n                            \"alias_service\": \"core-demo-api1\"\r\n                        }\r\n                    ]\r\n                }\r\n            }\r\n        },\r\n        {\r\n            \"name\": \"core-demo-api2\",\r\n            \"port\": 80,\r\n            \"connect\": {\r\n                \"sidecar_service\": {\r\n                    \"port\": 19000,\r\n                    \"proxy\": {                        \r\n                        \"upstreams\": [\r\n                            {\r\n                                \"destination_name\": \"code-demo-api1\",\r\n                                \"local_bind_port\": 80\r\n                            }\r\n                        ]\r\n                    },\r\n                    \"checks\": [\r\n                        {\r\n                            \"name\": \"Connect Sidecar Listening\",\r\n                            \"tcp\": \"core-demo-api2-sidecar-proxy:19000\",\r\n                            \"interval\": \"10s\"\r\n                        },\r\n                        {\r\n                            \"name\": \"Connect Sidecar Aliasing core-demo-api2\",\r\n                            \"alias_service\": \"core-demo-api2\"\r\n                        }\r\n                    ]\r\n                }\r\n            }\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\n\r\n**docker-compose.yml**\r\n```yaml\r\nversion: '2.4'\r\n\r\nservices:\r\n  consul:\r\n    image: consul:1.3.0\r\n    command: \"agent -dev -server -bootstrap-expect 1 -ui -client 0.0.0.0 -datacenter local -node docker -config-file /etc/consul/services.json\"\r\n    volumes:\r\n      - ./demo/consul/services.json:/etc/consul/services.json\r\n  core-demo-api1:\r\n    image: core-demo-api1\r\n    build:\r\n      context: .\r\n      dockerfile: demo/Core.Demo.Api1/Dockerfile\r\n  core-demo-api1-sidecar-proxy:\r\n    image: consul-envoy\r\n    command: \"-sidecar-for core-demo-api1 -admin-bind 0.0.0.0:19000 -http-addr http://consul:8500\"\r\n    build:\r\n      context: ./docker/consul-envoy\r\n      dockerfile: ./Dockerfile\r\n    depends_on: \r\n      consul:\r\n        condition: service_healthy\r\n\r\n  core-demo-api2:\r\n    image: core-demo-api2\r\n    build:\r\n      context: .\r\n      dockerfile: demo/Core.Demo.Api2/Dockerfile\r\n  core-demo-api2-sidecar-proxy:\r\n    image: consul-envoy\r\n    command: \"-sidecar-for core-demo-api2 -admin-bind 0.0.0.0:19000 -http-addr http://consul:8500\"\r\n    build:\r\n      context: ./docker/consul-envoy\r\n      dockerfile: ./Dockerfile\r\n    depends_on: \r\n      consul:\r\n        condition: service_healthy\r\n```\r\n**docker-compose.override.yml**\r\n```yaml\r\nversion: '2.4'\r\n\r\nservices:\r\n  consul:\r\n    ports:\r\n      - \"8400:8400\"\r\n      - \"8500:8500\"\r\n      - \"8600:8600\"\r\n      - \"8600:8600/udp\"\r\n    healthcheck:\r\n      test: [\"CMD-SHELL\", \"curl --silent --fail localhost:8500/v1/agent/services || exit 1\"]\r\n      interval: 30s\r\n      timeout: 30s\r\n      retries: 3\r\n  core-demo-api1:\r\n    environment:\r\n      - ASPNETCORE_ENVIRONMENT=Compose\r\n      - ASPNETCORE_URLS=http://+:80\r\n      - HOSTNAME=core-demo-api1\r\n    ports:\r\n      - \"55127:80\"\r\n  core-demo-api1-sidecar-proxy:\r\n    ports:\r\n      - \"19000:19000\"\r\n  core-demo-api2:\r\n    environment:\r\n      - ASPNETCORE_ENVIRONMENT=Compose\r\n      - ASPNETCORE_URLS=http://+:80\r\n      - HOSTNAME=core-demo-api2\r\n    ports:\r\n      - \"55185:80\"\r\n```\r\n\r\n### Consul info for both Client and Server\r\n\r\n<details>\r\n  <summary>Client info</summary>\r\n\r\n**(!) Executed inside one of the sidecar-proxy containers (!)**\r\n```\r\n# consul info\r\nError querying agent: Get http://127.0.0.1:8500/v1/agent/self: dial tcp 127.0.0.1:8500: connect: connection refused\r\n```\r\n</details>\r\n\r\n<details>\r\n<summary>envoy.yaml</summary>\r\n\r\n```yaml\r\nadmin:\r\n  access_log_path: /tmp/admin_access.log\r\n  address:\r\n    socket_address:\r\n      protocol: TCP\r\n      address: 127.0.0.1\r\n      port_value: 9901\r\nstatic_resources:\r\n  listeners:\r\n  - name: listener_0\r\n    address:\r\n      socket_address:\r\n        protocol: TCP\r\n        address: 0.0.0.0\r\n        port_value: 10000\r\n    filter_chains:\r\n    - filters:\r\n      - name: envoy.http_connection_manager\r\n        config:\r\n          stat_prefix: ingress_http\r\n          route_config:\r\n            name: local_route\r\n            virtual_hosts:\r\n            - name: local_service\r\n              domains: [\"*\"]\r\n              routes:\r\n              - match:\r\n                  prefix: \"/\"\r\n                route:\r\n                  host_rewrite: www.google.com\r\n                  cluster: service_google\r\n          http_filters:\r\n          - name: envoy.router\r\n  clusters:\r\n  - name: service_google\r\n    connect_timeout: 0.25s\r\n    type: LOGICAL_DNS\r\n    # Comment out the following line to test on v6 networks\r\n    dns_lookup_family: V4_ONLY\r\n    lb_policy: ROUND_ROBIN\r\n    hosts:\r\n      - socket_address:\r\n          address: google.com\r\n          port_value: 443\r\n    tls_context: { sni: www.google.com }\r\n```\r\n</details>\r\n\r\n<details>\r\n  <summary>Server info</summary>\r\n\r\n```\r\n# consul info\r\nagent:\r\n        check_monitors = 0\r\n        check_ttls = 0\r\n        checks = 4\r\n        services = 4\r\nbuild:\r\n        prerelease =\r\n        revision = e8757838\r\n        version = 1.3.0\r\nconsul:\r\n        bootstrap = true\r\n        known_datacenters = 1\r\n        leader = true\r\n        leader_addr = 127.0.0.1:8300\r\n        server = true\r\nraft:\r\n        applied_index = 1439\r\n        commit_index = 1439\r\n        fsm_pending = 0\r\n        last_contact = 0\r\n        last_log_index = 1439\r\n        last_log_term = 2\r\n        last_snapshot_index = 0\r\n        last_snapshot_term = 0\r\n        latest_configuration = [{Suffrage:Voter ID:7df0a6a8-3f7a-10f6-d759-e46d1b024aa2 Address:127.0.0.1:8300}]\r\n        latest_configuration_index = 1\r\n        num_peers = 0\r\n        protocol_version = 3\r\n        protocol_version_max = 3\r\n        protocol_version_min = 0\r\n        snapshot_version_max = 1\r\n        snapshot_version_min = 0\r\n        state = Leader\r\n        term = 2\r\nruntime:\r\n        arch = amd64\r\n        cpu_count = 2\r\n        goroutines = 103\r\n        max_procs = 2\r\n        os = linux\r\n        version = go1.11.1\r\nserf_lan:\r\n        coordinate_resets = 0\r\n        encrypted = false\r\n        event_queue = 1\r\n        event_time = 2\r\n        failed = 0\r\n        health_score = 0\r\n        intent_queue = 0\r\n        left = 0\r\n        member_time = 1\r\n        members = 1\r\n        query_queue = 0\r\n        query_time = 1\r\nserf_wan:\r\n        coordinate_resets = 0\r\n        encrypted = false\r\n        event_queue = 0\r\n        event_time = 1\r\n        failed = 0\r\n        health_score = 0\r\n        intent_queue = 0\r\n        left = 0\r\n        member_time = 1\r\n        members = 1\r\n        query_queue = 0\r\n        query_time = 1\r\n```\r\n\r\n</details>\r\n\r\n### Operating system and Environment details\r\n0\r\nWindows 10 Enterprise x64 running Docker for Windows (MobyLinuxVM)\r\n\r\n### Log Fragments\r\n\r\n**TBD**\r\nInclude appropriate Client or Server log fragments. If the log is longer than a few dozen lines, please include the URL to the [gist](https://gist.github.com/) of the log instead of posting it in the issue. Use `-log-level=TRACE` on the client and server to capture the maximum log detail.\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/consul/issues/comments/434358485","html_url":"https://github.com/hashicorp/consul/issues/4868#issuecomment-434358485","issue_url":"https://api.github.com/repos/hashicorp/consul/issues/4868","id":434358485,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDM1ODQ4NQ==","user":{"login":"mmisztal1980","id":1357057,"node_id":"MDQ6VXNlcjEzNTcwNTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1357057?v=4","gravatar_id":"","url":"https://api.github.com/users/mmisztal1980","html_url":"https://github.com/mmisztal1980","followers_url":"https://api.github.com/users/mmisztal1980/followers","following_url":"https://api.github.com/users/mmisztal1980/following{/other_user}","gists_url":"https://api.github.com/users/mmisztal1980/gists{/gist_id}","starred_url":"https://api.github.com/users/mmisztal1980/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmisztal1980/subscriptions","organizations_url":"https://api.github.com/users/mmisztal1980/orgs","repos_url":"https://api.github.com/users/mmisztal1980/repos","events_url":"https://api.github.com/users/mmisztal1980/events{/privacy}","received_events_url":"https://api.github.com/users/mmisztal1980/received_events","type":"User","site_admin":false},"created_at":"2018-10-30T15:54:54Z","updated_at":"2018-10-30T15:54:54Z","author_association":"NONE","body":"@rboyer my intention is to do a poc on k8s, however, .NET Solutions developed under Visual Studio 2017 have a docker-compose integration, so I wanted to get that up and running 1st."}}
{"actor":{"display_login":"mmisztal1980"}}