I am using Consul as SD and while I am running multiple instances I want make gateway recognize them all to load balance. In case of hardcoded host for Krakend config everything works fine
I was going step by step with this: https://www.krakend.io/docs/backends/service-discovery/
Sending
dig @127.0.0.1 -p 8600 user-ms.service.consul SRV gives me response as well (on consul logs a also see that I've made a request)
But when I am making request via krakenD I am getting "no hosts available" and according to logs request wasn't send to consul
Here is a docker-compose file:
services:
postgres:
image: postgres:13
restart: 'always'
environment:
- POSTGRES_DB=user-db
- POSTGRES_PASSWORD=password
- POSTGRES_USER=user
ports:
- "5432:5432"
consul:
image: consul:latest
restart: 'always'
ports:
- '8500:8500'
- '8600:8600/tcp'
- '8600:8600/udp'
krakend_gateway:
image: devopsfaith/krakend:2
volumes:
- ./krakend.json:/krakend.json
ports:
- "1234:1234"
- "8080:8080"
- "8090:8090"
command: [ "run", "-d", "-c", "/krakend.json" ]
user-ms:
build: user-ms/
platform: linux/arm64
restart: 'always'
depends_on: [consul-server , krakend_gateway]
ports:
- '8082'
And pretty simple Krakend.json config file
{
"version": 3,
"timeout": "3000ms",
"cache_ttl": "300s",
"host" : "localhost:8080",
"endpoints": [
{
"endpoint": "/users",
"backend": [
{
"url_pattern": "/api/v1/users",
"sd" : "dns",
"host" : [
"user-ms.service.consul.srv"
],
"disable_host_sanitize": true
}
]
}
]
}
I've tried a lot of thing , but still get the same response , will be glad for any help with this. Thanks