How do I get the broker node addresses on Kubernetes (K8s) for cluster config?

Imtiaz Ahmed: Hi guys,
I see that we need to provide the starting node address and port in the config when deploying zeebe in cluster mode. What if I do not know what would be my starting node. The way we deploy apps is you stand up a cluster which spins up nodes dynamically and we have no control over which one will come first or even the address of any node before hand. Any way to get around it?

Alastair Firth: in K8s use a statefulset to have well-known addresses. Otherwise you probably need some static address for each broker. What platform are you using?

Alastair Firth:

  startup.sh: |
    #!/usr/bin/env bash

    set -eux -o pipefail

    configFile=/usr/local/zeebe/conf/zeebe.cfg.toml

    export ZEEBE_HOST=$(hostname -f)
    export ZEEBE_CLUSTER_NAME=$K8S_NAMESPACE

    #e.g. zeebe-0.zeebe-broker-service.customer-1-zeebe.svc.cluster.local:26502,zeebe-1.zeebe-broker-service.customer-1-zeebe.svc.cluster.local:26502,zeebe-2.zeebe-broker-service.customer-1-zeebe.svc.cluster.local:26502,
    export ZEEBE_CONTACT_POINTS=$(for ((i=0; i<${ZEEBE_CLUSTER_SIZE}; i++ )); do echo -n "zeebe-$i.$(hostname -d):26502,"; done)
    # e.g. "1"
    export ZEEBE_NODE_ID=$(echo $K8S_POD_NAME | tr -d "[:alpha:]-")
    export ZEEBE_GATEWAY_CLUSTER_HOST=${ZEEBE_GATEWAY_CLUSTER_HOST:-${ZEEBE_HOST}}

    env
    exec /usr/local/zeebe/bin/broker```

**Alastair Firth**: using a headless service and statefulsets to dynamically set the contact points to all nodes. not pretty but it works well.

**Nicolas**: There is an issue for us to implement DNS discovery over SRV record, so hopefully this improves in the future <https://github.com/zeebe-io/zeebe/issues/1930|https://github.com/zeebe-io/zeebe/issues/1930>

**Imtiaz Ahmed**: thanks guys...

**Imtiaz Ahmed**: btw we are using DC/OS Mesos underneath

**Imtiaz Ahmed**: but not directly.. There's an abstraction that we work with

**Imtiaz Ahmed**: I do have a load-balancer endpoint for each cluster but not the addresses of the nodes in the cluster before-hand

**Note**: This post was generated by [Slack Archivist](https://github.com/jwulf/slack-archivist) from a conversation in the Zeebe Slack, a source of valuable discussions on Zeebe ([get an invite](https://zeebe-slack-invite.herokuapp.com/)). Someone in the Slack thought this was worth sharing!

If this post answered a question for you, hit the Like button - we use that to assess which posts to put into docs.

You need to use the Service name … you don’t really need more than that…