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.