I have an Ngins, deployed as a pod inside the Openshift cluster, acts as reverse proxy for a backend-service. The backend-service has Kubernetes service to loadbalance the traffic between the pods (we use ha proxy as loadbalancer). The Nginx pass_proxy
all the request to the service.
location /service-1/api {
proxy_pass http://service-svc/api;
}
Anytime the Kubernetes service is recreated or it get a new IP address, the Nginx doesnt refresh the new address - this throws 504 timeout error. I tried the resolver
of the Nginx with 127.0.0.1
, 127.0.0.11
and other ways to force the Nginx refresh the dns lookup, along with assigning the service to a variable.
However, this doesn't solve the problem. The Nginx couldn't resolve the service, saying it cannot resolve using 127.0.0.1:53
. What is the right way to put the resolver? What IP should I provide in the resolver?