Docker Swarm – Join Node to Swarm Cluster

Exported on 22-Aug-2021 12:25:10

Parameters

Name Type Script Reference Default Value Comment
ClusterNode_01 Linux / Unix Server clusternode_01
ClusterNode_01_Auth Linux OS Credential clusternode_01_auth
ClusterNode_02 Linux / Unix Server clusternode_02
ClusterNode_02_Auth Linux OS Credential clusternode_02_auth

1 - Read Docker Swarm join token

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
rm -rf ~/files
mkdir -p ~/files

sudo docker swarm join-token worker >> ~/files/worker.sh
sed -e '1,2d' < ~/files/worker.sh >> ~/files/worker-cleanup.sh

sudo docker swarm join-token manager >> ~/files/manager.sh
sed -e '1,2d' < ~/files/manager.sh >> ~/files/manager-cleanup.sh

2 - Get Docker Swarm Cluster Token-keys

Login as user on node

Connect via SSH
ssh user@hostname
Create archive Store Docker Swarm Cluster token-keys.zip from remote path files/
  1. Create a files archive from the contents of files/, relative to the home directory
  2. Rename the Files archive to "Store Docker Swarm Cluster token-keys.zip"
  3. Copy the Files archive to a central location where the other Files archives downloaded from Attune are.

3 - Copy node files to Docker Swarm secound node

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
Deploy archive Store Docker Swarm Cluster token-keys.zip to remote path files/
  1. Locate Files archive "Store Docker Swarm Cluster token-keys.zip", This can be downloaded from Attune
  2. Copy the Files archive to the server
  3. Extract the root of the Files archive to files/, relative to the home directory
  4. Check that the files are in the correct location

4 - Join node as Worker node to Docker Swarm

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
sudo sh ~/files/worker-cleanup.sh