0

I have a nginx open source pod (not ingress controller) in a namespace and i have configured the upstream in it with 2 services already there like below

## @param serverBlock Custom server block to be added to NGINX configuration
## PHP-FPM example server block:
serverBlock: |-
  upstream samplecluster {


  server acj-prip:9111;
  server acj-scpp:9111;
  resolver kube-dns.kube-system.svc.cluster.local valid=5s;

  }
  server {
  listen 80 default_server;
  listen [::]:80 default_server;  
  server_name _;


  location / {
    proxy_pass http://samplecluster/;
  }

  }

For some reason nginx is not reaching this, these services are reachable from other pods though, getting the error as below

host not found in upstream "acj-prip:9111" in /opt/bitnami/nginx/conf/server_blocks/server-block.conf:6
nginx: [emerg] host not found in upstream "acj-prip:9111" in /opt/bitnami/nginx/conf/server_blocks/server-block.conf:6

What am i missing here?

windowws
  • 373
  • 1
  • 8
  • 20
  • 1
    Are *acj-prip* and *acj-scpp* in the same namespace of nginx? If yes, you must use full DNS name to resolve these; for example *acj-prip.NAMESPACE.svc.cluster.local*. – glv Apr 05 '23 at 07:37
  • They are in same namespace , same error, even after adding fulldns name – windowws Apr 05 '23 at 07:49
  • Try removing `acj-prip:9111` config and let the nginx pod starts. Then go to the pod and try `curl acj-prip:9111` or `wget -qO- acj-prip:9111` or `ping acj-prip`. Does the service resolve? Do you get any response? – Andromeda Apr 05 '23 at 07:55
  • Take a look here: https://stackoverflow.com/questions/42720618/docker-nginx-stopped-emerg-11-host-not-found-in-upstream – glv Apr 05 '23 at 07:56
  • @Andromeda it seems to be a debian image with no tools – windowws Apr 05 '23 at 08:01
  • Refer to this [stackpost](https://stackoverflow.com/questions/33639138/docker-networking-nginx-emerg-host-not-found-in-upstream). Let me know if it helps – Fariya Rahmat Apr 05 '23 at 09:48

0 Answers0