nginx does not resolve the service name using search domains in the same way dig <service name> fails to find the ip with the default configuration. This means I need to use the fqdn, not just the service name. I found I can find the underlying team cluster namespace in /etc/resolv.conf by examining the search domains.
With this information I can construct the fqdn as follows:
Good question @azaafoo! The namespace and therefore the FQDN should be stable, but we don’t guarantee stability. If you can, I’d recommend that you rely on the configuration in /etc/resolv.conf to go from service name to FQDN. For example, as part of your build step, you could get the FQDN with:
Thank you very much for that speedy response! That helped me get up and running.
Some minor notes:
It is necessary to chmod +x entrypoint.sh (otherwise the deploy will fail with exit code 126)
Somewhere in the default.conf.template you should set the resolver based on the env var from entrypoint.sh. i.e. resolver $NAMESERVER;
I’m not using upstream because then nginx never re-runs the DNS resolution (which is actually the whole reason I’m even on this thread in the first place since the IP address for my other render services occasionally changes)
That said this doesn’t really directly affect your instructions, I just wanted to note that I’m using proxy_pass with a variable (to force the repeated dns resolution):
set $app_backend http://$SERVICE_FQDN:10000;
proxy_pass $app_backend;