hashicorp / hashicorp/consul

Service with service-router configured cannot get routed by consul api gateway

Open
#22,575 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

#### Overview of the Issue

When a service got [service-router] configuration, reaching the service via consul api gateway will result in HTTP 503 error.

This does not affect service with only [service-resolver] configuration, or reaching the service via normal envoy connect proxy.

I'm trying to do blue-green deployment via nomad and consul in our test environment. We use consul api gateway for ingress routing and are looking at service routing in consul to do traffic switching on deployment.

[service-router]: https://developer.hashicorp.com/consul/docs/reference/config-entry/service-router
[service-resolver]: https://developer.hashicorp.com/consul/docs/reference/config-entry/service-resolver

---

#### Reproduction Steps

Run consul agent locally with `consul agent -dev`, then run the following script to setup consul configs.

```bash
docker run --rm --name nginx -p 8080:8080 -d nginx

# Not sure if this is necessary, but got this in my cluster
cat <

Client & Server info (dev agent)

```
agent:
check_monitors = 0
check_ttls = 0
checks = 0
services = 2
build:
prerelease =
revision =
version = 1.21.3
version_metadata =
consul:
acl = disabled
bootstrap = false
known_datacenters = 1
leader = true
leader_addr = 127.0.0.1:8300
server = true
raft:
applied_index = 134
commit_index = 134
fsm_pending = 0
last_contact = 0
last_log_index = 134
last_log_term = 2
last_snapshot_index = 0
last_snapshot_term = 0
latest_configuration = [{Suffrage:Voter ID:4051693c-c0e0-ae1e-29e5-39807c8c73d8 Address:127.0.0.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 = 2
runtime:
arch = amd64
cpu_count = 14
goroutines = 228
max_procs = 14
os = linux
version = go1.24.5
serf_lan:
coordinate_resets = 0
encrypted = false
event_queue = 1
event_time = 2
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 = false
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

Arch Linux, x86_64.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the service-router and API gateway configuration in the issue, then inspect Consul's xDS cluster generation and the Envoy gateway's cluster lookup. Compare the generated blue.web... cluster with the requested web... cluster. Done means the gateway routes the request successfully and returns the expected service response instead of HTTP 503.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
api, backend-api-design, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.