job "vault-cluster-ha" { datacenters = ["dc1"] type = "service" group "vault-leader" { count = 1 volume "vault-storage" { type = "host" read_only = false source = "vault-storage" } constraint { attribute = "${node.unique.name}" operator = "=" value = "warden" } network { port "http" { static = 8200 to = 8200 } port "cluster" { static = 8201 to = 8201 } } task "vault" { driver = "exec" volume_mount { volume = "vault-storage" destination = "/opt/nomad/data/vault-storage" read_only = false } resources { cpu = 1000 memory = 2048 } env { VAULT_ADDR = "http://127.0.0.1:8200" VAULT_CLUSTER_ADDR = "http://127.0.0.1:8201" } # Vault 集群配置 - Leader 节点 template { data = <