Can you tell me how Nomad searches through Consul Nomad servers and, respectively, the cluster to connect to?
I encountered a problem that the Nomad client was connected to a PROD cluster, then a network problem happened and Nomad started searching for the cluster through Consul:
But in the same data center consul are nomad servers on STG and PROD
And as you can see the consul gave nomad servers from STG. Can someone explain how this happened and what request Nomad sends to consul to find nomad cluster?
Hi @falseroses , do you have client_auto_join configured? If so, the Nomad Client will query Consul for live Nomad servers - first in its local DC, then in other DCs.
If your Nomad clusters are all configured as the same region there is nothing to prevent such cross-connection.
A default consul stanza is automatically merged with all Nomad agent configurations. These sane defaults automatically enable Consul integration if Consul is detected on the system. This allows for seamless bootstrapping of the cluster with zero configuration. To put it another way: if you have a Consul agent running on the same host as the Nomad agent with the default configuration, Nomad will automatically connect and configure with Consul.