-
Notifications
You must be signed in to change notification settings - Fork 566
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
500 Internal Server Error / no hosts available #268
Comments
hi, @mlamothe and welcome to the KrakenD community! Why are you setting the ports to the service names? as you can see, the SRV record already informs the system which port is each node using. Also, the schema prefix ( So, for the service registered as BTW, you can customize your hostname lookup by replacing the actual value of cheers! |
Thanks for your help - I changed the config file but the errors are exactly the same as before.
|
Is the KrakenD service running on the same machine where you executed the also, is the OS running the KrakenD instance able to resolve the names |
Howdy,
Yes, everything I wrote above was executed on the VM running KrakendD.
Yes: and |
Can you provide us a way to reproduce your scenario? I've been playing with a Vagrantfile but it's taking me too much time to get the details right |
I've never used Vagrant... Is there any more troubleshooting I can do on my end? I really wish I could "see" why KrakenD is returning a 500. Is it crashing? It is getting a result back from Consul it doesn't like? |
As for KrakenD, this is a brand new VM. The following steps were performed:
The configuration file shown above was created with chmod 644 applied. The only other noteworthy part was configuring /etc/systemd/resolved.conf and iptables to point to the consul box.
And relevant iptables:
Thanks again for all your help. |
Update:
If I take one of those, (say But if I use the IP address that resolves to (http://10.30.54.161), that DOES work. One interesting thing is if I run Is it possible that's the problem? If so, any idea what might fix this issue? Thanks, |
hi, @mlamothe the SRV records contain hostnames and ports for the registered service instances. those hostnames have no SRV record associated because they are related to machine names, not services. a SRV record can also return IP instead of hostnames, that's why the KrakenD does not manipulate the returned names. It just expects the underlaying OS to be able to resolve them if required. I finally got an environment up and running that should look like yours.
config required for the DNS layer:
Since the
and changed the configuration of the
before testing the gateway integration, I've checked the
finally:
it's the same result you'll get using the default configuration (notice the |
Thank you, @kpacha. It seems like the biggest difference between your setup and mine is you used dnsmasq whereas I used systemd. I will see if I can get it to work using your method and will update the ticket one way or another. |
there is some documentation regarding how to configure the DNS integration for your consul service... and it covers both solutions plus several others. so I guess it should be 100% transparent. (https://learn.hashicorp.com/consul/security-networking/forwarding) on the other hand, you can not consume RPC services with the default http client and you are mixing the RPC service (port 8300) with the HTTP API service (port 8500, exposed just to localhost) Here, I tried to consume the same endpoint you have in your configuration against the second consul node
Here, I fixed the port
Here, against the right port at the local interface
that's why I registered the krakend as a service itself and replace |
I know it's been a while, but I've been working on this problem this whole time. Even though I've never worked with Go, I decided to clone the repo, build it and step through it with a debugger.
The actual cause is that Consul is returning compressed DNS records, and Go made a change that no longer allows these - even though they're perfectly valid. See: golang/go#24870 You can close this ticket if you like. I have my answer: It's Go, not KrakenD :) |
any update/fix !! on "Error #1: no hosts available" |
@skjoher the issue here was with the way the services were registered at the consul layer. Is that your case? |
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. |
I'm setting up KrakenD for the first time. I'm trying to use SD DNS to work in tandem with Consul. If I specify a static IP everything works fine, but SD DNS isn't working.
For example, this simple curl example returns a 500:
>curl http://10.30.54.185:8000/consul --verbose
The configuration file, cat /etc/krakend/krakend.json:
Note: For 'host', I also tried "consul.service.consul:8500" but it made no difference.
Log file (notice logging is set to DEBUG level):
Results of dig on consul.service.consul:
Those IP addresses are correct - there are two consul servers.
Also: dig consul.service.consul SRV +short
I can ping those two addresses.
This is running on Ubuntu Server 18.04.2 LTS
I'm not sure what I'm missing. I've been banging away at this all day. Any help is much appreciated.
The text was updated successfully, but these errors were encountered: