"No Cluster Leader" with server auto-join deployed with terraform

Hello. I’m trying to set up a cluster with terraform on Linode following this guide:

however, when I deploy the machines and attempt to open the UI on http://:4646/ui i get the error

No Cluster Leader

The cluster has no leader. [Read about Outage Recovery.]

Here is the github repo of my setup:

Any help would be greatly appreciated!

Hi @ltroper,

Could you please share the configuration files you are using for the server machines and the logs from one of the Nomad servers please? I would assume there is something that is stopping the servers discovering each other.

Thanks,
jrasell and the Nomad team

Thanks for the reply @jrasell !,

/etc/nomad.d/nomad.hcl

data_dir = “/opt/nomad/data”
bind_addr = “0.0.0.0”

advertise {
http = “170.187.166.120”
rpc = “170.187.166.120”
serf = “170.187.166.120”
}

acl {
enabled = false
}

server {
enabled = true
bootstrap_expect = 3

server_join {
retry_join = [“provider=linode tag_name=auto-join region=us-east address_type=public_v4 api_token=token”]
}


sudo systemctl status nomad
● nomad.service - Nomad
Loaded: loaded (/etc/systemd/system/nomad.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-09-12 22:14:52 UTC; 7min ago
Docs: Documentation | Nomad | HashiCorp Developer
Main PID: 10483 (nomad)
Tasks: 8
Memory: 18.8M
CGroup: /system.slice/nomad.service
└─10483 /usr/local/bin/nomad agent -config /etc/nomad.d


And this is the error message I’m getting:

sudo journalctl -u nomad -n 50
– Logs begin at Tue 2023-09-12 22:13:32 UTC, end at Tue 2023-09-12 22:24:52 UTC. –
Sep 12 22:18:49 localhost nomad[10483]: 2023-09-12T22:18:49.788Z [ERROR] http: request failed: method=GET path=>

Hi @ltroper,

The configuration you posted looks OK from a quick look. The log line you posted is coming from the server HTTP API, and therefore does not contain the required information to debug this problem. Could you paste the logs from the server startup please? I would also make sure the Linode API token has the permissions required for auto-discovery to work; looking quickly at the code this includes ListInstances and GetInstanceIPAddresses API calls.

Thanks,
jrasell and the Nomad team

Resolved. Thanks for the help!