Setup of Nomad on Vultr with Traefik reverse proxy
https://github.com/brodul/nomad-vultr-example.git
An example repo of running Hashicorp Nomad on Vultr with Traefik as a reverse proxy.
Slides can be found here:
https://2ly.link/1xvZY
Create a Vultr account and get a Vultr token.
First, ensure you have Terraform installed. Then, follow these steps:
terraform init
terraform plan
terraform apply
After applying, a hostfile.txt will be generated, which can be utilized for debugging and inspection using tools like pssh.
Follow these steps to configure Bootstrap ACL:
export NOMAD_ADDR="http://$(head -n 1 hosts.txt):4646"
nomad acl bootstrap
If there is an error wait for a bit (5min), so that the cluster builds up.
echo "BOOTSTRAP_SECRET_ID" > bootstrap.token
export NOMAD_TOKEN=$(cat bootstrap.token)
nomad server members
Apply policy for Traefik to access Nomad jobs:
nomad acl policy apply traefik traefik_acl_policy.nomad.hcl
Generate a token for Traefik:
nomad acl token create -name traefik_token -policy traefik
export TRAEFIK_TOKEN="TRAEFIK_SECRET_ID"
Set the token and deploy Traefik:
nomad var put -namespace default nomad/jobs/traefik-system/traefik/server token=$TRAEFIK_TOKEN address=$NOMAD_ADDR
nomad job run traefik.nomad.hcl
Deploy Whoami service:
nomad job run whoami.nomad.hcl
For production environments, consider implementing mTLS between clients and servers. Additionally, ensure better ACL configurations for sensitive variables like the Traefik token. Traefik is listening to only one server.
Email: andraz โค brodnik AT brodul โค org