For each additional node we would like to add to the cluster, we first need to generate a join token on the existing instance with the command.
lxc cluster add <new member name>
Please note that further nodes need to be brand new LXD servers. In case they’re not, we need to make sure to clear their contents before adding them, otherwise, the data would be lost.
For each of the remaining nodes we would like to add, we should connect to them, and run
sudo lxd init
Like before, we’ll be prompted with several questions that look like the below. We will answer yes to whether we would like to join an existing cluster, and use the join token generated for that instance.
Would you like to use LXD clustering? (yes/no) [default=no]: yes
What IP address or DNS name should be used to reach this node?
Are you joining an existing cluster? (yes/no) [default=no]: yes
Do you have a join token? (yes/no/[token]) [default=no]: eyJzZXJ2ZXJfbmFtZSI6Im1hcnZpbklJSSIsImZpbmdlcnByaW50IjoiNjhlMjljYzBlN2IxNTkzNWY1MGM5YjI3NjM0NmFhNDU1OTc2ZWQ1N2Y4ODAyZTYxMTc4MzUwOThlNjNkNmFmYSIsImFkZHJlc3NlcyI6WyIxOTIuMTY4LjAuMTg6ODQ0MyJdLCJzZWNyZXQiOiIxODg3ZWQxMmIxN2MwOTYwZDM1NTU0Zjc3M2IxNzU2NmZlNWExZjQ1M2VhZTc1NmVmYzk0OGExMDUyYjYwNTE5In0=
All existing data is lost when joining a cluster, continue? (yes/no)[default= no]: yes
Choose “size” property for storage pool “local”:
Choose "source" property for storage pool "local":
Choose "zfs.pool_name" property for storage pool "local":
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
ⓘYou’ll notice we haven’t added any details for “size” and “source” property for a storage pool - leaving this empty would just create a loop. Similarly, leaving the “zfs.pool_name” empty, would default to the name of the LXD pool.
We should repeat this process for each of the nodes we’d like to add to the cluster.
Once completed, we can check what’s running in the cluster with
lxc cluster list