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

Cant Resolve host name. Tried adding with CLI parameters. Should this work? #72

Open
jb6925 opened this issue Oct 14, 2021 · 6 comments

Comments

@jb6925
Copy link

jb6925 commented Oct 14, 2021

I'm running a unit test with resty in a kubernetes cluster.

resty /kong/spec/jwtcache_test.lua --http-conf 'resolver 172.31.0.10' --main-conf 'resolver 172.31.0.10'

This test uses "resty.redis" to try to connect to a redis instance that is deployed as a service.

Error:
redis could not be resolved (3: Host not found)

Should this work? I'm not really looking up a proxy address in nginx.

Thanks for your time in looking at this issue.

@jb6925 jb6925 changed the title Cant Resolve host name. Tried adding with CLI parameters. Cant Resolve host name. Tried adding with CLI parameters. Should this work? Oct 14, 2021
@doujiang24
Copy link
Member

@jb6925 This should works:

resty --http-conf 'resolver 172.31.0.10' /kong/spec/jwtcache_test.lua

@jb6925
Copy link
Author

jb6925 commented Oct 15, 2021

Thanks @doujiang24. The resolver was added to the configuration but now I'm unable to override the default .
ie
nginx: [emerg] "resolver" directive is duplicate in /tmp/resty_rCLHKZYDlc/conf/nginx.conf:172

Is it possible to override the resolver? Or is there a way to set the resolver local=on;?

@doujiang24
Copy link
Member

Okay, after checking the source code:

  1. --ns IP, specify a custom name server (multiple instances are supported)
  2. read nameserver from /etc/resolv.conf if no ns specified.

So, I think 1 should work then.

@doujiang24
Copy link
Member

Also, I'm a bit confused, does nameserver 172.31.0.10 already exists in the /etc/resolv.conf file?

@jb6925
Copy link
Author

jb6925 commented Oct 18, 2021

@doujiang24 yes it does.

my /etc/resolv.conf

nameserver 172.31.0.10
search gitlab-runners.svc.cluster.local svc.cluster.local cluster.local xxxx.yy.zzzz.internal bb.aaaa.internal google.internal
options ndots:5

using the --ns parameter i'm back to my original error.
redis could not be resolved (3: Host not found)

is it possible that the search isn't be used?

@xiaocang
Copy link
Contributor

is it possible that the search isn't be used?

Hi @jb6925, currentlly resolver local=on; does not use the search field in /etc/resolv.conf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants