Run Terminating gateway On Same Machine as External Service Agent

I’m currently attempting to setup a terminating gateway along with a consul agent registering an external service, however it doesn’t seem to be working at all, as if it isn’t recognizing the terminating gateway configuration.

example config:
{
“primary_datacenter”: “dc1”,
“datacenter”: “dc1”,
“data_dir”: “/root/”,
“log_level”: “INFO”,
“node_name”: “test-node”,
“leave_on_terminate”: true,
“service”: {
“id”: “test-service”,
“name”: “test-service”,
“port”: 8080,
“address”: “EXTERNAL-IP”
“check”: {
“id”: “healthcheck1”,
“name”: “healthcheck1”,
“interval”: “5s”,
“timeout”: “2s”,
“http”: “http://EXTERNAL-IP:8080/”,
“method”: “GET”,
“tls_skip_verify”: false
}
}
“config_entries”: {
“bootstrap”: [
{
“Kind”: “terminating-gateway”,
“Name”: “test-gateway”,
“Services”: [
{
“Name”:“test-service”
}
]
}
]
},
“ports”: {
“grpc”: 8502
},
“retry_join”: [
“10.0.0.134”
]
}

however when I run consul connect envoy -gateway=terminating I get the error:
==> No terminating-gateway services registered with this agent

I’ve tried many ways and I can only seem to get the gateway to register with a full envoy connect command defining everything that’s already in the config except for registering the service the gateway needs to be aware of. Any help is greatly appreciated.

Hi @reskin89,

I could see that you have config_entires defined in the configuration. According to the documentation, the config_entries > bootstrap option is only applicable for the server agents. (ref: Configuration | Consul by HashiCorp)

So either you will have to move the terminating gateway definition to the server configuration or register the terminating gateway using consul config write.

This error is not referring to the that you’re trying to associate with the gateway, but rather the fact that the gateway itself is not registered in Consul’s service catalog.

You can either manually craft a service registration for the gateway, and define both service registrations–the gateway and the external service–in your agent configuration (Services: Multiple Service Definitions), or you can have consul connect envoy register the gateway for you by adding the adding the -register flag to the command.

$ consul connect envoy -register -gateway=terminating -service="terminating-gateway"

You’ll also need to follow the suggestion by Ranjandas and remove the terminating gateway config entry from config_entries.bootstrap, and manually apply the config using either consul config write, the /config API, Terraform, etc.