least_conn upstream configuration issue "host not found in upstream" with Kubernetes DNS

kpirateone nginx-forum at forum.nginx.org
Tue Jan 5 15:53:58 UTC 2021


I am trying to configure a least_conn upstream for kubernetes pods and find
that we receive a "host not found in upstream" error on startup if the pod
has not been started.

config snippet:

   upstream backend {
        least_conn;

        server pod0.servicename.namespace.svc.cluster.local:8081;
        server pod1.servicename.namespace.svc.cluster.local:8081;
        server pod2.servicename.namespace.svc.cluster.local:8081;
    }

    location / {
      proxy_pass          http://backend;
    }

we would like to be able to start up nginx and use least_conn load balancing
across all pods.  however nginx fails to start unless all pods exist and can
resolve dns.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,290383,290383#msg-290383



More information about the nginx mailing list