/nomad-on-gcp-gce

Deploy HashiCorp Nomad cluster on GCE instances

Primary LanguageHCLApache License 2.0Apache-2.0

README

Deploying HashiCorp Nomad cluster on Google Cloud Compute Engine instances using custom VM images built using Packer as done in my repo here

Google Compute Image

Google Compute Region Instance Template

Google Compute Region Instance Group Manager

Google Cloud Load Balancing

This blueprint deploys a Consul server cluster, Nomad server cluster, and a few Nomad workers (or clients, as they're called) in the default VPC.

Bootstrapping Nomad ACL

After deployment, you will have to ssh into the Nomad server to run nomad acl bootstrap to get the (root) bootstrap token.

  • example:
gcloud compute ssh nomad-server-a1b2 \
  --zone northamerica-northeast1-c \
  --project myproject-123 \
  --command "nomad acl bootstrap"
  • output:
Accessor ID  = 12345678-9abc-def1-2345-6789abcdef12
Secret ID    = abcdef12-3456-789a-bcde-f123456789ab
Name         = Bootstrap Token
Type         = management
Global       = true
Create Time  = 2023-09-03 04:30:12.602612696 +0000 UTC
Expiry Time  = <none>
Create Index = 15
Modify Index = 15
Policies     = n/a
Roles        = n/a

NOTE

It can take a couple of minutes for the load balancer to confirm that all the backends are health and start serving traffic. It may also take a few more for Consul to vote on a leader initially, so be patient.

Additional Resources

If you would like to learn more about HashiCorp Nomad, check out my Medium articles below: