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

Francis Daly francis at daoine.org
Tue Jan 5 17:27:34 UTC 2021


On Tue, Jan 05, 2021 at 10:53:58AM -0500, kpirateone wrote:

Hi there,

> 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.

See, for example, the thread at https://forum.nginx.org/read.php?2,290205

In short: stock nginx does not care if the upstream service (the pod)
is running or not; but it does care that whatever hostname you use in the
"upstream" section resolves to an IP address at nginx-start time.

That thread does list a few possible ways of approaching a solution;
maybe one will work for you?

> 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.

"exist" should not matter.

"can resolve dns" does matter.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list