# Vault does not honor cluster\_addr

**URL:** <https://discuss.hashicorp.com/t/vault-does-not-honor-cluster-addr/39708>\
**Category:** Vault\
**Created:** [May 19, 2022, 8:43am UTC](https://discuss.hashicorp.com/t/vault-does-not-honor-cluster-addr/39708 "2022-05-19T08:43:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisbecke](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/chrisbecke/32/17783_2.png) [@chrisbecke](https://discuss.hashicorp.com/u/chrisbecke)\
**Post date:** [May 19, 2022, 8:43am UTC](https://discuss.hashicorp.com/t/vault-does-not-honor-cluster-addr/39708/1 "2022-05-19T08:43:27Z")

</div>

I am deploying vault - to docker swarm - using the below compose.yml. The service is deployed with 3 replicas and is deployed with integrated raft storage.

The documentation says its important, and I provide, `cluster_addr`, that uses the hostname of each raft node. However, after deployment, if I check the member list and raft status, I can see that vault is using the api\_addr ([http://vault1:8200](http://vault1:8200) etc) but has used a generated cluster\_addr (https not http, ip not hostname).

```auto
Node Address State Voter
---- ------- ----- -----
node1 10.0.45.7:8201 leader true
node3 10.0.45.9:8201 follower true
node2 10.0.45.8:8201 follower true
/ # vault operator members
Host Name API Address Cluster Address ActiveNode Last Echo
--------- ----------- --------------- ---------- ---------
vault1 http://vault1:8200 https://10.0.45.7:8201 true <nil>
vault3 http://vault3:8200 https://10.0.45.9:8201 false 2022-05-19 08:40:57.009616077 +0000 UTC
vault2 http://vault2:8200 https://10.0.45.8:8201 false 2022-05-19 08:40:54.46053215 +0000 UTC

```

This is the stack.yml file that does the deployment to swarm. {{.Task.Slot}} automatically expands out to the integers 1,2 and 3, ensuring that 3 instances of vault, named “vault1”, “vault2” and “vault3” are created, as can be seen in the API Address from the vault operator members report. Additionally there is config for a transit vault to autounsealing.

`vault-stack.yml`

```nohighlight
services:

  vault:
    image: vault:latest
    hostname: vault{{.Task.Slot}}
    cap_add:
      - IPC_LOCK
    command: server
    volumes:
    - /vault/logs
    - vault:/vault/file
    environment:
      SKIP_SETCAP: "true"
      VAULT_ADDR: http://localhost:8200
      VAULT_CLUSTER_INTERFACE: eth0
      VAULT_LOCAL_CONFIG: >
        {
            "cluster_name": "${STACK}",
            "api_addr": "http://vault{{.Task.Slot}}:8200",
            "ui": true,
            "storage": {
              "raft": { 
                "path": "/vault/file",
                "node_id": "node{{.Task.Slot}}",
                "retry_join": {
                  "leader_api_addr": "http://vault1:8200"
                }
              }
            },
            "cluster_addr": "http://vault{{.Task.Slot}}:8201",
            "seal" : {
              "transit" : {
                "address": "http://transit:8200",
                "token": "${TRANSIT_TOKEN}",
                "key_name": "autounseal",
                "mount_path": "transit/"
              }
            },
            "listener": {
                "tcp": {
                    "address": "0.0.0.0:8200",
                    "cluster_address": "0.0.0.0:8201",
                    "tls_disable": true
                }
            },
            "disable_mlock": true
        }
    networks:
      vault:
        aliases: [vault.vault]
    deploy:
      replicas: 3
      placement:
        constraints:
          - node.role==worker
      restart_policy:
        max_attempts: 5
volumes:
  vault:
    driver: glusterfs
    name: '{{index .Service.Labels "com.docker.stack.namespace"}}_vault-{{.Task.Slot}}'

```

---

<div class="post-metadata">

**Author:** ![chrisbecke](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/chrisbecke/32/17783_2.png) [@chrisbecke](https://discuss.hashicorp.com/u/chrisbecke)\
**Post date:** [May 19, 2022, 11:35am UTC](https://discuss.hashicorp.com/t/vault-does-not-honor-cluster-addr/39708/2 "2022-05-19T11:35:39Z")

</div>

OMG.  
VAULT\_CLUSTER\_INTERFACE make it ignore cluster\_addr. Even tho that effects the listen address not the publish url.

fantastic.
