<p>Have the Swarm Manager place the worker join token in a Key/Value store.  We use AWS Parameter Store but I believe Consul would be another option (I don't use it).</p>

<p>Each node can then retrieve the token while it is bootstrapping.</p>

CC BY-SA 3.0
2018-01-26T07:21:16.280Z
what if you have more than 1 manager?
Ta Mu
CC BY-SA 3.0
2018-01-26T13:05:54.563Z
The manager join token can be stored in a K/V store as well.  The initial manager token is the starting point for rebuilding or bootstrapping the Swarm.
swysocki
CC BY-SA 3.0
2018-01-25T22:20:59.223Z
2018-01-25T22:20:59.223Z
swysocki
<p>Simple answer with infrastructure as code, you don't rejoin nodes, you trash old nodes and bring fresh nodes to join the cluster. </p>

CC BY-SA 3.0
2018-01-26T07:22:24.110Z
still you need to tell the new nodes as well how they join as worker either manager. Or do you mean once a token is there you bake it into their IaC?
Ta Mu
CC BY-SA 3.0
2018-01-26T08:36:08.040Z
I just mean same principle as building a new cluster, code your cluster building process and then when you want to reset, build a new and trash the old one. How you code this is fairly personal ...
Tensibai
CC BY-SA 3.0
2018-01-25T21:26:19.067Z
2018-01-25T21:26:19.067Z
Tensibai
<p>Imagine you want to reset your Docker swarm from time to time. </p>

<p>How do you distribute join tokens to those zillions of nodes? How much automation is possible here?</p>

<docker><automation><docker-swarm><distributed-systems>
Automated Docker swarm reinitialization and token distribution
Ta Mu
# Automated Docker swarm reinitialization and token distribution

(Asked by: username_0 on 2018-01-25)

Imagine you want to reset your Docker swarm from time to time.

How do you distribute join tokens to those zillions of nodes? How much automation is possible here?

**Tags:** docker, automation, docker-swarm, distributed-systems


---

## 2 answers

### Answer by username_1 on 2018-01-25. Score: 2

Have the Swarm Manager place the worker join token in a Key/Value store. We use AWS Parameter Store but I believe Consul would be another option (I don't use it).

Each node can then retrieve the token while it is bootstrapping.

> **Comments:**
> **username_0**: what if you have more than 1 manager?  
> **username_1**: The manager join token can be stored in a K/V store as well.  The initial manager token is the starting point for rebuilding or bootstrapping the Swarm.  

---

### Answer by username_2 on 2018-01-25. Score: 1

Simple answer with infrastructure as code, you don't rejoin nodes, you trash old nodes and bring fresh nodes to join the cluster.

> **Comments:**
> **username_0**: still you need to tell the new nodes as well how they join as worker either manager. Or do you mean once a token is there you bake it into their IaC?  
> **username_2**: I just mean same principle as building a new cluster, code your cluster building process and then when you want to reset, build a new and trash the old one. How you code this is fairly personal ...  

---

