When using a variable to rewrite & proxy to an internal Openshift service within an nginx container's proxy_pass config, NGINX can't resolve the service's DNS due to a required resolver. For instance:
location /api/ {
set $pass_url http://service.namespace.svc:8080$request_uri;
proxy_pass $pass_url;
}
When using standard Kubernetes, I can use kube-dns.kube-system.svc.cluster.local
as the resolver:
resolver kube-dns.kube-system.svc.cluster.local;
But Openshift doesn't provide this. I've tried using the IP that is in the container's /etc/resolv.conf
, which is just one of the nodes in my cluster that is running the DNS server, but it still can't resolve.
Weirdest part is nslookup service.namespace.svc
from inside the container terminal uses the nameserver in /etc/resolv.conf
and it works fine.
Is there an equivalent to the Kubernetes DNS hostname in Openshift I could use, or perhaps another solution to work around this?