hashicorp / hashicorp/consul

consul connect built in proxy doesn't respect bind_address and bind_port on service definition

Open
#10,114 2 comments 1 reaction 1 assignee Claimed by @jsosulska View on GitHub
theme/connect type/docs type/question
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

#### Overview of the Issue
I want to deploy consul connect built in proxy on a different host rather than localhost.
Though I define that in service definition. It seems consul thinks that side car is always deployed on localhost

#### Reproduction Steps
My service definition:
```
service {
name = "counting"
id = "counting-1"
port = 9005
address = "169.254.1.1"

connect {
sidecar_service {
proxy {
config {
bind_address = "169.254.1.1"
bind_port = 21002
tcp_check_address = "169.254.1.1"
local_service_address = "169.254.1.1:9005"
}
}
}
}
check {
id = "counting-check"
http = "http://169.254.1.1:9005/health"
method = "GET"
interval = "10s"
timeout = "1s"
}
}
```
Consul's config.hcl file:
```
datacenter = "local-dc"
node_name = "machine"
server = true
data_dir = "/home/***/Downloads/wso2/consul.d"
encrypt = "jUfwm+1c1+rZZeP/lyG4LzWvh192geqpktXERrsdtEs="
ca_file = "/home/***/Downloads/***/consul-agent-ca.pem"
cert_file = "/home/***/Downloads/***/local-dc-server-consul-1.pem"
key_file = "/home/***/Downloads/***/local-dc-server-consul-1-key.pem"
verify_incoming = false
verify_outgoing = false
verify_server_hostname = false
acl = {
enabled = false
default_policy = "allow"
enable_token_persistence = true
}
connect {
enabled = true
}
ports {
"grpc" = 8502
"https" = 8051
}
```
consul started using:
```
consul agent -config-dir='/home/***/Downloads/***/consul.d' -node=machine -datacenter=local-dc -ui -https-port=8501 -server=true -bootstrap
```
consul is binded to a dummy interface created on :
```
{
"client_addr": "169.254.1.1",
"bind_addr": "169.254.1.1"
}
```
UI:
![Screenshot from 2021-04-24 10-33-28](https://user-images.githubusercontent.com/32504465/115948064-727c0e00-a4e9-11eb-8aae-9351ad4ba1dc.png)
![Screenshot from 2021-04-24 10-32-02](https://user-images.githubusercontent.com/32504465/115948067-7871ef00-a4e9-11eb-988f-434d5ee697e2.png)

Built in proxy:
```
consul connect proxy -sidecar-for counting-1
```
![Screenshot from 2021-04-24 10-41-40](https://user-images.githubusercontent.com/32504465/115948122-c850b600-a4e9-11eb-9402-22b8003a7db6.png)

### Consul info for both Client and Server
Used one consul instance

Server info

```
output from server 'consul info' command here
```
agent:
check_monitors = 0
check_ttls = 0
checks = 3
services = 3
build:
prerelease =
revision = 10bb6cb3
version = 1.9.4
consul:
acl = disabled
bootstrap = true
known_datacenters = 1
leader = true
leader_addr = 169.254.1.1:8300
server = true
raft:
applied_index = 3350
commit_index = 3350
fsm_pending = 0
last_contact = 0
last_log_index = 3350
last_log_term = 20
last_snapshot_index = 0
last_snapshot_term = 0
latest_configuration = [{Suffrage:Voter ID:0012e53f-39c0-8676-861d-2eba72b3a8ee Address:169.254.1.1:8300}]
latest_configuration_index = 0
num_peers = 0
protocol_version = 3
protocol_version_max = 3
protocol_version_min = 0
snapshot_version_max = 1
snapshot_version_min = 0
state = Leader
term = 20
runtime:
arch = amd64
cpu_count = 8
goroutines = 117
max_procs = 8
os = linux
version = go1.15.8
serf_lan:
coordinate_resets = 0
encrypted = true
event_queue = 1
event_time = 20
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 1
members = 1
query_queue = 0
query_time = 1
serf_wan:
coordinate_resets = 0
encrypted = true
event_queue = 0
event_time = 1
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 1
members = 1
query_queue = 0
query_time = 1

### Operating system and Environment details

Ubuntu 20.04 amd64

### Log Fragments

Include 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.