Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable protocol on Service Discovery #706

Closed
MDS-Info opened this issue Apr 13, 2023 · 4 comments
Closed

Configurable protocol on Service Discovery #706

MDS-Info opened this issue Apr 13, 2023 · 4 comments

Comments

@MDS-Info
Copy link

Hello,

Environment info:

  • KrakenD version: devopsfaith/krakend:2.1.2
  • System info: Ubuntu 20.04 LTS / docker engine 20.10.17
  • Hardware specs: 16CPU/10Go Memory

Describe the bug

I want to set the Service Discovery by using DNS SRV RECORD, but I have this issue :

{"@timestamp":"2023-04-13T15:44:16.922+00:00", "@Version": 1, "level": "ERROR", "message": "[ENDPOINT: xxx] no hosts available", "module": "KRAKEND"}
[GIN] 2023/04/13 - 15:44:16 | 500 | 86.964µs | 192.168.107.1 | GET "xxx"
Error #1: no hosts available

Nevertheless, the DNS server return the correct information :

17:44:26.586003 IP 172.18.0.12.44657 > xxx.local.domain: 4478+ [1au] SRV? _api.._tcp.mds.local. (50)
17:44:26.586017 IP 172.18.0.12.55777 > xxx.local.domain: 34244+ [1au] SRV? _api.._tcp.mds.local. (50)
17:44:26.587021 IP xxx.local.domain > 172.18.0.12.55777: 34244* 1/0/2 SRV xxx.domain.:5001 0 0 (105)

from the docker host, the resolution is correct:

nslookup

set type=srv
_api._tcp.mds.local

_api._tcp.mds.local service = 0 0 5001 xxx.domain.

by using curl, the service is responding

172.18.0.12 : container's IP
xxx.local.domain : DNS server

Your configuration file:
"endpoint": "xxx",
"input_headers": [
"*"
],
"input_query_strings": [],
"method": "Get",
"output_encoding": "no-op",
"extra_config": {},
"backend": [
{
"url_pattern": "xxx",
"encoding": "json",
"sd": "dns",
"method": "Get",
"extra_config": {},
"disable_host_sanitize": true,
"host": [
"_api._tcp.mds.local"
]
}
]

thanks for you help

@MDS-Info
Copy link
Author

MDS-Info commented Apr 14, 2023

@alombarte @kpacha
Hello team,

i fixed it by using priority and weigth on my SRV record.

but now i have a new issue

Error #1: Get "http://XXX.:XXX/v1/XXX/XXX": EOF

Now, krakend send the request to the good destination host by used http schema, how to switch to https

i suspect the schema to be hard coded : https://github.com/luraproject/lura/blob/master/sd/dnssrv/subscriber.go
line 136

thanks for your help

@alombarte
Copy link
Member

Hello @MDS-Info,

You are right, the protocol is hardcoded. We can add a new flag in the configuration sd_protocol that would default to the value http but you could change it to https.

There would still the limitation that you couldn't mix http and https servers, but the DNS SRV does not provide any mechanism to prevent that.

We will have a look at this issue in the next release.

@alombarte alombarte changed the title Service Discovery Configurable protocol on Service Discovery Jun 21, 2023
@alombarte
Copy link
Member

The attribute sd_scheme was added in KrakenD 2.4
https://www.krakend.io/docs/backends/service-discovery/#sd_scheme

Thanks!

Copy link

This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants