Cannot join node to cluster - proxmox clone

Hi, I have build an ns8 node, when I try to join this node to the cluster it fails with an error message:

add_node error: <4>The public key “node 1 public key” is already used by node 1

The proxmox template was build from the .qcow on the download page. Ns8 is pre-installed on rocky-9. The new node is a VM build from the same template I used for the cluster leader node(1).

Is there a way to recreate a new (unique) public/private key pair for this node?

I edited the post as I was able to change the wireguard keys.

Create wireguard private and public key, see also VPN | NS8 dev manual and Quick Start - WireGuard

(umask 0077; wg genkey | tee /etc/nethserver/wg0.key | wg pubkey) | tee /etc/nethserver/wg0.pub

That command creates 2 files in /etc/nethserver/ - private key wg0.key and public key wg0.pub.

The content of /etc/nethserver/wg0.key needs to be set in /etc/wireguard/wg0.conf:

PrivateKey = <wg private key>

If you change keys on the leader node, I think the public key from /etc/nethserver/wg0.pub needs to be set in the redis database, see also Database | NS8 dev manual

redis-cli hset node/1/vpn public_key <wg public key>

Reload the wireguard service to apply the new config:

systemctl reload wg-quick@wg0

Sources:

Relevant core code for creating keys: ns8-core/core/imageroot/var/lib/nethserver/node/install-finalize.sh at 9fb93bc7719e76576872f1c95515d4e4f7baac7c · NethServer/ns8-core · GitHub

I tried to join the node to the cluster after first logon on the https:///cluster-admin page. Re-generate the nodes local wg keys was the solution.

I never pressed “create cluster” only “join cluster” on the node. Did not have to change anything else on the leader node. Works as expected.

Thx.

1 Like